diff --git a/README.md b/README.md index dea0841..8132cd3 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ ATTRIBUTE_TYPES = { By default the gem adds the Export button to the partial `views/admin/application/_index_header.html.erb`. But if you have your own Administrate `index` views or override that partial in your application you can add the link manually: ```ruby -link_to('Export', [:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button') if valid_action?(:export) +link_to('Export', [:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button') if existing_action?(resource_class, :export) ``` Example: @@ -78,13 +78,13 @@ Example: ), [:new, namespace.to_sym, page.resource_path.to_sym], class: "button", - ) if valid_action?(:new) && show_action?(:new, new_resource) %> + ) if existing_action?(resource_class, :new) && authorized_action?(new_resource, :new) %> <%= link_to( 'Export', [:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button' - ) if valid_action?(:export) %> + ) if existing_action?(resource_class, :export) %> .... ``` diff --git a/app/views/admin/application/_index_header.html.erb b/app/views/admin/application/_index_header.html.erb index 1dfb610..3c334e1 100644 --- a/app/views/admin/application/_index_header.html.erb +++ b/app/views/admin/application/_index_header.html.erb @@ -30,6 +30,6 @@ [:export, namespace, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button', target: '_blank' - ) if valid_action?(:export) && show_action?(:export, resource_name) %> + ) if existing_action?(resource_class, :export) && authorized_action?(resource_name, :export) %>