Sha256: 3f8c78f1eaa2f0fc06baa07010273cac6ab9ff40405d2da3e3e86459a12490c2

Contents?: true

Size: 824 Bytes

Versions: 3

Compression:

Stored size: 824 Bytes

Contents

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.
    #
    #     index :as => :block do |product|
    #       div :for => product do
    #         resource_selection_cell product
    #         h2 auto_link(product.title)
    #         div do
    #           simple_format product.description
    #         end
    #       end
    #     end
    #
    class IndexAsBlock < ActiveAdmin::Component

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

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin-0.5.0 lib/active_admin/views/index_as_block.rb
activeadmin-0.5.0.pre1 lib/active_admin/views/index_as_block.rb
activeadmin-0.5.0.pre lib/active_admin/views/index_as_block.rb