Sha256: af0049bf7309396daffeb2f64aadbe18fdcc0cf2f6167c8054d91669be87468c

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

<% options ||= {} %>
<% table_presenter = layout_presenter.table_presenter(self) %>
<% table_presenter.set_options(options.merge(type: type)) %>

<% if table_presenter.show_title %>
<h3><%= t("#{type}.index.title") %></h3>
<% end %>
<% if collection.none? || collection.select{|e| e.id.present? }.none? %>
<p><%= I18n.t("#{type}.index.empty_collection")%></p>
<% else %>
<table class="table table-striped">
  <thead>
    <tr class="<%= cycle('odd', 'even') %>">
  <% (columns.is_a?(Hash) ? columns.keys : columns).map{|c| c.gsub('_id', '')}.each do |column| %>
      <th><%= t("activerecord.attributes.#{type.singularize}.#{column}") %></th>
  <% end %>
      <th></th>
    </tr>
  </thead>
  <tbody>
  <% collection.select{|e| e.id.present? }.each do |resource| %>
    <% table_presenter.set_option(:resource, resource) %>
    <tr class="<%= cycle('odd', 'even') %>">
    <% (columns.is_a?(Hash) ? columns.keys : columns).each do |column| %>
      <td>
        <%= table_cell column, resource, columns.is_a?(Hash) ? columns[column] : nil %>
      </td>
    <% end %>
      <%= table_presenter.actions %>
    </tr>
  <% end %>
  </tbody>
</table>
<% end %>

<%= table_presenter.new_link(options) %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
voluntary-0.1.0.rc4 app/views/shared/collection/_table.html.erb
voluntary-0.1.0.rc3 app/views/shared/collection/_table.html.erb
voluntary-0.1.0.rc2 app/views/shared/collection/_table.html.erb