Method: ActiveAdmin::Views::IndexAsTable#build

Defined in:
lib/active_admin/views/index_as_table.rb

#build(page_presenter, collection) ⇒ Object



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/active_admin/views/index_as_table.rb', line 228

def build(page_presenter, collection)
  table_options = {
    id: "index_table_#{active_admin_config.resource_name.plural}",
    class: "index_table index",
    i18n: active_admin_config.resource_class,
    sortable: true,
    paginator: page_presenter[:paginator] != false,
    row_class: page_presenter[:row_class]
  }
  if page_presenter.block
    insert_tag IndexTableFor, collection, table_options do |t|
      instance_exec(t, &page_presenter.block)
    end
  else
    render partial: 'index_as_table', locals: { default_table_options: table_options }
  end
end