Show message for headings without winner investments
This commit is contained in:
@@ -2,32 +2,38 @@
|
|||||||
<h4 id="<%= heading.name.parameterize %>">
|
<h4 id="<%= heading.name.parameterize %>">
|
||||||
<%= heading.name %>
|
<%= heading.name %>
|
||||||
</h4>
|
</h4>
|
||||||
<div class="row" data-equalizer-on="medium" data-equalizer>
|
<% if winner_investments(heading).any? %>
|
||||||
<% winner_investments(heading).each do |investment| %>
|
<div class="row" data-equalizer-on="medium" data-equalizer>
|
||||||
<div class="small-12 medium-6 large-4 column end margin-bottom">
|
<% winner_investments(heading).each do |investment| %>
|
||||||
<div class="budget-execution">
|
<div class="small-12 medium-6 large-4 column end margin-bottom">
|
||||||
<%= link_to budget_investment_path(@budget, investment, anchor: "tab-milestones"), data: { 'equalizer-watch': true } do %>
|
<div class="budget-execution">
|
||||||
<% investment.milestones.order(publication_date: :desc).limit(1).each do |milestone| %>
|
<%= link_to budget_investment_path(@budget, investment, anchor: "tab-milestones"), data: { 'equalizer-watch': true } do %>
|
||||||
<% if milestone.image.present? %>
|
<% investment.milestones.order(publication_date: :desc).limit(1).each do |milestone| %>
|
||||||
<%= image_tag milestone.image_url(:large), alt: milestone.image.title %>
|
<% if milestone.image.present? %>
|
||||||
<% elsif investment.image.present? %>
|
<%= image_tag milestone.image_url(:large), alt: milestone.image.title %>
|
||||||
<%= image_tag investment.image_url(:thumb), alt: investment.image.title %>
|
<% elsif investment.image.present? %>
|
||||||
<% else %>
|
<%= image_tag investment.image_url(:thumb), alt: investment.image.title %>
|
||||||
<%= image_tag Rails.root.join('/budget_execution_no_image.jpg'), alt: investment.title %>
|
<% else %>
|
||||||
|
<%= image_tag Rails.root.join('/budget_execution_no_image.jpg'), alt: investment.title %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<div class="budget-execution-info">
|
||||||
<div class="budget-execution-info">
|
<div class="budget-execution-content">
|
||||||
<div class="budget-execution-content">
|
<h5><%= investment.title %></h5>
|
||||||
<h5><%= investment.title %></h5>
|
<span class="author"><%= investment.author.name %></span>
|
||||||
<span class="author"><%= investment.author.name %></span>
|
</div>
|
||||||
|
<p class="price margin-top text-center">
|
||||||
|
<strong><%= investment.formatted_price %></strong>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="price margin-top text-center">
|
<% end %>
|
||||||
<strong><%= investment.formatted_price %></strong>
|
</div>
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<% end %>
|
||||||
<% end %>
|
</div>
|
||||||
</div>
|
<% else %>
|
||||||
|
<div class="callout primary clear">
|
||||||
|
<%= t("budgets.executions.no_winner_investments") %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ en:
|
|||||||
page_title: "%{budget} - Milestones"
|
page_title: "%{budget} - Milestones"
|
||||||
heading: "Participatory budget Milestones"
|
heading: "Participatory budget Milestones"
|
||||||
heading_selection_title: "By district"
|
heading_selection_title: "By district"
|
||||||
|
no_winner_investments: "No winner investments for this heading"
|
||||||
filters:
|
filters:
|
||||||
label: "Project's current state"
|
label: "Project's current state"
|
||||||
all: "All"
|
all: "All"
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ es:
|
|||||||
page_title: "%{budget} - Seguimiento de proyectos"
|
page_title: "%{budget} - Seguimiento de proyectos"
|
||||||
heading: "Seguimiento de proyectos"
|
heading: "Seguimiento de proyectos"
|
||||||
heading_selection_title: "Ámbito de actuación"
|
heading_selection_title: "Ámbito de actuación"
|
||||||
|
no_winner_investments: "No hay proyectos de gasto ganadores para esta partida"
|
||||||
filters:
|
filters:
|
||||||
label: "Estado actual del proyecto"
|
label: "Estado actual del proyecto"
|
||||||
all: "Todos"
|
all: "Todos"
|
||||||
|
|||||||
@@ -27,6 +27,23 @@ feature 'Executions' do
|
|||||||
expect(page).not_to have_content(investment4.title)
|
expect(page).not_to have_content(investment4.title)
|
||||||
end
|
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
|
context 'Images' do
|
||||||
scenario 'renders milestone image if available' do
|
scenario 'renders milestone image if available' do
|
||||||
milestone1 = create(:budget_investment_milestone, investment: investment1)
|
milestone1 = create(:budget_investment_milestone, investment: investment1)
|
||||||
|
|||||||
Reference in New Issue
Block a user