Module: SolidusAdmin::AdminResources

Defined in:
lib/solidus_admin/admin_resources.rb

Instance Method Summary collapse

Instance Method Details

#admin_resources(resource, **options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/solidus_admin/admin_resources.rb', line 4

def admin_resources(resource, **options)
  batch_actions = %i[destroy]
  batch_actions &= options[:only] if options[:only]
  batch_actions -= options[:except] if options[:except]

  resources(resource, options) do
    yield if block_given?

    collection do
      delete :destroy if batch_actions.include?(:destroy)
    end

    member do
      patch :move if options[:sortable]
    end

    yield if block_given?
  end
end