mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-17 05:36:22 +00:00
20 lines
322 B
Ruby
20 lines
322 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Un campo de idioma
|
|
class MetadataLang < MetadataTemplate
|
|
def default_value
|
|
super || I18n.locale
|
|
end
|
|
|
|
def value_from_document
|
|
document.collection.label
|
|
end
|
|
|
|
def value
|
|
self[:value] ||= value_from_document || default_value
|
|
end
|
|
|
|
def values
|
|
site.locales
|
|
end
|
|
end
|