\ No newline at end of file
diff --git a/app/views/admin/budgets/_groups.html.erb b/app/views/admin/budgets/_groups.html.erb
new file mode 100644
index 000000000..ba785ee0c
--- /dev/null
+++ b/app/views/admin/budgets/_groups.html.erb
@@ -0,0 +1,34 @@
+
\ No newline at end of file
diff --git a/app/views/admin/budgets/new.html.erb b/app/views/admin/budgets/new.html.erb
index 019ca460f..9ca0f34a5 100644
--- a/app/views/admin/budgets/new.html.erb
+++ b/app/views/admin/budgets/new.html.erb
@@ -23,7 +23,7 @@
<%= f.select :currency_symbol, budget_currency_symbol_select_options, {label: false} %>
- " class="button success">
+ <%= f.submit t("admin.budgets.new.create"), class: "button success" %>
<% end %>
\ No newline at end of file
diff --git a/app/views/admin/budgets/show.html.erb b/app/views/admin/budgets/show.html.erb
index 20185b2ba..847aa2f60 100644
--- a/app/views/admin/budgets/show.html.erb
+++ b/app/views/admin/budgets/show.html.erb
@@ -9,4 +9,8 @@
<%= t('admin.budgets.show.currency') %>: <%= @budget.currency_symbol %>
+
+
+
+ <%= render "groups", groups: @budget.groups %>
\ No newline at end of file
diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml
index 812e1a45c..d8154efc1 100755
--- a/config/locales/admin.en.yml
+++ b/config/locales/admin.en.yml
@@ -74,7 +74,13 @@ en:
description: Description
phase: Phase
currency: Currency
+ show:
+ phase: Current phase
+ currency: Currency
+ groups: Groups of budget headings
+ form:
group: Group's name
+ no_groups: No groups created yet. Each user will be able to vote in only one heading per group.
add_group: Add new group
create_group: Create group
heading: Heading's name
@@ -87,9 +93,6 @@ en:
table_heading: Heading
table_amount: Amount
table_geozone: Scope of operation
- show:
- phase: Current phase
- currency: Currency
comments:
index:
filter: Filter
diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml
index 1afc01ef2..1d4ead16b 100644
--- a/config/locales/admin.es.yml
+++ b/config/locales/admin.es.yml
@@ -74,7 +74,13 @@ es:
description: Descripción
phase: Fase
currency: Divisa
+ show:
+ phase: Fase actual
+ currency: Divisa
+ groups: Grupos de partidas presupuestarias
+ form:
group: Nombre del grupo
+ no_groups: No hay grupos creados todavía. Cada usuario podrá votar en una sola partida de cada grupo.
add_group: Añadir nuevo grupo
create_group: Crear grupo
heading: Nombre de la partida
@@ -87,9 +93,6 @@ es:
table_heading: Partida
table_amount: Cantidad
table_geozone: Ámbito de actuación
- show:
- phase: Fase actual
- currency: Divisa
comments:
index:
filter: Filtro
diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb
index f38d2c9f5..123ca43e8 100644
--- a/spec/features/admin/budgets_spec.rb
+++ b/spec/features/admin/budgets_spec.rb
@@ -101,4 +101,58 @@ feature 'Admin budgets' do
end
end
+
+ context 'Manage groups and headings' do
+
+ scenario 'Create group', :js do
+ create(:budget, name: 'Yearly participatory budget')
+
+ visit admin_budgets_path
+ click_link 'Yearly participatory budget'
+
+ expect(page).to have_content 'No groups created yet.'
+
+ click_link 'Add new group'
+
+ fill_in 'budget_group_name', with: 'General improvments'
+ click_button 'Create group'
+
+ expect(page).to have_content 'Yearly participatory budget'
+ expect(page).to_not have_content 'No groups created yet.'
+
+ visit admin_budgets_path
+ click_link 'Yearly participatory budget'
+
+ expect(page).to have_content 'Yearly participatory budget'
+ expect(page).to_not have_content 'No groups created yet.'
+ end
+
+ scenario 'Create heading', :js do
+ budget = create(:budget, name: 'Yearly participatory budget')
+ group = create(:budget_group, budget: budget, name: 'Districts improvments')
+
+ visit admin_budget_path(budget)
+
+ within("#budget_group_#{group.id}") do
+ expect(page).to have_content 'This group has no assigned heading.'
+ click_link 'Add heading'
+
+ fill_in 'budget_heading_name', with: 'District 9 reconstruction'
+ fill_in 'budget_heading_price', with: '6785'
+ click_button 'Save heading'
+ end
+
+ expect(page).to_not have_content 'This group has no assigned heading.'
+
+ visit admin_budget_path(budget)
+ within("#budget_group_#{group.id}") do
+ expect(page).to_not have_content 'This group has no assigned heading.'
+
+ expect(page).to have_content 'District 9 reconstruction'
+ expect(page).to have_content '6785'
+ expect(page).to have_content 'All city'
+ end
+ end
+
+ end
end
\ No newline at end of file