This release includes some updates in the Style/RedundantParentheses and Naming/PredicateMethod rules. We're changing the code accordingly. Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.76.1 to 1.81.1. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.76.1...v1.81.1) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.81.1 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
41 lines
1.1 KiB
Ruby
41 lines
1.1 KiB
Ruby
module BudgetsHelper
|
|
def namespaced_budget_investment_path(investment, options = {})
|
|
case namespace
|
|
when "management"
|
|
management_budget_investment_path(investment.budget, investment, options)
|
|
else
|
|
budget_investment_path(investment.budget, investment, options)
|
|
end
|
|
end
|
|
|
|
def css_for_ballot_heading(heading)
|
|
current_ballot&.has_lines_in_heading?(heading) ? "is-active" : ""
|
|
end
|
|
|
|
def current_ballot
|
|
Budget::Ballot.find_by(user: current_user, budget: @budget)
|
|
end
|
|
|
|
def unfeasible_or_unselected_filter?
|
|
["unselected", "unfeasible"].include?(@current_filter)
|
|
end
|
|
|
|
def budget_published?(budget)
|
|
budget.published? || current_user&.administrator?
|
|
end
|
|
|
|
def budget_subnav_items_for(budget)
|
|
{
|
|
results: t("budgets.results.link"),
|
|
stats: t("stats.budgets.link"),
|
|
executions: t("budgets.executions.link")
|
|
}.select { |section, _| can?(:"read_#{section}", budget) }.map do |section, text|
|
|
{
|
|
text: text,
|
|
url: send("budget_#{section}_path", budget),
|
|
active: controller_name == section.to_s
|
|
}
|
|
end
|
|
end
|
|
end
|