Sha256: 79841242d4afe1322f730f210c212ab1e263758684a0d2fe632f3c2b16a4c128
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
<% col_count = object.columns&.length || 0 row_count = object.columns&.map { |c| c.lines.length }&.max || 0 def label_cell_style(column) return unless column ["font-weight: #{options.bold_weight}"].tap do |styles| styles << "width: #{column.label_width}%" if column.label_width end.join(';') end def value_cell_style(column, last) return unless column right_padding = last ? 0 : 20 ["padding-right: #{right_padding}px"].tap do |styles| styles << "text-align: #{column.align}" if !column.align.to_s.empty? styles << "width: #{column.value_width}%" if column.value_width end.join(';') end %> <table class="pane"> <tbody> <% (0...row_count).each do |row_index| -%> <tr> <% (0...col_count).each do |col_index| -%> <% column = object.columns[col_index] -%> <% line = column&.lines[row_index] -%> <td style="<%= label_cell_style(column) -%>"><%= line&.label %></td> <td style="<%= value_cell_style(column, col_index >= col_count-1) -%>"><%= line&.value %></td> <% end -%> <tr> <% end -%> </tbody> </table>
Version data entries
4 entries across 4 versions & 1 rubygems