5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 16:11: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 } - if site.locales.count > 1
%th= post_label_t(attribute, post: post) %tr{ id: attribute }
%td %th= post_label_t(attribute, post: post)
%ul %td
- metadata.value.each do |uuid| %ul
- p = site.docs.find(uuid, uuid: true) - metadata.value.each do |uuid|
%li{ dir: t("locales.#{p.lang.value}.dir"), lang: p.lang.value } - p = site.docs.find(uuid, uuid: true)
= link_to p.title.value, %li{ dir: t("locales.#{p.lang.value}.dir"), lang: p.lang.value }
site_post_path(site, p.id, locale: 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 - if site.locales.count > 1
%legend= post_label_t(attribute, post: post) %fieldset
%legend= post_label_t(attribute, post: post)
= render 'posts/attribute_feedback', = render 'posts/attribute_feedback',
post: post, attribute: attribute, metadata: metadata post: post, attribute: attribute, metadata: metadata
- site.locales.each do |locale| - site.locales.each do |locale|
- next if post.lang.value == locale - next if post.lang.value == locale
- locale_t = t("locales.#{locale}.name", default: locale.to_s.humanize) - locale_t = t("locales.#{locale}.name", default: locale.to_s.humanize)
- value = metadata.value.find do |v| - value = metadata.value.find do |v|
- metadata.values[locale].values.include? v - metadata.values[locale].values.include? v
.form-group .form-group
= label_tag "#{base}_#{attribute}_#{locale}", locale_t = label_tag "#{base}_#{attribute}_#{locale}", locale_t
= select_tag("#{plain_field_name_for(base, attribute)}[]", = select_tag("#{plain_field_name_for(base, attribute)}[]",
options_for_select(metadata.values[locale], value), options_for_select(metadata.values[locale], value),
**field_options(attribute, metadata), include_blank: t('.empty')) **field_options(attribute, metadata), include_blank: t('.empty'))