2013-05-10 01:47:47 -05:00
|
|
|
class BasicCategorySerializer < ApplicationSerializer
|
|
|
|
|
|
|
|
attributes :id,
|
|
|
|
:name,
|
|
|
|
:color,
|
|
|
|
:text_color,
|
|
|
|
:slug,
|
|
|
|
:topic_count,
|
2014-05-28 12:33:39 -05:00
|
|
|
:post_count,
|
2015-08-27 12:14:59 -05:00
|
|
|
:position,
|
2013-05-10 01:47:47 -05:00
|
|
|
:description,
|
2014-10-21 23:48:18 -05:00
|
|
|
:description_text,
|
2013-05-10 01:47:47 -05:00
|
|
|
:topic_url,
|
2013-07-16 00:44:07 -05:00
|
|
|
:read_restricted,
|
2013-10-23 12:29:20 -05:00
|
|
|
:permission,
|
2014-04-17 04:17:39 -05:00
|
|
|
:parent_category_id,
|
2014-06-27 14:35:25 -05:00
|
|
|
:notification_level,
|
2015-07-02 15:18:59 -05:00
|
|
|
:can_edit,
|
2015-09-02 16:46:04 -05:00
|
|
|
:topic_template,
|
2016-11-01 11:18:31 -05:00
|
|
|
:has_children,
|
|
|
|
:sort_order,
|
2017-02-21 17:08:09 -06:00
|
|
|
:sort_ascending,
|
2017-03-01 11:03:12 -06:00
|
|
|
:show_subcategory_list,
|
2017-03-02 09:56:04 -06:00
|
|
|
:num_featured_topics,
|
2017-03-08 10:31:30 -06:00
|
|
|
:default_view,
|
2017-03-22 15:54:12 -05:00
|
|
|
:subcategory_list_style,
|
|
|
|
:default_top_period
|
2013-05-10 01:47:47 -05:00
|
|
|
|
2016-12-02 01:15:34 -06:00
|
|
|
has_one :uploaded_logo, embed: :object, serializer: CategoryUploadSerializer
|
|
|
|
has_one :uploaded_background, embed: :object, serializer: CategoryUploadSerializer
|
|
|
|
|
2013-10-23 13:40:39 -05:00
|
|
|
def include_parent_category_id?
|
|
|
|
parent_category_id
|
|
|
|
end
|
2014-06-24 16:27:29 -05:00
|
|
|
|
|
|
|
def description
|
2016-01-27 17:26:25 -06:00
|
|
|
object.uncategorized? ? I18n.t('category.uncategorized_description') : object.description
|
2014-06-24 16:27:29 -05:00
|
|
|
end
|
2014-08-12 12:30:28 -05:00
|
|
|
|
|
|
|
def can_edit
|
|
|
|
true
|
|
|
|
end
|
2014-09-09 08:32:58 -05:00
|
|
|
|
2014-08-12 12:30:28 -05:00
|
|
|
def include_can_edit?
|
|
|
|
scope && scope.can_edit?(object)
|
|
|
|
end
|
|
|
|
|
2015-12-13 04:26:16 -06:00
|
|
|
def notification_level
|
2016-02-03 06:58:59 -06:00
|
|
|
object.notification_level
|
2015-12-13 04:26:16 -06:00
|
|
|
end
|
2013-05-10 01:47:47 -05:00
|
|
|
end
|