diff --git a/app/helpers/budget_headings_helper.rb b/app/helpers/budget_headings_helper.rb index 3fa1eac89..22eabfe11 100644 --- a/app/helpers/budget_headings_helper.rb +++ b/app/helpers/budget_headings_helper.rb @@ -6,4 +6,10 @@ module BudgetHeadingsHelper end end + def heading_link(assigned_heading = nil, budget = nil) + return nil unless assigned_heading && budget + heading_path = budget_investments_path(budget, heading_id: assigned_heading.try(:id)) + link_to(assigned_heading.name, heading_path) + end + end diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index c5d4d775d..dff2dd2e0 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -208,11 +208,11 @@ class Budget end def reason_for_not_being_ballotable_by(user, ballot) - return permission_problem(user) if permission_problem?(user) - return :not_selected unless selected? - return :no_ballots_allowed unless budget.balloting? - return :different_heading_assigned unless ballot.valid_heading?(heading) - return :not_enough_money_html if ballot.present? && !enough_money?(ballot) + return permission_problem(user) if permission_problem?(user) + return :not_selected unless selected? + return :no_ballots_allowed unless budget.balloting? + return :different_heading_assigned_html unless ballot.valid_heading?(heading) + return :not_enough_money_html if ballot.present? && !enough_money?(ballot) end def permission_problem(user) diff --git a/app/views/budgets/investments/_ballot.html.erb b/app/views/budgets/investments/_ballot.html.erb index 605caebc7..c12103a0a 100644 --- a/app/views/budgets/investments/_ballot.html.erb +++ b/app/views/budgets/investments/_ballot.html.erb @@ -42,17 +42,25 @@ <% if reason.present? && !ballot.has_investment?(investment) %> -