Move investments executions view to a component
Note that we're changing the component so it uses `polymorphic_path`; that way we don't have to pass the `@budget` variable to the component. We could also use `budget_investment_path investment.budget, investment` instead.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<% @investments_by_heading.each do |heading, investments| %>
|
<% investments_by_heading.each do |heading, investments| %>
|
||||||
<h4 id="<%= heading.name.parameterize %>">
|
<h4 id="<%= heading.name.parameterize %>">
|
||||||
<%= heading.name %> (<%= investments.count %>)
|
<%= heading.name %> (<%= investments.count %>)
|
||||||
</h4>
|
</h4>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="budget-execution-content">
|
<div class="budget-execution-content">
|
||||||
<h5>
|
<h5>
|
||||||
<%= link_to investment.title,
|
<%= link_to investment.title,
|
||||||
budget_investment_path(@budget, investment, anchor: "tab-milestones") %>
|
polymorphic_path(investment, anchor: "tab-milestones") %>
|
||||||
</h5>
|
</h5>
|
||||||
<span class="author"><%= investment.author.name %></span>
|
<span class="author"><%= investment.author.name %></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class Budgets::Executions::InvestmentsComponent < ApplicationComponent
|
||||||
|
attr_reader :investments_by_heading
|
||||||
|
|
||||||
|
def initialize(investments_by_heading)
|
||||||
|
@investments_by_heading = investments_by_heading
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<%= render Budgets::Executions::FiltersComponent.new(@budget, @statuses) %>
|
<%= render Budgets::Executions::FiltersComponent.new(@budget, @statuses) %>
|
||||||
|
|
||||||
<% if @investments_by_heading.any? %>
|
<% if @investments_by_heading.any? %>
|
||||||
<%= render "budgets/executions/investments" %>
|
<%= render Budgets::Executions::InvestmentsComponent.new(@investments_by_heading) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="callout primary clear">
|
<div class="callout primary clear">
|
||||||
<%= t("budgets.executions.no_winner_investments") %>
|
<%= t("budgets.executions.no_winner_investments") %>
|
||||||
|
|||||||
Reference in New Issue
Block a user