kbaum-munger 0.1.5 → 0.1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/munger/render/html.rb +31 -30
- metadata +1 -1
data/lib/munger/render/html.rb
CHANGED
@@ -24,46 +24,47 @@ module Munger #:nodoc:
|
|
24
24
|
|
25
25
|
def render
|
26
26
|
x = Builder::XmlMarkup.new
|
27
|
-
|
28
27
|
x.table(:class => @classes[:table], :id=>'report-table') do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
x.thead do
|
29
|
+
x.tr do
|
30
|
+
@report.columns.each do |column|
|
31
|
+
x.th(:class => 'columnTitle') { x << @report.column_title(column) }
|
32
|
+
end
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
36
|
-
|
35
|
+
x.tbody do
|
36
|
+
@report.process_data.each do |row|
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
classes = []
|
39
|
+
classes << row[:meta][:row_styles]
|
40
|
+
classes << 'group' + row[:meta][:group].to_s if row[:meta][:group]
|
41
|
+
classes << cycle('even', 'odd')
|
42
|
+
classes.compact!
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
if row[:meta][:group_header]
|
45
|
+
classes << 'groupHeader' + row[:meta][:group_header].to_s
|
46
|
+
end
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
row_attrib = {}
|
49
|
+
row_attrib = {:class => classes.join(' ')} if classes.size > 0
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
x.tr(row_attrib) do
|
52
|
+
if row[:meta][:group_header]
|
53
|
+
header = row[:meta][:group_value].to_s
|
54
|
+
x.th(:colspan => @report.columns.size) { x << header }
|
55
|
+
else
|
56
|
+
@report.columns.each do |column|
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
cell_attrib = {}
|
59
|
+
if cst = row[:meta][:cell_styles]
|
60
|
+
cst = Item.ensure(cst)
|
61
|
+
if cell_styles = cst[column]
|
62
|
+
cell_attrib = {:class => cell_styles.join(' ')}
|
63
|
+
end
|
63
64
|
end
|
64
|
-
end
|
65
65
|
|
66
|
-
|
66
|
+
x.td(cell_attrib) { x << row[:data][column].to_s }
|
67
|
+
end
|
67
68
|
end
|
68
69
|
end
|
69
70
|
end
|