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.
60
61
62
63
64
65
|
# File 'lib/aureus/components/data_table.rb', line 60
def initialize
init_haml_helpers
@cells = Array.new
@buttons = Array.new
@identifier = ''
end
|
Instance Method Details
79
80
81
82
83
84
85
|
# File 'lib/aureus/components/data_table.rb', line 79
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
|
87
88
89
|
# File 'lib/aureus/components/data_table.rb', line 87
def button_raw(content)
@buttons << Renderable.new(content)
end
|
#cell(data = '', &block) ⇒ Object
71
72
73
74
75
76
77
|
# File 'lib/aureus/components/data_table.rb', line 71
def cell(data='', &block)
if block
@cells << DataTableRowCell.new(capture_haml(&block))
else
@cells << DataTableRowCell.new(data)
end
end
|
#identifier(value) ⇒ Object
67
68
69
|
# File 'lib/aureus/components/data_table.rb', line 67
def identifier(value)
@identifier = value
end
|
#render ⇒ Object
91
92
93
|
# File 'lib/aureus/components/data_table.rb', line 91
def render
content_tag 'tr', compact_render(*@cells)+content_tag('td',compact_render(*@buttons),class: 'buttons'), id: @identifier
end
|