Sha256: 1c588f1dda0f93c0b70e5ebea4879ef987d262072100838b04ef12cd78c051c7

Contents?: true

Size: 948 Bytes

Versions: 3

Compression:

Stored size: 948 Bytes

Contents

<%= content_tag(:table, table.attrs) do %>
  <% if table.caption %>
    <%= content_tag(:caption, table.caption.value, table.caption.attrs) %>
  <% end %>
  <% if table.columns.any?{|column| column.attrs.present?} %>
    <% table.columns.chunk{|column| column.attrs}.each do |column_group| %>
      <% span = column_group.last.length %>
      <% attrs = column_group.first %>
      <% attrs.merge!(span: span) if span > 1 %>
      <%= tag(:col, attrs) %>
    <% end %>
  <% end %>
  <thead>
    <tr>
      <% table.columns.each do |column| %>
        <%= tableficate_header_tag(column) %>
      <% end %>
    </tr>
  </thead>
  <tbody>
    <% if table.rows.size > 0 %>
      <% table.rows.each do |row| %>
        <%= tableficate_row_tag(row, table.columns) %>
      <% end %>
    <% elsif table.empty and table.empty.value.present? %>
      <tr><%= content_tag(:td, table.empty.value, table.empty.attrs) %></tr>
    <% end %>
  </tbody>
<% end %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tableficate-0.3.2 app/views/tableficate/_table.html.erb
tableficate-0.3.1 app/views/tableficate/_table.html.erb
tableficate-0.3.0 app/views/tableficate/_table.html.erb