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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user