Go to investments list from a single heading group
There's no real point in linking to a page offering users to choose a heading when there's only one heading to choose. So we're linking to the investments index instead.
This commit is contained in:
@@ -23,8 +23,7 @@
|
||||
<h3>
|
||||
<%= group.name %> - <%= heading.name %>
|
||||
</h3>
|
||||
<%= link_to sanitize(ballot.amount_available_info(heading)),
|
||||
budget_group_path(budget, group) %>
|
||||
<%= link_to sanitize(ballot.amount_available_info(heading)), group_path(group) %>
|
||||
</div>
|
||||
<% if ballot.has_lines_in_group?(group) %>
|
||||
<h4 class="amount-spent text-right">
|
||||
@@ -52,7 +51,7 @@
|
||||
<h3>
|
||||
<%= group.name %>
|
||||
</h3>
|
||||
<%= link_to t("budgets.ballots.show.no_balloted_group_yet"), budget_group_path(budget, group) %>
|
||||
<%= link_to t("budgets.ballots.show.no_balloted_group_yet"), group_path(group) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,4 +18,12 @@ class Budgets::Ballot::BallotComponent < ApplicationComponent
|
||||
def no_balloted_groups
|
||||
budget.groups.sort_by_name - ballot.groups
|
||||
end
|
||||
|
||||
def group_path(group)
|
||||
if group.multiple_headings?
|
||||
budget_group_path(budget, group)
|
||||
else
|
||||
budget_investments_path(budget, heading_id: group.headings.first)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user