Sha256: 377e05e5504c32fcd7a85e4238f5fb8e5873018b91d36b7a63e547737e4e414c

Contents?: true

Size: 916 Bytes

Versions: 11

Compression:

Stored size: 916 Bytes

Contents

module ActiveAdmin
  module Views
    IndexAsBlock.class_eval do

      def build(page_presenter, collection)
        add_class "index"
        if active_admin_config.dsl.sortable_options
          set_attribute "data-sortable-type", "plain"

          sort_url = if (( sort_url_block = active_admin_config.dsl.sortable_options[:sort_url] ))
                       sort_url_block.call(self)
                     else
                       url_for(:action => :sort)
                     end

          set_attribute "data-sortable-url", sort_url
          collection = collection.sort_by do |a|
            a.send(active_admin_config.dsl.sortable_options[:sorting_attribute]) || 1
          end
        end
        resource_selection_toggle_panel if active_admin_config.batch_actions.any?
        collection.each do |obj|
          instance_exec(obj, &page_presenter.block)
        end
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
active_admin-sortable_tree-2.1.0 lib/active_admin/views/index_as_block_decorator.rb
rs-active_admin-sortable_tree-2.2.1 lib/active_admin/views/index_as_block_decorator.rb
rs-active_admin-sortable_tree-2.2.0 lib/active_admin/views/index_as_block_decorator.rb
rs-active_admin-sortable_tree-2.1.0 lib/active_admin/views/index_as_block_decorator.rb
active_admin-sortable_tree-2.0.0 lib/active_admin/views/index_as_block_decorator.rb
active_admin-sortable_tree-1.0.0 lib/active_admin/views/index_as_block_decorator.rb
active_admin-sortable_tree-0.3.0 lib/active_admin/views/index_as_block_decorator.rb
active_admin-sortable_tree-0.2.1 lib/active_admin/views/index_as_block_decorator.rb
active_admin-sortable_tree-0.2.0 lib/active_admin/views/index_as_block_decorator.rb
active_admin-sortable_tree-0.1.0 lib/active_admin/views/index_as_block_decorator.rb
active_admin-sortable_tree-0.0.1 lib/active_admin/views/index_as_block_decorator.rb