2013-03-15 02:45:29 +08:00
|
|
|
class SuggestedTopicSerializer < ListableTopicSerializer
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2016-02-03 15:50:05 +08:00
|
|
|
# need to embed so we have users
|
|
|
|
# front page json gets away without embedding
|
|
|
|
class SuggestedPosterSerializer < ApplicationSerializer
|
|
|
|
attributes :extras, :description
|
|
|
|
has_one :user, serializer: BasicUserSerializer, embed: :objects
|
|
|
|
end
|
|
|
|
|
2016-07-06 03:00:09 +08:00
|
|
|
attributes :archetype, :like_count, :views, :category_id, :tags
|
2016-02-03 15:50:05 +08:00
|
|
|
has_many :posters, serializer: SuggestedPosterSerializer, embed: :objects
|
|
|
|
|
|
|
|
def posters
|
|
|
|
object.posters || []
|
|
|
|
end
|
2016-07-06 03:00:09 +08:00
|
|
|
|
|
|
|
def include_tags?
|
|
|
|
SiteSetting.tagging_enabled
|
|
|
|
end
|
|
|
|
|
|
|
|
def tags
|
|
|
|
object.tags.map(&:name)
|
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|