Extract methods to get investments in a ballot
This commit is contained in:
@@ -36,9 +36,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<ul class="ballot-list">
|
<ul class="ballot-list">
|
||||||
<%= render Budgets::Ballot::InvestmentComponent.with_collection(
|
<%= render Budgets::Ballot::InvestmentComponent.with_collection(group_investments(group)) %>
|
||||||
ballot.investments.by_group(group.id)
|
|
||||||
) %>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,4 +26,8 @@ class Budgets::Ballot::BallotComponent < ApplicationComponent
|
|||||||
budget_investments_path(budget, heading_id: group.headings.first)
|
budget_investments_path(budget, heading_id: group.headings.first)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def group_investments(group)
|
||||||
|
ballot.investments.by_group(group.id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<%= t("budgets.investments.index.sidebar.my_ballot") %>
|
<%= t("budgets.investments.index.sidebar.my_ballot") %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<% if ballot.investments.by_heading(heading.id).count > 0 %>
|
<% if investments.count > 0 %>
|
||||||
<p>
|
<p>
|
||||||
<em><%= sanitize(ballot.voted_info(heading)) %></em>
|
<em><%= sanitize(ballot.voted_info(heading)) %></em>
|
||||||
</p>
|
</p>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<ul class="ballot-list">
|
<ul class="ballot-list">
|
||||||
<% if heading %>
|
<% if heading %>
|
||||||
<%= render Budgets::Ballot::InvestmentForSidebarComponent.with_collection(
|
<%= render Budgets::Ballot::InvestmentForSidebarComponent.with_collection(
|
||||||
ballot.investments.by_heading(heading.id),
|
investments,
|
||||||
investment_ids: investment_ids
|
investment_ids: investment_ids
|
||||||
) %>
|
) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -18,4 +18,8 @@ class Budgets::Investments::MyBallotComponent < ApplicationComponent
|
|||||||
def budget
|
def budget
|
||||||
ballot.budget
|
ballot.budget
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def investments
|
||||||
|
ballot.investments.by_heading(heading.id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user