Add budget_published? helper method to BudgetHelper

We need to check if the budget is in drafting phase to avoid showing
it to the users, unless the current user is an administrator.
This commit is contained in:
Bertocq
2018-01-08 22:56:47 +01:00
parent f9803ce9ca
commit 03f4fce2dd

View File

@@ -42,4 +42,9 @@ module BudgetsHelper
def investment_tags_select_options
Budget::Investment.tags_on(:valuation).order(:name).select(:name).distinct
end
def budget_published?(budget)
!budget.drafting? || current_user&.administrator?
end
end