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).
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
<% @headings.each do |heading| %>
|
||||
<h4 id="<%= heading.name.parameterize %>">
|
||||
<%= heading.name %>
|
||||
</h4>
|
||||
<% if winner_investments(heading).any? %>
|
||||
<h4 id="<%= heading.name.parameterize %>">
|
||||
<%= heading.name %>
|
||||
</h4>
|
||||
<div class="row" data-equalizer-on="medium" data-equalizer>
|
||||
<% winner_investments(heading).each do |investment| %>
|
||||
<% heading.investments.each do |investment| %>
|
||||
<div class="small-12 medium-6 large-4 column end margin-bottom">
|
||||
<div class="budget-execution">
|
||||
<%= link_to budget_investment_path(@budget, investment, anchor: "tab-milestones"), data: { 'equalizer-watch': true } do %>
|
||||
@@ -31,9 +30,4 @@
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="callout primary clear">
|
||||
<%= t("budgets.executions.no_winner_investments") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -62,6 +62,12 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render 'budgets/executions/investments' %>
|
||||
<% if @headings.any? %>
|
||||
<%= render 'budgets/executions/investments' %>
|
||||
<% else %>
|
||||
<div class="callout primary clear">
|
||||
<%= t("budgets.executions.no_winner_investments") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user