discourse/app/serializers/site_text_serializer.rb

23 lines
357 B
Ruby
Raw Normal View History

2014-09-24 13:45:35 -05:00
class SiteTextSerializer < ApplicationSerializer
attributes :id, :value, :overridden?, :can_revert?
2014-09-24 13:45:35 -05:00
def id
object[:id]
2014-09-24 13:45:35 -05:00
end
def value
object[:value]
2014-09-24 13:45:35 -05:00
end
def overridden?
current_val = value
I18n.overrides_disabled do
return I18n.t(object[:id]) != current_val
end
2014-09-24 13:45:35 -05:00
end
alias_method :can_revert?, :overridden?
2014-09-24 13:45:35 -05:00
end