5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 05:36:21 +00:00
panel/app/models/metadata_lang.rb

21 lines
329 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# Un campo de idioma
class MetadataLang < MetadataTemplate
def default_value
super || I18n.locale
end
2021-02-17 21:40:07 +00:00
def value_from_document
document.collection.label.to_sym
2021-02-17 21:40:07 +00:00
end
def value
2021-02-17 21:40:07 +00:00
self[:value] ||= value_from_document || default_value
end
def values
2020-05-23 15:38:03 +00:00
site.locales
end
end