2020-05-23 16:52:58 +00:00
|
|
|
-#
|
|
|
|
|
|
|
|
Crea un input-map para cada idioma por separado. Podríamos hacer uno
|
|
|
|
solo que tenga todos los idiomas pero puede ser una interfaz confusa.
|
|
|
|
|
|
|
|
TODO: Esto permite seleccionar más de una traducción por idioma...
|
|
|
|
|
|
|
|
- site.locales.each do |locale|
|
|
|
|
-# Ignorar el idioma actual
|
|
|
|
- next if post.lang.value == locale
|
2020-05-23 18:42:12 +00:00
|
|
|
- locale_t = t("locales.#{locale}.name")
|
2020-05-23 16:52:58 +00:00
|
|
|
- values = metadata.value.select do |x|
|
2021-03-03 12:43:15 +00:00
|
|
|
- metadata.values[locale].values.include? x
|
2020-05-23 16:52:58 +00:00
|
|
|
|
|
|
|
.form-group
|
2020-11-27 22:32:16 +00:00
|
|
|
= label_tag "#{base}_#{attribute}_#{locale}", locale_t
|
2020-05-23 16:52:58 +00:00
|
|
|
|
2020-05-23 19:34:45 +00:00
|
|
|
.mapable{ dir: t("locales.#{locale}.dir"), lang: locale,
|
|
|
|
data: { values: values.to_json,
|
2021-03-03 12:43:15 +00:00
|
|
|
'default-values': metadata.values[locale].to_json,
|
2020-11-27 22:32:16 +00:00
|
|
|
name: "#{base}[#{attribute}][]",
|
2020-05-23 16:52:58 +00:00
|
|
|
list: id_for_datalist(attribute, locale),
|
|
|
|
button: t('posts.attributes.add'),
|
2020-05-23 18:42:12 +00:00
|
|
|
remove: 'false', legend: locale_t,
|
2020-05-23 16:52:58 +00:00
|
|
|
described: id_for_help(attribute, locale) } }
|
|
|
|
|
2020-11-27 22:32:16 +00:00
|
|
|
= text_field(*field_name_for(base, attribute, '[]'),
|
2020-05-23 16:52:58 +00:00
|
|
|
value: values.join(', '),
|
2020-05-23 19:34:45 +00:00
|
|
|
dir: t("locales.#{locale}.dir"), lang: locale,
|
2020-05-23 16:52:58 +00:00
|
|
|
**field_options(attribute, metadata))
|
|
|
|
|
|
|
|
= render 'posts/attribute_feedback',
|
|
|
|
post: post,
|
|
|
|
attribute: [attribute, 'mapable'].flatten,
|
|
|
|
metadata: metadata
|
|
|
|
|
|
|
|
%datalist{ id: id_for_datalist(attribute, locale) }
|
2021-03-03 12:43:15 +00:00
|
|
|
- metadata.values[locale].keys.each do |value|
|
2020-05-23 16:52:58 +00:00
|
|
|
%option{ value: value }
|