Class: Aureus::DataTable
  
  
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  Methods inherited from Renderable
  #compact, #compact_render, #content_tag, #init
  
  
  
  
  
  Constructor Details
  
    
  
  
    #initialize(resource, toolbar = true)  ⇒ DataTable 
  
  
  
  
    
Returns a new instance of DataTable.
   
 
  
  
    | 
5
6
7
8
9
10 | # File 'lib/aureus/data_table.rb', line 5
def initialize resource, toolbar = true
	@resource = resource
	@toolbar = toolbar
	@head = DataTableHead.new
	@rows = Array.new
end | 
 
  
 
  
    Instance Method Details
    
      
  
  
    #head {|@head| ... } ⇒ Object 
  
  
  
  
    | 
12
13
14 | # File 'lib/aureus/data_table.rb', line 12
def head
	yield @head
end | 
 
    
      
  
  
    #render  ⇒ Object 
  
  
  
  
    | 
24
25
26
27
28 | # File 'lib/aureus/data_table.rb', line 24
def render
	content_tag "table", :id => @resource.class.name.downcase, :class => (@toolbar?"datatable":"datatable-no-toolbar") do
		compact @head.render, content_tag("tbody",compact_render(*@rows))
	end
end | 
 
    
      
  
  
    #row  ⇒ Object 
  
  
  
  
    | 
16
17
18
19
20
21
22 | # File 'lib/aureus/data_table.rb', line 16
def row
	@resource.each do |r|
		row = DataTableRow.new
		yield row, r
		@rows << row
	end
end |