Remove row and column divs in investment form

We don't need any row classes anymore because the <body> 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.
This commit is contained in:
Javi Martín
2021-07-07 02:51:14 +02:00
parent 9ebb0b660e
commit 355153813d
2 changed files with 102 additions and 95 deletions

View File

@@ -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;
}
}

View File

@@ -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 %>
<div class="row column">
<% unless budget.single_heading? %>
<div class="small-12 medium-8 column">
<%= f.select :heading_id, budget_heading_select_options(budget), { include_blank: true } %>
</div>
<% end %>
<% unless budget.single_heading? %>
<div class="small-12 medium-8">
<%= f.select :heading_id, budget_heading_select_options(budget), { include_blank: true } %>
</div>
<% end %>
<div class="row">
<div class="small-12 column">
<%= render "shared/globalize_locales", resource: investment %>
</div>
<div>
<%= render "shared/globalize_locales", resource: investment %>
</div>
<%= f.translatable_fields do |translations_form| %>
<div>
<%= translations_form.text_field :title,
maxlength: Budget::Investment.title_max_length,
data: suggest_data(investment) %>
</div>
<div class="js-suggest" data-locale="<%= translations_form.locale %>"></div>
<div>
<%= translations_form.text_area :description,
maxlength: Budget::Investment.description_max_length,
class: "html-area" %>
</div>
<% end %>
<%= f.invisible_captcha :subtitle %>
<% if feature?(:allow_images) %>
<div class="images">
<%= render "images/nested_image", imageable: investment, f: f %>
</div>
<% end %>
<% if feature?(:allow_attached_documents) %>
<div class="documents">
<%= render "documents/nested_documents", documentable: investment, f: f %>
</div>
<% end %>
<% if feature?(:map) %>
<div>
<%= 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" %>
</div>
<% end %>
<div>
<%= f.text_field :location %>
</div>
<div>
<%= f.text_field :organization_name %>
</div>
<div>
<%= f.label :tag_list, t("budgets.investments.form.tags_label") %>
<p class="help-text" id="tags-list-help-text"><%= t("budgets.investments.form.tags_instructions") %></p>
<div id="category_tags" class="tags">
<%= f.label :category_tag_list, t("budgets.investments.form.tag_category_label") %>
<% categories.each do |tag| %>
<a class="js-add-tag-link"><%= tag.name %></a>
<% end %>
</div>
<%= f.translatable_fields do |translations_form| %>
<div class="small-12 column">
<%= translations_form.text_field :title,
maxlength: Budget::Investment.title_max_length,
data: suggest_data(investment) %>
</div>
<div class="js-suggest" data-locale="<%= translations_form.locale %>"></div>
<br>
<%= 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 } %>
</div>
<div class="small-12 column">
<%= translations_form.text_area :description,
maxlength: Budget::Investment.description_max_length,
class: "html-area" %>
</div>
<% end %>
<%= render SDG::RelatedListSelectorComponent.new(f) %>
<%= f.invisible_captcha :subtitle %>
<% if feature?(:allow_images) %>
<div class="images small-12 column">
<%= render "images/nested_image", imageable: investment, f: f %>
</div>
<% end %>
<% if feature?(:allow_attached_documents) %>
<div class="documents small-12 column">
<%= render "documents/nested_documents", documentable: investment, f: f %>
</div>
<% end %>
<% if feature?(:map) %>
<div class="small-12 column">
<%= 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" %>
</div>
<% end %>
<div class="small-12 column">
<%= f.text_field :location %>
<% unless current_user.manager? %>
<div>
<%= 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")
) %>
</div>
<% end %>
<div class="small-12 column">
<%= f.text_field :organization_name %>
</div>
<div class="small-12 column">
<%= f.label :tag_list, t("budgets.investments.form.tags_label") %>
<p class="help-text" id="tags-list-help-text"><%= t("budgets.investments.form.tags_instructions") %></p>
<div id="category_tags" class="tags">
<%= f.label :category_tag_list, t("budgets.investments.form.tag_category_label") %>
<% categories.each do |tag| %>
<a class="js-add-tag-link"><%= tag.name %></a>
<% end %>
</div>
<br>
<%= 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 } %>
</div>
<%= render SDG::RelatedListSelectorComponent.new(f) %>
<% unless current_user.manager? %>
<div class="small-12 column">
<%= 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")
) %>
</div>
<% end %>
<div class="actions small-12 medium-6 large-4 end column">
<%= f.submit(nil, class: "button expanded") %>
</div>
<div class="actions small-12 medium-6 large-4">
<%= f.submit(nil, class: "button expanded") %>
</div>
<% end %>