diff options
| author | Luc Donnet | 2017-12-01 13:30:04 +0100 |
|---|---|---|
| committer | Luc Donnet | 2017-12-01 13:30:04 +0100 |
| commit | 8480e1db036e961fe106ff7fb2456c76f07d88ae (patch) | |
| tree | 6dd9ffaeb5187a29a96aa8c072ab8cef3cd779ff | |
| parent | 1bdb0765df3a172daedaa0e86dd1cdce328489fb (diff) | |
| download | chouette-core-8480e1db036e961fe106ff7fb2456c76f07d88ae.tar.bz2 | |
Delete import links in show page must appear if user have the rights
| -rw-r--r-- | app/decorators/import_decorator.rb | 22 |
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 |
