Class: Aureus::Components::DataTableRow
Instance Method Summary
collapse
Methods inherited from Renderable
#compact, #compact_render, #content_tag, #init
Constructor Details
Returns a new instance of DataTableRow.
87
88
89
90
91
92
|
# File 'lib/aureus/components/data_table.rb', line 87
def initialize
init_haml_helpers
@cells = Array.new
@buttons = Array.new
@identifier = ''
end
|
Instance Method Details
106
107
108
109
110
111
112
|
# File 'lib/aureus/components/data_table.rb', line 106
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
|
114
115
116
|
# File 'lib/aureus/components/data_table.rb', line 114
def button_raw content
@buttons << Renderable.new(content)
end
|
#cell(data = '', &block) ⇒ Object
98
99
100
101
102
103
104
|
# File 'lib/aureus/components/data_table.rb', line 98
def cell data='', &block
if block_given?
@cells << DataTableRowCell.new(capture_haml(&block))
else
@cells << DataTableRowCell.new(data)
end
end
|
#identifier(value) ⇒ Object
94
95
96
|
# File 'lib/aureus/components/data_table.rb', line 94
def identifier value
@identifier = value
end
|
#render ⇒ Object
118
119
120
|
# File 'lib/aureus/components/data_table.rb', line 118
def render
content_tag 'tr', compact_render(*@cells)+content_tag('td',compact_render(*@buttons),class: 'buttons'), id: @identifier
end
|