Sha256: 5beb74f7e64b38a8a7fa7f1a2dd5469aabae40f1fd6cde1698deead10a469876

Contents?: true

Size: 906 Bytes

Versions: 17

Compression:

Stored size: 906 Bytes

Contents

# frozen_string_literal: true
module ActiveAdmin
  module Views

    # # Index as a Block
    #
    # If you want to fully customize the display of your resources on the index
    # screen, Index as a Block allows you to render a block of content for each
    # resource.
    #
    # ```ruby
    # index as: :block do |product|
    #   div for: product do
    #     resource_selection_cell product
    #     h2  auto_link     product.title
    #     div simple_format product.description
    #   end
    # end
    # ```
    #
    class IndexAsBlock < ActiveAdmin::Component

      def build(page_presenter, collection)
        add_class "index"
        resource_selection_toggle_panel if active_admin_config.batch_actions.any?
        collection.each do |obj|
          instance_exec(obj, &page_presenter.block)
        end
      end

      def self.index_name
        "block"
      end

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
activeadmin-3.2.5 lib/active_admin/views/index_as_block.rb
activeadmin-3.2.4 lib/active_admin/views/index_as_block.rb
activeadmin-3.2.3 lib/active_admin/views/index_as_block.rb
activeadmin-3.2.2 lib/active_admin/views/index_as_block.rb
activeadmin-3.2.1 lib/active_admin/views/index_as_block.rb
activeadmin-3.2.0 lib/active_admin/views/index_as_block.rb
activeadmin-3.1.0 lib/active_admin/views/index_as_block.rb
activeadmin-3.0.0 lib/active_admin/views/index_as_block.rb
activeadmin-2.14.0 lib/active_admin/views/index_as_block.rb
activeadmin-2.13.1 lib/active_admin/views/index_as_block.rb
activeadmin-2.13.0 lib/active_admin/views/index_as_block.rb
activeadmin-2.12.0 lib/active_admin/views/index_as_block.rb
activeadmin-2.11.2 lib/active_admin/views/index_as_block.rb
activeadmin-2.11.1 lib/active_admin/views/index_as_block.rb
activeadmin-2.11.0 lib/active_admin/views/index_as_block.rb
activeadmin-2.10.1 lib/active_admin/views/index_as_block.rb
activeadmin-2.10.0 lib/active_admin/views/index_as_block.rb