5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-24 15:06:22 +00:00
panel/app/models/metadata_lang.rb

29 lines
496 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# Un campo de idioma
class MetadataLang < MetadataTemplate
2023-10-06 13:53:19 +00:00
include Metadata::NonIndexableConcern
include Metadata::AlwaysPublicConcern
def default_value
super || I18n.locale
end
# @return [Symbol]
def document_value
document.collection.label.to_sym
2021-02-17 21:40:07 +00:00
end
2023-10-06 13:53:19 +00:00
# @return [Symbol]
def value
self[:value] ||= document_value || default_value
end
2023-10-06 13:53:19 +00:00
# Todos los locales
#
# @return [Array<Symbol>]
def values
2020-05-23 15:38:03 +00:00
site.locales
end
end