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