Class: ActiveAdmin::Views::IndexAsBlock

Inherits:
Component
  • Object
show all
Defined in:
lib/active_admin/views/index_as_block.rb

Overview

# 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 Method Summary collapse

Instance Method Summary collapse

Class Method Details

.index_nameObject


30
31
32
# File 'lib/active_admin/views/index_as_block.rb', line 30

def self.index_name
  "block"
end

Instance Method Details

#build(page_presenter, collection) ⇒ Object


22
23
24
25
26
27
28
# File 'lib/active_admin/views/index_as_block.rb', line 22

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