Created
December 20, 2008 22:22
-
-
Save ahoward/38439 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def collection_matrix options = {}, &block | |
collection = options.getopt(:collection, @collection) | |
matrix = collection.matrix | |
table_(:class => 'simple collection matrix'){ | |
thead_{ | |
td_{ '-' } | |
matrix.cols.each do |col| | |
td_(:class => 'col name'){ h col.name } | |
end | |
} | |
matrix.rows.each do |row| | |
tr_{ | |
td_(:class => 'row name'){ | |
h [row.name, row.report_type.downcase].join(', ') | |
} | |
row.each do |cell| | |
td_{ | |
block.call(cell) | |
} | |
end | |
} | |
end | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment