Show message for headings without winner investments

This commit is contained in:
Angel Perez
2018-07-11 12:39:34 -04:00
committed by Javi Martín
parent 5114792941
commit 62b99f01bc
4 changed files with 50 additions and 25 deletions

View File

@@ -2,6 +2,7 @@
<h4 id="<%= heading.name.parameterize %>">
<%= heading.name %>
</h4>
<% if winner_investments(heading).any? %>
<div class="row" data-equalizer-on="medium" data-equalizer>
<% winner_investments(heading).each do |investment| %>
<div class="small-12 medium-6 large-4 column end margin-bottom">
@@ -30,4 +31,9 @@
</div>
<% end %>
</div>
<% else %>
<div class="callout primary clear">
<%= t("budgets.executions.no_winner_investments") %>
</div>
<% end %>
<% end %>

View File

@@ -179,6 +179,7 @@ en:
page_title: "%{budget} - Milestones"
heading: "Participatory budget Milestones"
heading_selection_title: "By district"
no_winner_investments: "No winner investments for this heading"
filters:
label: "Project's current state"
all: "All"

View File

@@ -179,6 +179,7 @@ es:
page_title: "%{budget} - Seguimiento de proyectos"
heading: "Seguimiento de proyectos"
heading_selection_title: "Ámbito de actuación"
no_winner_investments: "No hay proyectos de gasto ganadores para esta partida"
filters:
label: "Estado actual del proyecto"
all: "Todos"

View File

@@ -27,6 +27,23 @@ feature 'Executions' do
expect(page).not_to have_content(investment4.title)
end
scenario 'render a message for headings without winner investments' do
empty_group = create(:budget_group, budget: budget)
empty_heading = create(:budget_heading, group: empty_group, price: 1000)
visit budget_path(budget)
click_link 'See results'
expect(page).to have_content(heading.name)
expect(page).to have_content(empty_heading.name)
click_link 'Milestones'
click_link "#{empty_heading.name}"
expect(page).to have_content('No winner investments for this heading')
end
context 'Images' do
scenario 'renders milestone image if available' do
milestone1 = create(:budget_investment_milestone, investment: investment1)