5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 12:31:42 +00:00

fix: no mostrar el campo si no hay locales

This commit is contained in:
f 2023-04-05 19:30:59 -03:00
parent 29be4b26b0
commit 6bc013c859
2 changed files with 25 additions and 23 deletions

View file

@ -1,9 +1,10 @@
%tr{ id: attribute }
%th= post_label_t(attribute, post: post)
%td
%ul
- metadata.value.each do |uuid|
- p = site.docs.find(uuid, uuid: true)
%li{ dir: t("locales.#{p.lang.value}.dir"), lang: p.lang.value }
= link_to p.title.value,
site_post_path(site, p.id, locale: p.lang.value)
- if site.locales.count > 1
%tr{ id: attribute }
%th= post_label_t(attribute, post: post)
%td
%ul
- metadata.value.each do |uuid|
- p = site.docs.find(uuid, uuid: true)
%li{ dir: t("locales.#{p.lang.value}.dir"), lang: p.lang.value }
= link_to p.title.value,
site_post_path(site, p.id, locale: p.lang.value)

View file

@ -1,18 +1,19 @@
%fieldset
%legend= post_label_t(attribute, post: post)
- if site.locales.count > 1
%fieldset
%legend= post_label_t(attribute, post: post)
= render 'posts/attribute_feedback',
post: post, attribute: attribute, metadata: metadata
= render 'posts/attribute_feedback',
post: post, attribute: attribute, metadata: metadata
- site.locales.each do |locale|
- next if post.lang.value == locale
- locale_t = t("locales.#{locale}.name", default: locale.to_s.humanize)
- value = metadata.value.find do |v|
- metadata.values[locale].values.include? v
- site.locales.each do |locale|
- next if post.lang.value == locale
- locale_t = t("locales.#{locale}.name", default: locale.to_s.humanize)
- value = metadata.value.find do |v|
- metadata.values[locale].values.include? v
.form-group
= label_tag "#{base}_#{attribute}_#{locale}", locale_t
.form-group
= label_tag "#{base}_#{attribute}_#{locale}", locale_t
= select_tag("#{plain_field_name_for(base, attribute)}[]",
options_for_select(metadata.values[locale], value),
**field_options(attribute, metadata), include_blank: t('.empty'))
= select_tag("#{plain_field_name_for(base, attribute)}[]",
options_for_select(metadata.values[locale], value),
**field_options(attribute, metadata), include_blank: t('.empty'))