diff --git a/app/assets/stylesheets/admin/budget_headings/form.scss b/app/assets/stylesheets/admin/budget_headings/form.scss new file mode 100644 index 000000000..430601bcc --- /dev/null +++ b/app/assets/stylesheets/admin/budget_headings/form.scss @@ -0,0 +1,3 @@ +.admin .budget-headings-form { + @include full-width-form; +} diff --git a/app/views/admin/budget_headings/_form.html.erb b/app/views/admin/budget_headings/_form.html.erb index 2ac0d2c66..f1424bb10 100644 --- a/app/views/admin/budget_headings/_form.html.erb +++ b/app/views/admin/budget_headings/_form.html.erb @@ -1,44 +1,40 @@ -<%= render "shared/globalize_locales", resource: heading %> - -<%= translatable_form_for heading, url: path do |f| %> +<%= translatable_form_for heading, url: path, html: { class: "budget-headings-form" } do |f| %> + <%= render "shared/globalize_locales", resource: heading %> <%= render "shared/errors", resource: heading %> -
- <%= f.translatable_fields do |translations_form| %> -
- <%= translations_form.text_field :name, maxlength: 50 %> -
+ <%= f.translatable_fields do |translations_form| %> +
+ <%= translations_form.text_field :name, maxlength: 50 %> +
+ <% end %> + +
+ <%= f.text_field :price, maxlength: 8 %> + + <% if heading.budget.approval_voting? %> + <%= f.number_field :max_ballot_lines, + hint: t("admin.budget_headings.form.max_ballot_lines_info") %> <% end %> + + <%= f.text_field :population, + maxlength: 8, + data: { toggle_focus: "population-info" }, + hint: t("admin.budget_headings.form.population_info") %> + + <%= f.text_field :latitude, maxlength: 22 %> + <%= f.text_field :longitude, maxlength: 22 %> +

+ <%= t("admin.budget_headings.form.coordinates_info") %> +

+ + <%= f.check_box :allow_custom_content %> +

+ <%= t("admin.budget_headings.form.content_blocks_info") %> +

-
-
- <%= f.text_field :price, maxlength: 8 %> - - <% if heading.budget.approval_voting? %> - <%= f.number_field :max_ballot_lines, - hint: t("admin.budget_headings.form.max_ballot_lines_info") %> - - <% end %> - - <%= f.text_field :population, - maxlength: 8, - data: { toggle_focus: "population-info" }, - hint: t("admin.budget_headings.form.population_info") %> - - <%= f.text_field :latitude, maxlength: 22 %> - <%= f.text_field :longitude, maxlength: 22 %> -

- <%= t("admin.budget_headings.form.coordinates_info") %> -

- - <%= f.check_box :allow_custom_content %> -

- <%= t("admin.budget_headings.form.content_blocks_info") %> -

- - <%= f.submit t("admin.budget_headings.form.#{action}"), class: "button success" %> -
+
+ <%= f.submit t("admin.budget_headings.form.#{action}"), class: "button hollow" %>
<% end %> diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml index a00013b70..af300c710 100644 --- a/config/locales/en/activerecord.yml +++ b/config/locales/en/activerecord.yml @@ -220,7 +220,7 @@ en: latitude: "Latitude (optional)" longitude: "Longitude (optional)" name: "Heading name" - price: "Amount" + price: "Money amount" population: "Population (optional)" max_ballot_lines: "Votes allowed" budget/heading/translation: diff --git a/config/locales/es/activerecord.yml b/config/locales/es/activerecord.yml index 35f62237e..6061fb128 100644 --- a/config/locales/es/activerecord.yml +++ b/config/locales/es/activerecord.yml @@ -220,7 +220,7 @@ es: latitude: "Latitud (opcional)" longitude: "Longitud (opcional)" name: "Nombre de la partida" - price: "Cantidad" + price: "Cantidad de dinero" population: "Población (opcional)" max_ballot_lines: "Votos permitidos" budget/heading/translation: diff --git a/spec/system/admin/budget_headings_spec.rb b/spec/system/admin/budget_headings_spec.rb index 710770ed5..ccf258706 100644 --- a/spec/system/admin/budget_headings_spec.rb +++ b/spec/system/admin/budget_headings_spec.rb @@ -88,7 +88,7 @@ describe "Admin budget headings", :admin do click_link "Create new heading" fill_in "Heading name", with: "All City" - fill_in "Amount", with: "1000" + fill_in "Money amount", with: "1000" fill_in "Population (optional)", with: "10000" check "Allow content block" @@ -115,7 +115,7 @@ describe "Admin budget headings", :admin do click_button "Create new heading" expect(page).not_to have_content "Heading created successfully!" - expect(page).to have_css(".is-invalid-label", text: "Amount") + expect(page).to have_css(".is-invalid-label", text: "Money amount") expect(page).to have_content "can't be blank" end @@ -134,7 +134,7 @@ describe "Admin budget headings", :admin do expect(page).to have_field "Votes allowed", with: 1 fill_in "Heading name", with: "All City" - fill_in "Amount", with: "1000" + fill_in "Money amount", with: "1000" fill_in "Votes allowed", with: 14 click_button "Create new heading" @@ -152,7 +152,7 @@ describe "Admin budget headings", :admin do within("#budget_heading_#{heading.id}") { click_link "Edit" } expect(page).to have_field "Heading name", with: heading.name - expect(page).to have_field "Amount", with: heading.price + expect(page).to have_field "Money amount", with: heading.price expect(page).to have_field "Population (optional)", with: heading.population expect(page).to have_field "Longitude (optional)", with: heading.longitude expect(page).to have_field "Latitude (optional)", with: heading.latitude @@ -204,14 +204,14 @@ describe "Admin budget headings", :admin do visit edit_admin_budget_group_heading_path(budget, group, heading) expect(page).to have_field "Heading name", with: "All City" - expect(page).to have_field "Amount", with: 1000 + expect(page).to have_field "Money amount", with: 1000 expect(page).to have_field "Population (optional)", with: 10000 expect(page).to have_field "Longitude (optional)", with: 20.50 expect(page).to have_field "Latitude (optional)", with: -10.50 expect(find_field("Allow content block")).to be_checked fill_in "Heading name", with: "Districts" - fill_in "Amount", with: "2000" + fill_in "Money amount", with: "2000" fill_in "Population (optional)", with: "20000" fill_in "Longitude (optional)", with: "-40.47" fill_in "Latitude (optional)", with: "25.25" @@ -222,7 +222,7 @@ describe "Admin budget headings", :admin do visit edit_admin_budget_group_heading_path(budget, group, heading) expect(page).to have_field "Heading name", with: "Districts" - expect(page).to have_field "Amount", with: 2000 + expect(page).to have_field "Money amount", with: 2000 expect(page).to have_field "Population (optional)", with: 20000 expect(page).to have_field "Longitude (optional)", with: -40.47 expect(page).to have_field "Latitude (optional)", with: 25.25 diff --git a/spec/system/budgets/ballots_spec.rb b/spec/system/budgets/ballots_spec.rb index 535192c8d..56678662a 100644 --- a/spec/system/budgets/ballots_spec.rb +++ b/spec/system/budgets/ballots_spec.rb @@ -637,7 +637,7 @@ describe "Ballots" do in_browser(:admin) do login_as admin_user visit edit_admin_budget_group_heading_path(budget, states, new_york) - fill_in "Amount", with: 10 + fill_in "Money amount", with: 10 click_button "Save heading" expect(page).to have_content "Heading updated successfully"