Sha256: 61865e6fee9345a843f6c8a6b15c69b23b0b50390c8ec817a36e956f0f7e2777

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 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 %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
voluntary-0.1.0.rc1 app/views/shared/collection/_table.html.erb
voluntary-0.0.3 app/views/shared/collection/_table.html.erb
voluntary-0.0.2 app/views/shared/collection/_table.html.erb
voluntary-0.0.1 app/views/shared/collection/_table.html.erb