11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/represent/grid_helper.rb', line 11
def row_for(array, options = {}, &block)
return "" if array.empty?
array.each_with_index do |node, i|
attributes = options.has_key?(:li_attributes) ? options[:li_attributes] : {}
attributes[:class] ||= ""
if i == 0 and options.has_key?(:first)
attributes[:class] << "#{options[:first]}"
elsif i == array.length - 1 and options.has_key?(:last)
attributes[:class] << "#{options[:last]}"
end
haml_tag :li, attributes do
if block_given?
yield node, i
else
haml_concat node.title
end
end
end
end
|