2013-03-14 13:45:29 -05:00
|
|
|
class SuggestedTopicSerializer < ListableTopicSerializer
|
2013-02-05 13:16:51 -06:00
|
|
|
|
2016-02-03 01:50:05 -06: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-12-05 06:31:43 -06:00
|
|
|
attributes :archetype, :like_count, :views, :category_id, :tags, :featured_link
|
2016-02-03 01:50:05 -06:00
|
|
|
has_many :posters, serializer: SuggestedPosterSerializer, embed: :objects
|
|
|
|
|
|
|
|
def posters
|
|
|
|
object.posters || []
|
|
|
|
end
|
2016-07-05 14:00:09 -05:00
|
|
|
|
|
|
|
def include_tags?
|
|
|
|
SiteSetting.tagging_enabled
|
|
|
|
end
|
|
|
|
|
|
|
|
def tags
|
|
|
|
object.tags.map(&:name)
|
|
|
|
end
|
2016-12-05 06:31:43 -06:00
|
|
|
|
|
|
|
def include_featured_link?
|
|
|
|
SiteSetting.topic_featured_link_enabled
|
|
|
|
end
|
|
|
|
|
|
|
|
def featured_link
|
|
|
|
object.featured_link
|
|
|
|
end
|
2013-02-05 13:16:51 -06:00
|
|
|
end
|