Method: TableForPatch#column

Defined in:
lib/activeadmin_custom_layout/layout/components/table_for.rb

#column(*args, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/activeadmin_custom_layout/layout/components/table_for.rb', line 3

def column(*args, &block)
  super

  col = @columns.last

  @collection.each_with_index do |resource, index|
    data = aa_data[:table][:rows][index][:data] ||= []

    attr = col.data
    attr = args[1][:sortable] if args[1] and args[1][:sortable].present?

    data << {
      classes: col.html_class,
      html: "#{find_last_child(@tbody.children[index].children.last)}",
      value: "#{find_value_patch(resource, attr)}"
    }
  end
end