class Aureus::Components::DataTable
Public Class Methods
new(resource) { |self| ... }
click to toggle source
# File lib/aureus/components/data_table.rb, line 6 def initialize(resource, &block) @resource = resource @head = DataTableHead.new @rows = Array.new yield(self) end
Public Instance Methods
head() { |head| ... }
click to toggle source
# File lib/aureus/components/data_table.rb, line 13 def head yield @head end
render()
click to toggle source
# File lib/aureus/components/data_table.rb, line 25 def render content_tag 'table', id: @resource.class.name.downcase, class: 'aureus-datatable' do compact @head.render, content_tag('tbody',compact_render(*@rows)) end end
row() { |row, r| ... }
click to toggle source
# File lib/aureus/components/data_table.rb, line 17 def row @resource.each do |r| row = DataTableRow.new yield row, r @rows << row end end