Add max headings label on Group list

This commit is contained in:
Bertocq
2018-03-22 22:29:39 +01:00
committed by Raúl Fuentes
parent 3e4d095e6f
commit 1f0ee32998
4 changed files with 10 additions and 0 deletions

View File

@@ -1,8 +1,13 @@
<% max_headings_label = t('admin.budgets.form.current_of_max_headings', current: group.max_votable_headings, max: group.headings.count ) %>
<table>
<thead>
<tr>
<th colspan="4" class="with-button">
<%= content_tag(:span, group.name, class:"group-toggle-#{group.id}", id:"group-name-#{group.id}") %>
<span class="max_headings_label" style="margin-left: 10px; font-size: 0.9em; color: gray;">
<%= t("admin.budgets.form.max_votable_headings")%>
<strong style="font-weight: bold; color: black;"><%= max_headings_label %></strong>
</span>
<%= 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" } %>

View File

@@ -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.

View File

@@ -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.

View File

@@ -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'