From ad2d35bafadaad8e19a1609129a74f847578967e Mon Sep 17 00:00:00 2001 From: kikito Date: Tue, 6 Dec 2016 20:08:37 +0100 Subject: [PATCH] merge budget helpers in a single file --- app/helpers/budget_helper.rb | 28 ---------------------------- app/helpers/budgets_helper.rb | 27 ++++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 29 deletions(-) delete mode 100644 app/helpers/budget_helper.rb diff --git a/app/helpers/budget_helper.rb b/app/helpers/budget_helper.rb deleted file mode 100644 index 881087acf..000000000 --- a/app/helpers/budget_helper.rb +++ /dev/null @@ -1,28 +0,0 @@ -module BudgetHelper - - def heading_name(heading) - heading.present? ? heading.name : t("budget.headings.none") - end - - def namespaced_budget_investment_path(investment, options={}) - case namespace - when "management::budgets" - management_budget_investment_path(investment, options) - else - budget_investment_path(investment, options.merge(budget_id: investment.budget_id)) - end - end - - def display_budget_countdown?(budget) - budget.balloting? - end - - def css_for_ballot_heading(heading) - return '' unless current_ballot.present? - current_ballot.has_lines_in_heading?(heading) ? 'active' : '' - end - - def current_ballot - Budget::Ballot.where(user: current_user, budget: @budget).first - end -end diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb index d281ef182..65f38d257 100644 --- a/app/helpers/budgets_helper.rb +++ b/app/helpers/budgets_helper.rb @@ -8,4 +8,29 @@ module BudgetsHelper Budget::CURRENCY_SYMBOLS.map { |cs| [ cs, cs ] } end -end \ No newline at end of file + def heading_name(heading) + heading.present? ? heading.name : t("budget.headings.none") + end + + def namespaced_budget_investment_path(investment, options={}) + case namespace + when "management::budgets" + management_budget_investment_path(investment.budget, investment, options) + else + budget_investment_path(investment.budget, investment, options.merge(budget_id: investment.budget_id)) + end + end + + def display_budget_countdown?(budget) + budget.balloting? + end + + def css_for_ballot_heading(heading) + return '' unless current_ballot.present? + current_ballot.has_lines_in_heading?(heading) ? 'active' : '' + end + + def current_ballot + Budget::Ballot.where(user: current_user, budget: @budget).first + end +end