2013-05-10 02:47:47 -04:00
|
|
|
class BasicCategorySerializer < ApplicationSerializer
|
|
|
|
|
|
|
|
attributes :id,
|
|
|
|
:name,
|
|
|
|
:color,
|
|
|
|
:text_color,
|
|
|
|
:slug,
|
|
|
|
:topic_count,
|
2014-05-28 13:33:39 -04:00
|
|
|
:post_count,
|
2015-08-27 13:14:59 -04:00
|
|
|
:position,
|
2013-05-10 02:47:47 -04:00
|
|
|
:description,
|
2014-10-22 00:48:18 -04:00
|
|
|
:description_text,
|
2013-05-10 02:47:47 -04:00
|
|
|
:topic_url,
|
2016-01-12 06:06:51 -05:00
|
|
|
:logo_url,
|
|
|
|
:background_url,
|
2013-07-16 01:44:07 -04:00
|
|
|
:read_restricted,
|
2013-10-23 13:29:20 -04:00
|
|
|
:permission,
|
2014-04-17 05:17:39 -04:00
|
|
|
:parent_category_id,
|
2014-06-27 15:35:25 -04:00
|
|
|
:notification_level,
|
2015-07-02 16:18:59 -04:00
|
|
|
:can_edit,
|
2015-09-02 17:46:04 -04:00
|
|
|
:topic_template,
|
2016-01-12 05:29:26 -05:00
|
|
|
:has_children
|
2013-05-10 02:47:47 -04:00
|
|
|
|
2013-10-23 14:40:39 -04:00
|
|
|
def include_parent_category_id?
|
|
|
|
parent_category_id
|
|
|
|
end
|
2014-06-24 17:27:29 -04:00
|
|
|
|
|
|
|
def description
|
2016-01-27 18:26:25 -05:00
|
|
|
object.uncategorized? ? I18n.t('category.uncategorized_description') : object.description
|
2014-06-24 17:27:29 -04:00
|
|
|
end
|
2014-08-12 13:30:28 -04:00
|
|
|
|
|
|
|
def can_edit
|
|
|
|
true
|
|
|
|
end
|
2014-09-09 09:32:58 -04:00
|
|
|
|
2014-08-12 13:30:28 -04:00
|
|
|
def include_can_edit?
|
|
|
|
scope && scope.can_edit?(object)
|
|
|
|
end
|
|
|
|
|
2015-12-13 05:26:16 -05:00
|
|
|
def notification_level
|
2016-02-03 07:58:59 -05:00
|
|
|
object.notification_level
|
2015-12-13 05:26:16 -05:00
|
|
|
end
|
2013-05-10 02:47:47 -04:00
|
|
|
end
|