5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-24 12:46:22 +00:00
panel/app/models/metadata_lang.rb
f 915ba0761f
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
feat: usar mixins
2023-10-06 10:53:19 -03:00

28 lines
496 B
Ruby

# frozen_string_literal: true
# Un campo de idioma
class MetadataLang < MetadataTemplate
include Metadata::NonIndexableConcern
include Metadata::AlwaysPublicConcern
def default_value
super || I18n.locale
end
# @return [Symbol]
def document_value
document.collection.label.to_sym
end
# @return [Symbol]
def value
self[:value] ||= document_value || default_value
end
# Todos los locales
#
# @return [Array<Symbol>]
def values
site.locales
end
end