Sha256: c907076be98008eade84542406207e34fc147a451aa7c2fa046f5ac46cfa2574

Contents?: true

Size: 526 Bytes

Versions: 5

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

module SolidusAdmin::AdminResources
  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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 lib/solidus_admin/admin_resources.rb
solidus_admin-0.3.1 lib/solidus_admin/admin_resources.rb
solidus_admin-0.3.0 lib/solidus_admin/admin_resources.rb
solidus_admin-0.2.0 lib/solidus_admin/admin_resources.rb
solidus_admin-0.1.0 lib/solidus_admin/admin_resources.rb