mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-19 00:25:57 +08:00
23 lines
417 B
Ruby
Vendored
23 lines
417 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module DiscourseTemplates
|
|
class TemplatesSerializer < ApplicationSerializer
|
|
attributes :id, :title, :slug, :content, :tags, :usages
|
|
|
|
def content
|
|
object.first_post.raw
|
|
end
|
|
|
|
def include_tags?
|
|
SiteSetting.tagging_enabled
|
|
end
|
|
|
|
def tags
|
|
object.tags.map(&:name).sort
|
|
end
|
|
|
|
def usages
|
|
object.template_item_usage_count
|
|
end
|
|
end
|
|
end
|