Fix condition to show the "see results" link
This condition was obsolete since we introduced the `results_enabled`
field in commit 4f4dc2c2a.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class Admin::Budgets::LinksComponent < ApplicationComponent
|
||||
attr_reader :budget
|
||||
delegate :can?, to: :helpers
|
||||
|
||||
def initialize(budget)
|
||||
@budget = budget
|
||||
@@ -10,4 +11,12 @@ class Admin::Budgets::LinksComponent < ApplicationComponent
|
||||
def action(action_name, **options)
|
||||
render Admin::ActionComponent.new(action_name, budget, **options)
|
||||
end
|
||||
|
||||
def results_text
|
||||
if Abilities::Everyone.new(User.new).can?(:read_results, budget)
|
||||
t("budgets.show.see_results")
|
||||
else
|
||||
t("admin.budgets.actions.preview_results")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user