<%= t('budgets.show.phase') %>
-
- <%= t("budgets.phase.#{@budget.phase}") %>
+
<%= t("budgets.phase.#{@budget.phase}") %>
<% if @budget.accepting? %>
<% if current_user %>
@@ -38,6 +37,9 @@
+ <% if params[:unfeasible] %>
+
<%= t("budgets.show.unfeasible_title") %>
+ <% end %>
| <%= t('budgets.show.group') %> |
@@ -48,10 +50,14 @@
<% if group.headings.count == 1 %>
<%= link_to group.name,
- budget_investments_path(@budget, heading_id: group.headings.first.id),
+ budget_investments_path(@budget,
+ heading_id: group.headings.first.id,
+ unfeasible: params[:unfeasible]),
data: { no_turbolink: true } %>
<% else %>
- <%= link_to group.name, budget_group_path(@budget, group) %>
+ <%= link_to group.name,
+ budget_group_path(@budget, group,
+ unfeasible: params[:unfeasible]) %>
<% end %>
|
@@ -61,3 +67,12 @@
+
+<% unless params[:unfeasible] %>
+
+
+ <%= link_to t("budgets.show.unfeasible"),
+ budget_path(@budget, unfeasible: 1) %>
+
+
+<% end %>
diff --git a/config/locales/budgets.en.yml b/config/locales/budgets.en.yml
index 9b57f6b22..5e4861a16 100644
--- a/config/locales/budgets.en.yml
+++ b/config/locales/budgets.en.yml
@@ -22,6 +22,8 @@ en:
groups:
show:
title: Select an option
+ unfeasible_title: Unfeasible investments
+ unfeasible: See unfeasible investments
phase:
accepting: Accepting proposals
reviewing: Reviewing proposals
@@ -103,3 +105,5 @@ en:
show:
group: Group
phase: Actual phase
+ unfeasible_title: Unfeasible investments
+ unfeasible: See unfeasible investments
\ No newline at end of file
diff --git a/config/locales/budgets.es.yml b/config/locales/budgets.es.yml
index 93c7a15aa..08a33bde8 100644
--- a/config/locales/budgets.es.yml
+++ b/config/locales/budgets.es.yml
@@ -22,6 +22,8 @@ es:
groups:
show:
title: Selecciona una opción
+ unfeasible_title: Propuestas inviables
+ unfeasible: Ver propuestas inviables
phase:
accepting: Aceptando propuestas
reviewing: Revisando propuestas
@@ -103,3 +105,5 @@ es:
show:
group: Grupo
phase: Fase actual
+ unfeasible_title: Propuestas inviables
+ unfeasible: Ver las propuestas inviables
diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb
index 21238c554..a6feb6f44 100644
--- a/spec/features/budgets/investments_spec.rb
+++ b/spec/features/budgets/investments_spec.rb
@@ -23,21 +23,6 @@ feature 'Budget Investments' do
end
end
- scenario 'Feasibility links' do
- visit budget_investments_path(budget, heading_id: heading.id)
- expect(page).to_not have_content('Feasible projects')
-
- within('#sidebar') do
- click_link 'Unfeasible projects'
- end
- expect(page).to have_current_path(budget_investments_path(budget, heading_id: heading.id, unfeasible: 1))
-
- within('#sidebar') do
- click_link 'Feasible projects'
- end
- expect(page).to have_current_path(budget_investments_path(budget, heading_id: heading.id, unfeasible: nil))
- end
-
context("Search") do
scenario 'Search by text' do
@@ -82,6 +67,35 @@ feature 'Budget Investments' do
expect(page).to_not have_content(investment4.title)
end
end
+
+ scenario "by unfeasibilty link for group with one heading" do
+ group = create(:budget_group, name: 'All City', budget: budget)
+ heading = create(:budget_heading, name: "Madrid", group: group)
+
+ visit budget_path(budget)
+ click_link 'See unfeasible investments'
+
+ click_link "All City"
+
+ expected_path = budget_investments_path(budget, heading_id: heading.id, unfeasible: 1)
+ expect(page).to have_current_path(expected_path)
+ end
+
+ scenario "by unfeasibilty link for group with many headings" do
+ group = create(:budget_group, name: 'Districts', budget: budget)
+ heading1 = create(:budget_heading, name: 'Carabanchel', group: group)
+ heading2 = create(:budget_heading, name: 'Barajas', group: group)
+
+ visit budget_path(budget)
+
+ click_link 'See unfeasible investments'
+
+ click_link 'Districts'
+ click_link 'Carabanchel'
+
+ expected_path = budget_investments_path(budget, heading_id: heading1.id, unfeasible: 1)
+ expect(page).to have_current_path(expected_path)
+ end
end
context("Orders") do