From 1f0ee32998018af7d3870fb6f4ca7c848ca485f4 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Thu, 22 Mar 2018 22:29:39 +0100 Subject: [PATCH] Add max headings label on Group list --- app/views/admin/budgets/_group.html.erb | 5 +++++ config/locales/en/admin.yml | 1 + config/locales/es/admin.yml | 1 + spec/features/admin/budget_groups_spec.rb | 3 +++ 4 files changed, 10 insertions(+) diff --git a/app/views/admin/budgets/_group.html.erb b/app/views/admin/budgets/_group.html.erb index 360fd75a7..f5922846e 100644 --- a/app/views/admin/budgets/_group.html.erb +++ b/app/views/admin/budgets/_group.html.erb @@ -1,8 +1,13 @@ +<% max_headings_label = t('admin.budgets.form.current_of_max_headings', current: group.max_votable_headings, max: group.headings.count ) %>
<%= content_tag(:span, group.name, class:"group-toggle-#{group.id}", id:"group-name-#{group.id}") %> + + <%= t("admin.budgets.form.max_votable_headings")%> + <%= max_headings_label %> + <%= render 'admin/budgets/group_form', budget: @budget, group: group, id: "group-form-#{group.id}", button_title: t("admin.budgets.form.submit"), css_class: "group-toggle-#{group.id}" %> <%= link_to t("admin.budgets.form.edit_group"), "#", class: "button float-right js-toggle-link hollow", data: { "toggle-selector" => ".group-toggle-#{group.id}" } %> <%= link_to t("admin.budgets.form.add_heading"), "#", class: "button float-right js-toggle-link", data: { "toggle-selector" => "#group-#{group.id}-new-heading-form" } %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 67273c327..aa2099f3d 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -121,6 +121,7 @@ en: table_population: Population population_info: "Budget Heading population field is used for Statistic purposes at the end of the Budget to show for each Heading that represents an area with population what percentage voted. The field is optional so you can leave it empty if it doesn't apply." max_votable_headings: "Maxium number of headings in which a user can vote" + current_of_max_headings: "%{current} of %{max}" winners: calculate: Calculate Winner Investments calculated: Winners being calculated, it may take a minute. diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 8e3c546f9..12000c207 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -121,6 +121,7 @@ es: table_population: Población population_info: "El campo población de las partidas presupuestarias se usa con fines estadísticos únicamente, con el objetivo de mostrar el porcentaje de votos habidos en cada partida que represente un área con población. Es un campo opcional, así que puedes dejarlo en blanco si no aplica." max_votable_headings: "Máximo número de partidas en que un usuario puede votar" + current_of_max_headings: "%{current} de %{max}" winners: calculate: Calcular propuestas ganadoras calculated: Calculando ganadoras, puede tardar un minuto. diff --git a/spec/features/admin/budget_groups_spec.rb b/spec/features/admin/budget_groups_spec.rb index 3c58a462e..664c4aeda 100644 --- a/spec/features/admin/budget_groups_spec.rb +++ b/spec/features/admin/budget_groups_spec.rb @@ -49,6 +49,8 @@ feature 'Admin can change the groups name' do scenario "Defaults to 1 heading per group", :js do visit admin_budget_path(group.budget) + expect(page).to have_content('Maxium number of headings in which a user can vote 1 of 3') + within("#budget_group_#{group.id}") do click_link 'Edit group' @@ -67,6 +69,7 @@ feature 'Admin can change the groups name' do end visit admin_budget_path(group.budget) + expect(page).to have_content('Maxium number of headings in which a user can vote 2 of 3') within("#budget_group_#{group.id}") do click_link 'Edit group'