Sha256: cd69ab26040e3da8cdd3e66be40c535655ed7b791ddab336706f68a64313831f

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 KB

Contents

<% @record_count = records.length %>
<div id="grid">
  <table class="tablesorter">
    <thead>
      <tr>
        <!-- All the columns passed in :columns -->
        <% columns.each do |col| %>
        <th class="column_name col_<%= column_name col %>">
          <%= column_name col %>
        </th>
        <% end %>
      
        <!-- If adhoc_columns where provided, add them to the list of cols -->
        <% (adhoc_columns ||= {}).keys.each do |key| %>
        <th class="column_name col_<%= key %>">
          <%= key %>
        </th>
        <% end %>
        
        <!-- if relationships where provided, add them to the list of cols -->
        <% (relationships ||= {}).keys.each do |key| %>
        <th class="column_name col_<%= key %>">
          <%= key %>
        </th>
        <% end %>
      </tr>
    </thead>
  
    <tbody>
      <!-- All the records passed in :records -->
      <% records.each do |r| %>
      <tr>
        <!-- Values for each record using :columns -->
        <% columns.each do |col| %>
        <% row_value = r.send column_name(col) %>
        <td class="col_<%= column_name col %>" title="<%= h(row_value) %>">
          <%= row_value %>
        </td>
        <% end %>
      
      
        <!-- Values for each record using :adhoc_columns -->
        <% (adhoc_columns ||= {}).each do |adhoc_key, adhoc_block| %>
        <% row_value = adhoc_block.call(r) %>
        <td class="col_<%= adhoc_key %>" title="<%= h(row_value) %>">
          <%= row_value %>
        </td>
        <% end %>
        
        <!-- if relationships where provided, add them to the list of cols -->
        <% (relationships ||= {}).each do |key, rel| %>
        <td class="col_<%= key %>">
          <%= relationship_link rel, r %>
        </td>
        <% end %>
      
      </tr>
      <% end %>  
    </tbody>
  </table>
</div>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-cutie-ui-0.4.0 lib/dm-cutie-ui/server/views/shared/_grid.erb