5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-05 21:35:46 +00:00

Merge branch 'issue-10491' into panel.sutty.nl
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
f 2023-04-05 19:31:24 -03:00
commit 20cfaf0777
3 changed files with 26 additions and 24 deletions

View file

@ -44,6 +44,6 @@ class MetadataLocales < MetadataHasAndBelongsToMany
def posts
other_locales.map do |locale|
site.posts(lang: locale).where(layout: post.layout.value)
end.reduce(&:concat) || PostRelation.new
end.reduce(&:concat) || PostRelation.new(site: site, lang: 'any')
end
end

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'))