app/views/admin/audit_trails/index.html.erb
<div class='page-header'>
<div class='container'>
<h1>Audit Trail</h1>
</div>
</div>
<div class="container">
<div class='panel panel-default'>
<div class='panel-heading'>
<h2>All Audit Items</h2>
</div>
<div class='panel-body table-responsive'>
<table class='table table-default'>
<thead>
<th>When</th>
<th>Who</th>
<th>Event</th>
<th>Type</th>
<th>Class</th>
</thead>
<tbody>
<% @versions.order('created_at DESC').group_by { |v| v.created_at.to_date }.each do |date, versions| %>
<tr>
<th><strong><%= date.to_s(:long) %></strong></th>
<th></th>
<th></th>
<th></th>
<th></th>
<tr>
<% versions.each do |version| %>
<tr>
<td><%= version.created_at.to_s(:time) %></td>
<td><%= version.whodunnit.to_i > 0 ? User.find(version.whodunnit.to_i).name : 'unavailable' %></td>
<td><%= version.event.titleize %></td>
<%- if version.item %>
<td><%= "#{version.item.class.to_s.titleize} ##{version.item.id}" %></td>
<% if (version.item.is_a? CaseFile) %>
<td><%= link_to "Case ##{version.item.id}",case_path(version.item) %></td>
<% else %>
<td><%= link_to "Case ##{version.item.id}", case_path(version.item.case_file) %></td>
<% end %>
<%- else %>
<td></td>
<td></td>
<%- end %>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>