app/views/adminpanel/templates/index.html.erb
<% provide(:page_title, @model.collection_name) -%>
<div class="row-fluid">
<%= render 'adminpanel/shared/new_resource_button' %>
</div>
<div class="row-fluid">
<div class="widget widget-padding span12">
<div class="widget-header">
<%= content_tag(:i, nil, class: "fa fa-#{@model.icon}") %>
<h5>
<%= @model.collection_name %>
</h5>
</div>
<div class="widget-body">
<div class="dataTables_wrapper form-inline">
<table id="<%= table_type(@model) %>" class="table table-striped table-bordered dataTable">
<thead><!-- model attributes -->
<tr>
<% if @model.is_sortable? %>
<th></th>
<% end %>
<% @model.display_attributes('index').each do |fields| %>
<% fields.each do |attribute, properties| %>
<th><%= properties['label'] %></th>
<% end %>
<% end %>
<th><%= I18n.t('actions') %></th>
</tr>
</thead><!-- Ends model attributes -->
<tbody id="<%= table_type(@model) %>" data-no-transition-cache>
<% @collection = @collection.ordered if table_type(@model) == 'sortable' %>
<% @collection.each do |member| %>
<% cache ["#{member.class}-member", member] do %>
<tr
data-id="<%= member.id %>"
<% if @model.is_sortable? %>
data-url="<%= url_for [:move_to_position, member] %>"
<% end %>
>
<% if @model.is_sortable? %>
<td class="draggable">
<i class="fa fa-bars"></i>
</td>
<% end %>
<% @model.display_attributes('index').each do |fields| %>
<% fields.each do |attribute, properties| %>
<td>
<%= field_value(properties['type'], attribute, member) %><!-- SharedPagesHelper -->
</td>
<% end %>
<% end %>
<td>
<%= render 'adminpanel/icons/show', resource: member %>
<%= render 'adminpanel/icons/edit', resource: member %>
<%= render 'adminpanel/icons/delete', resource: member %>
<%= render 'adminpanel/icons/facebook', resource: member %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>