From ac82d609d44f50e5595f790e5f5078c6b3a6b54c Mon Sep 17 00:00:00 2001 From: f Date: Fri, 27 Nov 2020 19:32:16 -0300 Subject: [PATCH] permitir cambiar la base de los formularios --- app/views/posts/_form.haml | 2 +- app/views/posts/attributes/_array.haml | 6 +++--- app/views/posts/attributes/_belongs_to.haml | 4 ++-- app/views/posts/attributes/_boolean.haml | 6 +++--- app/views/posts/attributes/_color.haml | 4 ++-- app/views/posts/attributes/_content.haml | 4 ++-- app/views/posts/attributes/_date.haml | 4 ++-- app/views/posts/attributes/_document_date.haml | 4 ++-- app/views/posts/attributes/_email.haml | 4 ++-- app/views/posts/attributes/_encrypted_text.haml | 4 ++-- app/views/posts/attributes/_event.haml | 12 ++++++------ app/views/posts/attributes/_file.haml | 14 +++++++------- app/views/posts/attributes/_geo.haml | 8 ++++---- .../posts/attributes/_has_and_belongs_to_many.haml | 6 +++--- app/views/posts/attributes/_has_many.haml | 6 +++--- app/views/posts/attributes/_image.haml | 14 +++++++------- app/views/posts/attributes/_lang.haml | 2 +- app/views/posts/attributes/_locales.haml | 6 +++--- app/views/posts/attributes/_markdown.haml | 4 ++-- app/views/posts/attributes/_markdown_content.haml | 4 ++-- app/views/posts/attributes/_number.haml | 4 ++-- app/views/posts/attributes/_permalink.haml | 4 ++-- app/views/posts/attributes/_predefined_array.haml | 6 +++--- app/views/posts/attributes/_related_posts.haml | 6 +++--- app/views/posts/attributes/_slug.haml | 4 ++-- app/views/posts/attributes/_string.haml | 4 ++-- app/views/posts/attributes/_tel.haml | 4 ++-- app/views/posts/attributes/_text.haml | 4 ++-- app/views/posts/attributes/_url.haml | 4 ++-- 29 files changed, 79 insertions(+), 79 deletions(-) diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index ef16484b..a9819a1b 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -45,7 +45,7 @@ - cache metadata do = render("posts/attributes/#{type}", - post: post, attribute: attribute, + base: 'post', post: post, attribute: attribute, metadata: metadata, site: site, dir: dir, locale: @locale, autofocus: (post.attributes.first == attribute)) diff --git a/app/views/posts/attributes/_array.haml b/app/views/posts/attributes/_array.haml index b96d32a1..73e96dea 100644 --- a/app/views/posts/attributes/_array.haml +++ b/app/views/posts/attributes/_array.haml @@ -1,13 +1,13 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) .taggable{ dir: dir, lang: locale, data: { values: metadata.value.to_json, - name: "post[#{attribute}][]", list: id_for_datalist(attribute), + name: "#{base}[#{attribute}][]", list: id_for_datalist(attribute), remove: 'false', legend: post_label_t(attribute, post: post), button: t('posts.attributes.add'), described: id_for_help(attribute) } } - = text_field(*field_name_for('post', attribute, '[]'), + = text_field(*field_name_for(base, attribute, '[]'), value: metadata.value.join(', '), **field_options(attribute, metadata)) diff --git a/app/views/posts/attributes/_belongs_to.haml b/app/views/posts/attributes/_belongs_to.haml index b74b09de..06594742 100644 --- a/app/views/posts/attributes/_belongs_to.haml +++ b/app/views/posts/attributes/_belongs_to.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = text_field 'post', attribute, value: metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = text_field base, attribute, value: metadata.value, dir: dir, lang: locale, list: id_for_datalist(attribute), pattern: metadata.values.values.join('|'), autocomplete: 'off', **field_options(attribute, metadata) diff --git a/app/views/posts/attributes/_boolean.haml b/app/views/posts/attributes/_boolean.haml index c959e4b5..e07feca4 100644 --- a/app/views/posts/attributes/_boolean.haml +++ b/app/views/posts/attributes/_boolean.haml @@ -1,11 +1,11 @@ .form-check - = hidden_field_tag "post[#{attribute}]", '0', id: '' + = hidden_field_tag "#{base}[#{attribute}]", '0', id: '' .custom-control.custom-switch - = check_box_tag "post[#{attribute}]", '1', metadata.value, + = check_box_tag "#{base}[#{attribute}]", '1', metadata.value, class: "custom-control-input #{invalid(post, attribute)}", aria: { describedby: id_for_help(attribute) }, autofocus: autofocus - = label_tag "post_#{attribute}", post_label_t(attribute, post: post), + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post), class: 'custom-control-label' = render 'posts/attribute_feedback', diff --git a/app/views/posts/attributes/_color.haml b/app/views/posts/attributes/_color.haml index a2945016..0959f959 100644 --- a/app/views/posts/attributes/_color.haml +++ b/app/views/posts/attributes/_color.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = color_field 'post', attribute, value: metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = color_field base, attribute, value: metadata.value, **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/attributes/_content.haml b/app/views/posts/attributes/_content.haml index d1d1ecf0..1161e6e3 100644 --- a/app/views/posts/attributes/_content.haml +++ b/app/views/posts/attributes/_content.haml @@ -1,5 +1,5 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata @@ -9,7 +9,7 @@ .alert.alert-info :markdown #{t('editor.alert')} - = text_area_tag "post[#{attribute}]", '', + = text_area_tag "#{base}[#{attribute}]", '', dir: dir, lang: locale, **field_options(attribute, metadata), class: 'd-none' diff --git a/app/views/posts/attributes/_date.haml b/app/views/posts/attributes/_date.haml index 392b6b93..38c4f500 100644 --- a/app/views/posts/attributes/_date.haml +++ b/app/views/posts/attributes/_date.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = date_field 'post', attribute, value: metadata.value.to_date.strftime('%F'), + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = date_field base, attribute, value: metadata.value.to_date.strftime('%F'), **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/attributes/_document_date.haml b/app/views/posts/attributes/_document_date.haml index ac1c7b02..65516718 100644 --- a/app/views/posts/attributes/_document_date.haml +++ b/app/views/posts/attributes/_document_date.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = date_field 'post', attribute, value: metadata.value.strftime('%F'), + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = date_field base, attribute, value: metadata.value.strftime('%F'), **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/attributes/_email.haml b/app/views/posts/attributes/_email.haml index b2a301c3..a8b5cf8c 100644 --- a/app/views/posts/attributes/_email.haml +++ b/app/views/posts/attributes/_email.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = email_field 'post', attribute, value: metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = email_field base, attribute, value: metadata.value, **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/attributes/_encrypted_text.haml b/app/views/posts/attributes/_encrypted_text.haml index 1d732e08..59cb4193 100644 --- a/app/views/posts/attributes/_encrypted_text.haml +++ b/app/views/posts/attributes/_encrypted_text.haml @@ -1,10 +1,10 @@ .form-group - = label_tag "post_#{attribute}" do + = label_tag "#{base}_#{attribute}" do %abbr{ title: t('lockbox.help.description') } 🔒 %span.sr-only= t('lockbox.help.title') = post_label_t(attribute, post: post) - = text_area_tag "post[#{attribute}]", metadata.value, + = text_area_tag "#{base}[#{attribute}]", metadata.value, dir: dir, lang: locale, **field_options(attribute, metadata) = render 'posts/attribute_feedback', diff --git a/app/views/posts/attributes/_event.haml b/app/views/posts/attributes/_event.haml index 8ff9286d..d68a3377 100644 --- a/app/views/posts/attributes/_event.haml +++ b/app/views/posts/attributes/_event.haml @@ -11,22 +11,22 @@ .row{ class: dt } .col .date.form-group - = label_tag "post_#{attribute}_#{dt}_date", + = label_tag "#{base}_#{attribute}_#{dt}_date", post_label_t(attribute, :date, post: post) - = date_field_tag(*field_name_for('post', attribute, dt, :date), + = date_field_tag(*field_name_for(base, attribute, dt, :date), value: metadata.value.dig(dt.to_s, 'date'), **field_options(attribute, metadata, required: true)) .col .time.form-group - = label_tag "post_#{attribute}_#{dt}_time", + = label_tag "#{base}_#{attribute}_#{dt}_time", post_label_t(attribute, :time, post: post) - = time_field_tag(*field_name_for('post', attribute, dt, :time), + = time_field_tag(*field_name_for(base, attribute, dt, :time), value: metadata.value.dig(dt.to_s, 'time'), **field_options(attribute, metadata)) .col .zone.form-group - = label_tag "post_#{attribute}_#{dt}_zone", + = label_tag "#{base}_#{attribute}_#{dt}_zone", post_label_t(attribute, :zone, post: post) - = select_tag(plain_field_name_for('post', attribute, dt, :zone), + = select_tag(plain_field_name_for(base, attribute, dt, :zone), options_for_select(MetadataEvent::TIMEZONES, metadata.value.dig(dt.to_s, 'zone') || '00:00'), **field_options(attribute, metadata)) diff --git a/app/views/posts/attributes/_file.haml b/app/views/posts/attributes/_file.haml index ee46eaef..56adb239 100644 --- a/app/views/posts/attributes/_file.haml +++ b/app/views/posts/attributes/_file.haml @@ -1,6 +1,6 @@ .form-group - if metadata.uploaded? - = hidden_field_tag "post[#{attribute}][path]", metadata.value['path'] + = hidden_field_tag "#{base}[#{attribute}][path]", metadata.value['path'] - case metadata.static_file.blob.content_type - when %r{\Avideo/} @@ -15,23 +15,23 @@ = link_to t('posts.attribute_ro.file.download'), url_for(metadata.static_file) .custom-control.custom-switch - = check_box_tag "post[#{attribute}][path]", '', false, id: "post_#{attribute}_destroy", class: 'custom-control-input' - = label_tag "post_#{attribute}_destroy", t('posts.attributes.file.destroy'), class: 'custom-control-label' + = check_box_tag "#{base}[#{attribute}][path]", '', false, id: "#{base}_#{attribute}_destroy", class: 'custom-control-input' + = label_tag "#{base}_#{attribute}_destroy", t('posts.attributes.file.destroy'), class: 'custom-control-label' .custom-file - = file_field(*field_name_for('post', attribute, :path), + = file_field(*field_name_for(base, attribute, :path), **field_options(attribute, metadata), class: "custom-file-input #{invalid(post, attribute)}", data: { preview: "#{attribute}-preview" }) - = label_tag "post_#{attribute}_path", + = label_tag "#{base}_#{attribute}_path", post_label_t(attribute, :path, post: post), class: 'custom-file-label' = render 'posts/attribute_feedback', post: post, attribute: [attribute, :path], metadata: metadata .form-group - = label_tag "post_#{attribute}_description", + = label_tag "#{base}_#{attribute}_description", post_label_t(attribute, :description, post: post) - = text_field(*field_name_for('post', attribute, :description), + = text_field(*field_name_for(base, attribute, :description), value: metadata.value['description'], dir: dir, lang: locale, **field_options(attribute, metadata)) diff --git a/app/views/posts/attributes/_geo.haml b/app/views/posts/attributes/_geo.haml index b62a23c8..d048565e 100644 --- a/app/views/posts/attributes/_geo.haml +++ b/app/views/posts/attributes/_geo.haml @@ -1,9 +1,9 @@ .row{ data: { controller: 'geo' } } .col .form-group - = label_tag "post_#{attribute}_lat", + = label_tag "#{base}_#{attribute}_lat", post_label_t(attribute, :lat, post: post) - = text_field(*field_name_for('post', attribute, :lat), + = text_field(*field_name_for(base, attribute, :lat), value: metadata.value['lat'], **field_options(attribute, metadata), data: { target: 'geo.lat' }) @@ -11,9 +11,9 @@ post: post, attribute: [attribute, :lat], metadata: metadata .col .form-group - = label_tag "post_#{attribute}_lng", + = label_tag "#{base}_#{attribute}_lng", post_label_t(attribute, :lng, post: post) - = text_field(*field_name_for('post', attribute, :lng), + = text_field(*field_name_for(base, attribute, :lng), value: metadata.value['lng'], **field_options(attribute, metadata), data: { target: 'geo.lng' }) diff --git a/app/views/posts/attributes/_has_and_belongs_to_many.haml b/app/views/posts/attributes/_has_and_belongs_to_many.haml index 13439fa4..d39d124d 100644 --- a/app/views/posts/attributes/_has_and_belongs_to_many.haml +++ b/app/views/posts/attributes/_has_and_belongs_to_many.haml @@ -1,15 +1,15 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) .mapable{ dir: dir, lang: locale, data: { values: metadata.value.to_json, 'default-values': metadata.values.to_json, - name: "post[#{attribute}][]", list: id_for_datalist(attribute), + name: "#{base}[#{attribute}][]", list: id_for_datalist(attribute), remove: 'false', legend: post_label_t(attribute, post: post), button: t('posts.attributes.add'), described: id_for_help(attribute) } } - = text_field(*field_name_for('post', attribute, '[]'), + = text_field(*field_name_for(base, attribute, '[]'), value: metadata.value.join(', '), dir: dir, lang: locale, **field_options(attribute, metadata)) diff --git a/app/views/posts/attributes/_has_many.haml b/app/views/posts/attributes/_has_many.haml index 13439fa4..d39d124d 100644 --- a/app/views/posts/attributes/_has_many.haml +++ b/app/views/posts/attributes/_has_many.haml @@ -1,15 +1,15 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) .mapable{ dir: dir, lang: locale, data: { values: metadata.value.to_json, 'default-values': metadata.values.to_json, - name: "post[#{attribute}][]", list: id_for_datalist(attribute), + name: "#{base}[#{attribute}][]", list: id_for_datalist(attribute), remove: 'false', legend: post_label_t(attribute, post: post), button: t('posts.attributes.add'), described: id_for_help(attribute) } } - = text_field(*field_name_for('post', attribute, '[]'), + = text_field(*field_name_for(base, attribute, '[]'), value: metadata.value.join(', '), dir: dir, lang: locale, **field_options(attribute, metadata)) diff --git a/app/views/posts/attributes/_image.haml b/app/views/posts/attributes/_image.haml index 076d50de..06503700 100644 --- a/app/views/posts/attributes/_image.haml +++ b/app/views/posts/attributes/_image.haml @@ -6,10 +6,10 @@ id: "#{attribute}-preview" -# Mantener el valor si no enviamos ninguna imagen - = hidden_field_tag "post[#{attribute}][path]", metadata.value['path'] + = hidden_field_tag "#{base}[#{attribute}][path]", metadata.value['path'] .custom-control.custom-switch - = check_box_tag "post[#{attribute}][path]", '', false, id: "post_#{attribute}_destroy", class: 'custom-control-input' - = label_tag "post_#{attribute}_destroy", t('posts.attributes.image.destroy'), class: 'custom-control-label' + = check_box_tag "#{base}[#{attribute}][path]", '', false, id: "#{base}_#{attribute}_destroy", class: 'custom-control-input' + = label_tag "#{base}_#{attribute}_destroy", t('posts.attributes.image.destroy'), class: 'custom-control-label' - else = image_tag '', alt: metadata.value['description'], @@ -17,19 +17,19 @@ id: "#{attribute}-preview" .custom-file - = file_field(*field_name_for('post', attribute, :path), + = file_field(*field_name_for(base, attribute, :path), **field_options(attribute, metadata), class: "custom-file-input #{invalid(post, attribute)}", accept: 'image/*', data: { preview: "#{attribute}-preview" }) - = label_tag "post_#{attribute}_path", + = label_tag "#{base}_#{attribute}_path", post_label_t(attribute, :path, post: post), class: 'custom-file-label' = render 'posts/attribute_feedback', post: post, attribute: [attribute, :path], metadata: metadata .form-group - = label_tag "post_#{attribute}_description", + = label_tag "#{base}_#{attribute}_description", post_label_t(attribute, :description, post: post) - = text_field(*field_name_for('post', attribute, :description), + = text_field(*field_name_for(base, attribute, :description), value: metadata.value['description'], dir: dir, lang: locale, **field_options(attribute, metadata)) diff --git a/app/views/posts/attributes/_lang.haml b/app/views/posts/attributes/_lang.haml index b7484804..a5dfa5cb 100644 --- a/app/views/posts/attributes/_lang.haml +++ b/app/views/posts/attributes/_lang.haml @@ -1 +1 @@ -= hidden_field_tag 'post[lang]', post&.lang&.value += hidden_field_tag "#{base}[lang]", post&.lang&.value diff --git a/app/views/posts/attributes/_locales.haml b/app/views/posts/attributes/_locales.haml index e672f6cd..6a6f0633 100644 --- a/app/views/posts/attributes/_locales.haml +++ b/app/views/posts/attributes/_locales.haml @@ -13,18 +13,18 @@ - metadata.values[locale.to_sym].values.include? x .form-group - = label_tag "post_#{attribute}_#{locale}", locale_t + = label_tag "#{base}_#{attribute}_#{locale}", locale_t .mapable{ dir: t("locales.#{locale}.dir"), lang: locale, data: { values: values.to_json, 'default-values': metadata.values[locale.to_sym].to_json, - name: "post[#{attribute}][]", + name: "#{base}[#{attribute}][]", list: id_for_datalist(attribute, locale), button: t('posts.attributes.add'), remove: 'false', legend: locale_t, described: id_for_help(attribute, locale) } } - = text_field(*field_name_for('post', attribute, '[]'), + = text_field(*field_name_for(base, attribute, '[]'), value: values.join(', '), dir: t("locales.#{locale}.dir"), lang: locale, **field_options(attribute, metadata)) diff --git a/app/views/posts/attributes/_markdown.haml b/app/views/posts/attributes/_markdown.haml index 8c47fdd4..325beb5c 100644 --- a/app/views/posts/attributes/_markdown.haml +++ b/app/views/posts/attributes/_markdown.haml @@ -1,6 +1,6 @@ .form-group.markdown-content - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = text_area_tag "post[#{attribute}]", metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = text_area_tag "#{base}[#{attribute}]", metadata.value, dir: dir, lang: locale, **field_options(attribute, metadata, class: 'content') .editor.mt-1 diff --git a/app/views/posts/attributes/_markdown_content.haml b/app/views/posts/attributes/_markdown_content.haml index 80d2804f..8042009f 100644 --- a/app/views/posts/attributes/_markdown_content.haml +++ b/app/views/posts/attributes/_markdown_content.haml @@ -1,8 +1,8 @@ .form-group.markdown-content - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata - = text_area_tag "post[#{attribute}]", metadata.value, + = text_area_tag "#{base}[#{attribute}]", metadata.value, dir: dir, lang: locale, **field_options(attribute, metadata, class: 'content') .markdown-editor.mt-1 diff --git a/app/views/posts/attributes/_number.haml b/app/views/posts/attributes/_number.haml index ec2adb53..12d2f094 100644 --- a/app/views/posts/attributes/_number.haml +++ b/app/views/posts/attributes/_number.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = number_field 'post', attribute, value: metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = number_field base, attribute, value: metadata.value, **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/attributes/_permalink.haml b/app/views/posts/attributes/_permalink.haml index 8cbd92cc..aa033643 100644 --- a/app/views/posts/attributes/_permalink.haml +++ b/app/views/posts/attributes/_permalink.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = text_field 'post', attribute, value: metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = text_field base, attribute, value: metadata.value, dir: dir, lang: locale, **field_options(attribute, metadata) = render 'posts/attribute_feedback', diff --git a/app/views/posts/attributes/_predefined_array.haml b/app/views/posts/attributes/_predefined_array.haml index 1ece3a56..e341e6cd 100644 --- a/app/views/posts/attributes/_predefined_array.haml +++ b/app/views/posts/attributes/_predefined_array.haml @@ -1,14 +1,14 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) .mapable{ data: { values: metadata.value.to_json, 'default-values': metadata.values.to_json, - name: "post[#{attribute}][]", list: id_for_datalist(attribute), + name: "#{base}[#{attribute}][]", list: id_for_datalist(attribute), remove: 'false', legend: post_label_t(attribute, post: post), button: t('posts.attributes.add'), described: id_for_help(attribute) } } - = text_field(*field_name_for('post', attribute, '[]'), + = text_field(*field_name_for(base, attribute, '[]'), value: metadata.value.join(', '), dir: dir, lang: locale, **field_options(attribute, metadata)) diff --git a/app/views/posts/attributes/_related_posts.haml b/app/views/posts/attributes/_related_posts.haml index 13439fa4..d39d124d 100644 --- a/app/views/posts/attributes/_related_posts.haml +++ b/app/views/posts/attributes/_related_posts.haml @@ -1,15 +1,15 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) .mapable{ dir: dir, lang: locale, data: { values: metadata.value.to_json, 'default-values': metadata.values.to_json, - name: "post[#{attribute}][]", list: id_for_datalist(attribute), + name: "#{base}[#{attribute}][]", list: id_for_datalist(attribute), remove: 'false', legend: post_label_t(attribute, post: post), button: t('posts.attributes.add'), described: id_for_help(attribute) } } - = text_field(*field_name_for('post', attribute, '[]'), + = text_field(*field_name_for(base, attribute, '[]'), value: metadata.value.join(', '), dir: dir, lang: locale, **field_options(attribute, metadata)) diff --git a/app/views/posts/attributes/_slug.haml b/app/views/posts/attributes/_slug.haml index 8cbd92cc..aa033643 100644 --- a/app/views/posts/attributes/_slug.haml +++ b/app/views/posts/attributes/_slug.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = text_field 'post', attribute, value: metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = text_field base, attribute, value: metadata.value, dir: dir, lang: locale, **field_options(attribute, metadata) = render 'posts/attribute_feedback', diff --git a/app/views/posts/attributes/_string.haml b/app/views/posts/attributes/_string.haml index 8cbd92cc..aa033643 100644 --- a/app/views/posts/attributes/_string.haml +++ b/app/views/posts/attributes/_string.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = text_field 'post', attribute, value: metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = text_field base, attribute, value: metadata.value, dir: dir, lang: locale, **field_options(attribute, metadata) = render 'posts/attribute_feedback', diff --git a/app/views/posts/attributes/_tel.haml b/app/views/posts/attributes/_tel.haml index 40b7967b..680cd32a 100644 --- a/app/views/posts/attributes/_tel.haml +++ b/app/views/posts/attributes/_tel.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = telephone_field 'post', attribute, value: metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = telephone_field base, attribute, value: metadata.value, **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/attributes/_text.haml b/app/views/posts/attributes/_text.haml index f356bf8f..b4c1f4ba 100644 --- a/app/views/posts/attributes/_text.haml +++ b/app/views/posts/attributes/_text.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = text_area_tag "post[#{attribute}]", metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = text_area_tag "#{base}[#{attribute}]", metadata.value, dir: dir, lang: locale, **field_options(attribute, metadata) = render 'posts/attribute_feedback', diff --git a/app/views/posts/attributes/_url.haml b/app/views/posts/attributes/_url.haml index eff3f1d5..b5de3f4e 100644 --- a/app/views/posts/attributes/_url.haml +++ b/app/views/posts/attributes/_url.haml @@ -1,6 +1,6 @@ .form-group - = label_tag "post_#{attribute}", post_label_t(attribute, post: post) - = url_field 'post', attribute, value: metadata.value, + = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post) + = url_field base, attribute, value: metadata.value, **field_options(attribute, metadata) = render 'posts/attribute_feedback', post: post, attribute: attribute, metadata: metadata