Class: Aureus::DataTableRow

Inherits:
Renderable show all
Defined in:
lib/aureus/data_table.rb

Instance Method Summary collapse

Methods inherited from Renderable

#compact, #compact_render, #content_tag, #init

Constructor Details

#initializeDataTableRow

Returns a new instance of DataTableRow.



74
75
76
77
78
# File 'lib/aureus/data_table.rb', line 74

def initialize
	init_haml_helpers
	@cells = Array.new
	@buttons = Array.new
end

Instance Method Details

#button(type_or_title, url, *args) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/aureus/data_table.rb', line 88

def button type_or_title, url, *args
	if type_or_title.is_a? Symbol
		@buttons << DataTableRowButton.new(type_or_title,type_or_title.to_s,url,args)
	else
		@buttons << DataTableRowButton.new(:text,type_or_title.to_s,url,args)
	end
end

#button_raw(content) ⇒ Object



96
97
98
# File 'lib/aureus/data_table.rb', line 96

def button_raw content
	@buttons << Renderable.new(content)
end

#cell(data = "", &block) ⇒ Object



80
81
82
83
84
85
86
# File 'lib/aureus/data_table.rb', line 80

def cell data="", &block
	if block_given?
		@cells << DataTableRowCell.new(capture_haml(&block))
	else
		@cells << DataTableRowCell.new(data)
	end
end

#renderObject



100
101
102
# File 'lib/aureus/data_table.rb', line 100

def render
	 "tr", compact_render(*@cells)+("td",compact_render(*@buttons),:class => "buttons")
end