views: add table builder abstraction.

This commit is contained in:
evazion
2019-11-17 22:14:17 -06:00
parent 43d0955b61
commit be5df37328
3 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
<%= tag.table table.html_attributes do %>
<thead>
<tr>
<% table.columns.each do |column| %>
<th><%= column.name %></th>
<% end %>
</tr>
</thead>
<tbody>
<% table.items.each do |item| %>
<%= tag.tr table.row_attributes(item) do %>
<% table.columns.each do |column| %>
<%= tag.td column.html_attributes do %>
<%= column.value(item) %>
<% end %>
<% end %>
<% end %>
<% end %>
</tbody>
<% end %>