mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 01:22:36 +08:00
22 lines
356 B
Ruby
22 lines
356 B
Ruby
class SiteTextSerializer < ApplicationSerializer
|
|
attributes :id, :value, :overridden?, :can_revert?
|
|
|
|
def id
|
|
object[:id]
|
|
end
|
|
|
|
def value
|
|
object[:value]
|
|
end
|
|
|
|
def overridden?
|
|
current_val = value
|
|
|
|
I18n.overrides_disabled do
|
|
return I18n.t(object[:id]) != current_val
|
|
end
|
|
end
|
|
|
|
alias_method :can_revert?, :overridden?
|
|
end
|