Files
nairobi/app/views/budgets/executions/show.html.erb
Marko Lovic 8376efce3f Hide headings with no investments
The page should not show any headings which don't have any
winning investments. The "no content" message should only be
shown when there are no headings with investments to avoid an
otherwise blank page.

__Note:__ in the main @headings query, _both_ #includes and #joins
are needed to:
 1. eager load all necessary data (#includes)
and
 2. to perform an INNER JOIN on milestones to filter out investments
with no milestones (#joins).
2018-11-06 13:02:35 +01:00

74 lines
2.4 KiB
Plaintext

<% provide :title, t("budgets.executions.page_title", budget: @budget.name) %>
<% content_for :meta_description do %><%= @budget.description_for_phase('finished') %><% end %>
<% provide :social_media_meta_tags do %>
<%= render 'shared/social_media_meta_tags',
social_url: budget_executions_url(@budget),
social_title: @budget.name,
social_description: @budget.description_for_phase('finished') %>
<% end %>
<% content_for :canonical do %>
<%= render 'shared/canonical', href: budget_executions_url(@budget) %>
<% end %>
<div class="budgets-stats">
<div class="expanded no-margin-top padding header">
<div class="row">
<div class="small-12 column">
<%= back_link_to budgets_path %>
<h2 class="margin-top">
<%= t("budgets.executions.heading") %><br>
<span><%= @budget.name %></span>
</h2>
</div>
</div>
</div>
</div>
<div class="row margin-top">
<div class="small-12 column">
<ul class="tabs">
<li class="tabs-title">
<%= link_to t("budgets.results.link"), budget_results_path(@budget) %>
</li>
<li class="tabs-title is-active">
<%= link_to t("budgets.executions.link"), budget_executions_path(@budget), class: 'is-active' %>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="small-12 medium-3 large-2 column">
<h3 class="margin-bottom">
<%= t("budgets.executions.heading_selection_title") %>
</h3>
<ul class="menu vertical no-margin-top no-padding-top">
<% @headings.each do |heading| %>
<li>
<%= link_to heading.name, "#" + heading.name.parameterize %>
</li>
<% end %>
</ul>
</div>
<div class="small-12 medium-9 large-10 column">
<%= form_tag(budget_executions_path(@budget), method: :get) do %>
<div class="small-12 medium-3 column">
<%= label_tag t("budgets.executions.filters.label") %>
<%= select_tag :status, options_from_collection_for_select(
@statuses, :id, :name, params[:status]
), class: "js-submit-on-change", prompt: t("budgets.executions.filters.all") %>
</div>
<% end %>
<% if @headings.any? %>
<%= render 'budgets/executions/investments' %>
<% else %>
<div class="callout primary clear">
<%= t("budgets.executions.no_winner_investments") %>
</div>
<% end %>
</div>
</div>