class ActiveAdmin::Views::IndexAsGrid


“‘
end
link_to image_tag(product.image_path), admin_product_path(product)
index as: :grid, columns: 5 do |product|
“`ruby
option:
You can customize the number of columns that are rendered using the columns
collection. The resource is passed into the block for you to use in the view.
The block is rendered within a cell in the grid once for each resource in the
“`
end
link_to image_tag(product.image_path), admin_product_path(product)
index as: :grid do |product|
“`ruby
index block.
(possibly a grid of thumbnail images). To do so, use the :grid option for the
Sometimes you want to display the index screen for a set of resources as a grid
# Index as a Grid

def self.index_name

def self.index_name
  "grid"
end

def build(page_presenter, collection)

def build(page_presenter, collection)
  @page_presenter = page_presenter
  @collection = collection.to_a
  add_class "index"
  build_table
end

def build_empty_cell

def build_empty_cell
  td " ".html_safe
end

def build_item(item)

def build_item(item)
  td for: item do
    instance_exec(item, &@page_presenter.block)
  end
end

def build_row(group)

def build_row(group)
  tr do
    group.each do |item|
      item ? build_item(item) : build_empty_cell
    end
  end
end

def build_table

def build_table
  resource_selection_toggle_panel if active_admin_config.batch_actions.any?
  table class: "index_grid" do
    @collection.in_groups_of(number_of_columns).each do |group|
      build_row(group)
    end
  end
end

def default_number_of_columns

def default_number_of_columns
  3
end

def number_of_columns

def number_of_columns
  @page_presenter[:columns] || default_number_of_columns
end