merge budget helpers in a single file

This commit is contained in:
kikito
2016-12-06 20:08:37 +01:00
parent e6cbc4acf6
commit ad2d35bafa
2 changed files with 26 additions and 29 deletions

View File

@@ -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

View File

@@ -8,4 +8,29 @@ module BudgetsHelper
Budget::CURRENCY_SYMBOLS.map { |cs| [ cs, cs ] }
end
end
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