From 355153813d360951f4da90d352ca61e9504f7395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 7 Jul 2021 02:51:14 +0200 Subject: [PATCH] Remove row and column divs in investment form We don't need any row classes anymore because the already has a maximum width. As for columns, we only have one column in this form, so we don't need them either. Besides, the form's parent element already has a padding. Although most CONSUL installation don't enable the translation interface, we're adding some code to take this case into account. --- .../stylesheets/budgets/investments/form.scss | 13 ++ .../investments/form_component.html.erb | 184 +++++++++--------- 2 files changed, 102 insertions(+), 95 deletions(-) create mode 100644 app/assets/stylesheets/budgets/investments/form.scss diff --git a/app/assets/stylesheets/budgets/investments/form.scss b/app/assets/stylesheets/budgets/investments/form.scss new file mode 100644 index 000000000..22c5a3a65 --- /dev/null +++ b/app/assets/stylesheets/budgets/investments/form.scss @@ -0,0 +1,13 @@ +.budget-investment-form { + + .globalize-languages, + .translatable-fields { + @include grid-row-nest; + @include grid-column-gutter; + } + + .sdg-related-list-selector { + padding-left: 0; + padding-right: 0; + } +} diff --git a/app/components/budgets/investments/form_component.html.erb b/app/components/budgets/investments/form_component.html.erb index e54fb9edc..e76e567c5 100644 --- a/app/components/budgets/investments/form_component.html.erb +++ b/app/components/budgets/investments/form_component.html.erb @@ -1,107 +1,101 @@ -<%= translatable_form_for(investment, url: url) do |f| %> +<%= translatable_form_for(investment, url: url, html: { class: "budget-investment-form" }) do |f| %> <%= render "shared/errors", resource: investment %> -
- <% unless budget.single_heading? %> -
- <%= f.select :heading_id, budget_heading_select_options(budget), { include_blank: true } %> -
- <% end %> + <% unless budget.single_heading? %> +
+ <%= f.select :heading_id, budget_heading_select_options(budget), { include_blank: true } %> +
+ <% end %> -
-
- <%= render "shared/globalize_locales", resource: investment %> -
+
+ <%= render "shared/globalize_locales", resource: investment %> +
+ + <%= f.translatable_fields do |translations_form| %> +
+ <%= translations_form.text_field :title, + maxlength: Budget::Investment.title_max_length, + data: suggest_data(investment) %> +
+
+ +
+ <%= translations_form.text_area :description, + maxlength: Budget::Investment.description_max_length, + class: "html-area" %> +
+ <% end %> + + <%= f.invisible_captcha :subtitle %> + + <% if feature?(:allow_images) %> +
+ <%= render "images/nested_image", imageable: investment, f: f %> +
+ <% end %> + + <% if feature?(:allow_attached_documents) %> +
+ <%= render "documents/nested_documents", documentable: investment, f: f %> +
+ <% end %> + + <% if feature?(:map) %> +
+ <%= render "map_locations/form_fields", + form: f, + map_location: investment.map_location || MapLocation.new, + label: t("budgets.investments.form.map_location"), + help: t("budgets.investments.form.map_location_instructions"), + remove_marker_label: t("budgets.investments.form.map_remove_marker"), + parent_class: "budget_investment", + i18n_namespace: "budgets.investments" %> +
+ <% end %> + +
+ <%= f.text_field :location %> +
+ +
+ <%= f.text_field :organization_name %> +
+ +
+ <%= f.label :tag_list, t("budgets.investments.form.tags_label") %> +

<%= t("budgets.investments.form.tags_instructions") %>

+ +
+ <%= f.label :category_tag_list, t("budgets.investments.form.tag_category_label") %> + <% categories.each do |tag| %> + <%= tag.name %> + <% end %>
- <%= f.translatable_fields do |translations_form| %> -
- <%= translations_form.text_field :title, - maxlength: Budget::Investment.title_max_length, - data: suggest_data(investment) %> -
-
+
+ <%= f.text_field :tag_list, value: investment.tag_list.to_s, + label: false, + placeholder: t("budgets.investments.form.tags_placeholder"), + aria: { describedby: "tags-list-help-text" }, + class: "js-tag-list tag-autocomplete", + data: { js_url: suggest_tags_path } %> +
-
- <%= translations_form.text_area :description, - maxlength: Budget::Investment.description_max_length, - class: "html-area" %> -
- <% end %> + <%= render SDG::RelatedListSelectorComponent.new(f) %> - <%= f.invisible_captcha :subtitle %> - - <% if feature?(:allow_images) %> -
- <%= render "images/nested_image", imageable: investment, f: f %> -
- <% end %> - - <% if feature?(:allow_attached_documents) %> -
- <%= render "documents/nested_documents", documentable: investment, f: f %> -
- <% end %> - - <% if feature?(:map) %> -
- <%= render "map_locations/form_fields", - form: f, - map_location: investment.map_location || MapLocation.new, - label: t("budgets.investments.form.map_location"), - help: t("budgets.investments.form.map_location_instructions"), - remove_marker_label: t("budgets.investments.form.map_remove_marker"), - parent_class: "budget_investment", - i18n_namespace: "budgets.investments" %> -
- <% end %> - -
- <%= f.text_field :location %> + <% unless current_user.manager? %> +
+ <%= f.check_box :terms_of_service, + title: t("form.accept_terms_title"), + label: t("form.accept_terms", + policy: link_to(t("form.policy"), "/privacy", target: "blank"), + conditions: link_to(t("form.conditions"), "/conditions", target: "blank") + ) %>
+ <% end %> -
- <%= f.text_field :organization_name %> -
- -
- <%= f.label :tag_list, t("budgets.investments.form.tags_label") %> -

<%= t("budgets.investments.form.tags_instructions") %>

- -
- <%= f.label :category_tag_list, t("budgets.investments.form.tag_category_label") %> - <% categories.each do |tag| %> - <%= tag.name %> - <% end %> -
- -
- <%= f.text_field :tag_list, value: investment.tag_list.to_s, - label: false, - placeholder: t("budgets.investments.form.tags_placeholder"), - aria: { describedby: "tags-list-help-text" }, - class: "js-tag-list tag-autocomplete", - data: { js_url: suggest_tags_path } %> -
- - <%= render SDG::RelatedListSelectorComponent.new(f) %> - - <% unless current_user.manager? %> - -
- <%= f.check_box :terms_of_service, - title: t("form.accept_terms_title"), - label: t("form.accept_terms", - policy: link_to(t("form.policy"), "/privacy", target: "blank"), - conditions: link_to(t("form.conditions"), "/conditions", target: "blank") - ) %> -
- - <% end %> - -
- <%= f.submit(nil, class: "button expanded") %> -
+
+ <%= f.submit(nil, class: "button expanded") %>
<% end %>