Files
grecia/app/helpers/budgets_helper.rb
Juanjo Bazán 8bd74d2a20 fixes specs
namespace method defined in AdminHelper now returns
X/Y instead of X::Y
2017-01-24 13:07:49 +01:00

42 lines
1.1 KiB
Ruby

module BudgetsHelper
def budget_phases_select_options
Budget::PHASES.map { |ph| [ t("budgets.phase.#{ph}"), ph ] }
end
def budget_currency_symbol_select_options
Budget::CURRENCY_SYMBOLS.map { |cs| [ cs, cs ] }
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)
end
end
def namespaced_budget_investment_vote_path(investment, options={})
case namespace
when "management/budgets"
vote_management_budget_investment_path(investment.budget, investment, options)
else
vote_budget_investment_path(investment.budget, investment, options)
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