2019-09-17 21:27:51 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Un campo de idioma
|
|
|
|
class MetadataLang < MetadataTemplate
|
|
|
|
def default_value
|
2020-11-11 18:29:12 +00:00
|
|
|
super || I18n.locale
|
2019-09-17 21:27:51 +00:00
|
|
|
end
|
|
|
|
|
2021-06-16 14:35:37 +00:00
|
|
|
# @return [Symbol]
|
|
|
|
def document_value
|
2021-03-03 12:43:15 +00:00
|
|
|
document.collection.label.to_sym
|
2021-02-17 21:40:07 +00:00
|
|
|
end
|
|
|
|
|
2019-09-17 21:27:51 +00:00
|
|
|
def value
|
2021-06-16 14:35:37 +00:00
|
|
|
self[:value] ||= document_value || default_value
|
2019-09-17 21:27:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def values
|
2020-05-23 15:38:03 +00:00
|
|
|
site.locales
|
2019-09-17 21:27:51 +00:00
|
|
|
end
|
|
|
|
end
|