2014-09-24 14:45:35 -04:00
|
|
|
class SiteTextSerializer < ApplicationSerializer
|
2015-11-30 15:22:58 -05:00
|
|
|
attributes :id, :value, :overridden?, :can_revert?
|
2014-09-24 14:45:35 -04:00
|
|
|
|
2015-08-07 14:05:08 -04:00
|
|
|
def id
|
2015-11-23 16:45:05 -05:00
|
|
|
object[:id]
|
2014-09-24 14:45:35 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def value
|
2015-11-23 16:45:05 -05:00
|
|
|
object[:value]
|
2014-09-24 14:45:35 -04:00
|
|
|
end
|
|
|
|
|
2015-11-30 15:22:58 -05:00
|
|
|
def overridden?
|
2015-11-23 16:45:05 -05:00
|
|
|
current_val = value
|
|
|
|
|
|
|
|
I18n.overrides_disabled do
|
|
|
|
return I18n.t(object[:id]) != current_val
|
|
|
|
end
|
2014-09-24 14:45:35 -04:00
|
|
|
end
|
2015-11-30 15:22:58 -05:00
|
|
|
|
|
|
|
alias_method :can_revert?, :overridden?
|
2014-09-24 14:45:35 -04:00
|
|
|
end
|
2015-11-23 16:45:05 -05:00
|
|
|
|