4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/spectabular/helper.rb', line 4
def table_for(collection,*columns)
columns = columns.first if columns.size <= 1
columns ||= default_columns_for(collection)
@table = Spectabular::Table.new( :collection => instance_variable_get("@#{collection}"),
:collection_name => collection.to_s.humanize,
:columns => columns,
:context => self
)
output = []
if @table.empty?
output << @table.empty_message.html_safe
else
output << content_tag(:table, join_formatted([,spectabular_body]), :class => "spectabular").html_safe
output << .html_safe
end
join_formatted output
end
|