aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2017-12-01 14:00:34 +0100
committerLuc Donnet2017-12-01 14:00:34 +0100
commit5b65f3400c40f4dd3beca0763d9d4767213a6e33 (patch)
treed69c1a428aff47813305cca5e111fa41da12537c
parent103c178a939cb46578efd51a8171755778f41dce (diff)
parent8480e1db036e961fe106ff7fb2456c76f07d88ae (diff)
downloadchouette-core-5b65f3400c40f4dd3beca0763d9d4767213a6e33.tar.bz2
Merge branch 'master' into staging
-rw-r--r--app/decorators/import_decorator.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/app/decorators/import_decorator.rb b/app/decorators/import_decorator.rb
index d63d723cd..e748f830d 100644
--- a/app/decorators/import_decorator.rb
+++ b/app/decorators/import_decorator.rb
@@ -12,6 +12,7 @@ class ImportDecorator < Draper::Decorator
end
def action_links
+ policy = h.policy(object)
links = []
links << Link.new(
@@ -27,16 +28,17 @@ class ImportDecorator < Draper::Decorator
href: object.file.url
)
- # if h.policy(object).destroy?
- links << Link.new(
- content: h.destroy_link_content,
- href: h.workbench_import_path(
- context[:workbench],
- object
- ),
- method: :delete,
- data: { confirm: h.t('imports.actions.destroy_confirm') }
- )
+ if policy.destroy?
+ links << Link.new(
+ content: h.destroy_link_content,
+ href: h.workbench_import_path(
+ context[:workbench],
+ object
+ ),
+ method: :delete,
+ data: { confirm: h.t('imports.actions.destroy_confirm') }
+ )
+ end
links
end