2015-02-06 16:32:59 -06:00
|
|
|
class AdminPluginSerializer < ApplicationSerializer
|
2015-02-10 11:14:23 -06:00
|
|
|
attributes :id,
|
|
|
|
:name,
|
2015-02-06 16:32:59 -06:00
|
|
|
:version,
|
2015-02-06 17:08:57 -06:00
|
|
|
:url,
|
2015-07-02 11:45:17 -05:00
|
|
|
:admin_route,
|
|
|
|
:enabled,
|
|
|
|
:enabled_setting
|
2015-02-06 16:32:59 -06:00
|
|
|
|
2015-02-10 11:14:23 -06:00
|
|
|
def id
|
|
|
|
object.metadata.name
|
|
|
|
end
|
|
|
|
|
2015-02-06 16:32:59 -06:00
|
|
|
def name
|
|
|
|
object.metadata.name
|
|
|
|
end
|
|
|
|
|
|
|
|
def version
|
|
|
|
object.metadata.version
|
|
|
|
end
|
|
|
|
|
2015-02-06 17:08:57 -06:00
|
|
|
def url
|
|
|
|
object.metadata.url
|
|
|
|
end
|
|
|
|
|
2015-07-02 11:45:17 -05:00
|
|
|
def enabled
|
|
|
|
object.enabled?
|
|
|
|
end
|
|
|
|
|
|
|
|
def enabled_setting
|
|
|
|
object.enabled_site_setting
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_enabled_setting?
|
|
|
|
enabled_setting.present?
|
|
|
|
end
|
|
|
|
|
2015-02-06 17:08:57 -06:00
|
|
|
def include_url?
|
|
|
|
url.present?
|
|
|
|
end
|
|
|
|
|
2015-02-06 16:32:59 -06:00
|
|
|
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
|