diff options
| author | Teddy Wing | 2018-01-23 12:10:30 +0100 | 
|---|---|---|
| committer | Zog | 2018-01-25 17:18:01 +0100 | 
| commit | 5ef7e7c47e9639af6e76cac4a520909ef36a148d (patch) | |
| tree | 0b0a36dd36bee5c0e0d57f74a10ebfc2f2ed132c | |
| parent | 759699cec33a06b931c50f4473460fb79290e356 (diff) | |
| download | chouette-core-5ef7e7c47e9639af6e76cac4a520909ef36a148d.tar.bz2 | |
ImportDecorator: Convert to new action links interface
Also remove the `delete` link because the policy disables it for
everyone (3f5ac4764b859f97f776df565599e312b4584a03,
17e946771afcff10b6165dd3a97b38aa9c06b1f2).
Refs #5586
| -rw-r--r-- | app/decorators/import_decorator.rb | 32 | ||||
| -rw-r--r-- | app/views/imports/show.html.slim | 9 | 
2 files changed, 9 insertions, 32 deletions
| diff --git a/app/decorators/import_decorator.rb b/app/decorators/import_decorator.rb index 440501fc1..58298b7a0 100644 --- a/app/decorators/import_decorator.rb +++ b/app/decorators/import_decorator.rb @@ -15,28 +15,14 @@ class ImportDecorator < AF83::Decorator      l.class 'btn btn-primary'    end -  # def action_links -  #   policy = h.policy(object) -  #   links = [] -  # -  #   links << Link.new( -  #     content: h.t('imports.actions.download'), -  #     href: object.file.url -  #   ) -  # -  #   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 +  with_instance_decorator do |instance_decorator| +    instance_decorator.show_action_link do |l| +      l.href { h.workbench_import_path(context[:workbench], object) } +    end +    instance_decorator.action_link secondary: :show do |l| +      l.content t('imports.actions.download') +      l.href { object.file.url } +    end +  end  end diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim index cf137867b..e59c0c8f6 100644 --- a/app/views/imports/show.html.slim +++ b/app/views/imports/show.html.slim @@ -1,13 +1,4 @@  - breadcrumb :import, @workbench, @import -- content_for :page_header_content do -  .row -    .col-lg-12.text-right.mb-sm -      - @import.action_links.each do |link| -        = link_to link.href, -            method: link.method, -            data: link.data, -            class: 'btn btn-primary' do -              = link.content  - page_header_content_for @import | 
