discourse/app/serializers/site_text_serializer.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
468 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2014-09-24 14:45:35 -04:00
class SiteTextSerializer < ApplicationSerializer
attributes :id, :value, :overridden?, :can_revert?
2014-09-24 14:45:35 -04:00
def id
object[:id]
2014-09-24 14:45:35 -04:00
end
def value
object[:value]
2014-09-24 14:45:35 -04:00
end
def overridden?
2019-07-01 21:53:16 -04:00
if options[:overridden_keys]
options[:overridden_keys].include?(object[:id])
else
TranslationOverride.exists?(locale: object[:locale], translation_key: object[:id])
end
2014-09-24 14:45:35 -04:00
end
alias_method :can_revert?, :overridden?
2014-09-24 14:45:35 -04:00
end