discourse/app/serializers/admin_plugin_serializer.rb
2015-02-06 18:08:57 -05:00

35 lines
568 B
Ruby

class AdminPluginSerializer < ApplicationSerializer
attributes :name,
:version,
:url,
:admin_route
def name
object.metadata.name
end
def version
object.metadata.version
end
def url
object.metadata.url
end
def include_url?
url.present?
end
def admin_route
route = object.admin_route
return unless route
ret = route.slice(:location, :label)
ret[:full_location] = "adminPlugins.#{ret[:location]}"
ret
end
def include_admin_route?
admin_route.present?
end
end