Use the rails builtin helper "cycle" to add alternate row colors to the table rows in a loop.
<%- for item in @items do -%>
tr class="<%= cycle("even", "odd") %>"
... use item ...
/tr
<%- end -%>
Then in your stylesheet add below
tr.even td{
background-color:#CCC;
}
tr.odd td{
background-color:#EEE;
}
No comments:
Post a Comment