|
<% title "#{@audit.action.camelize} #{association_type @audit} #{audit_title @audit}" %>
|
|
|
|
<table class="table table-bordered table-striped">
|
|
<tr>
|
|
<th>What</th>
|
|
<th>Parent</th>
|
|
<th>Old</th>
|
|
<th>New</th>
|
|
</tr>
|
|
<% @audit.audited_changes.each do |name,change| -%>
|
|
<% next if change.nil? or change.to_s.empty? -%>
|
|
<tr class="<%= cycle("even", "odd") -%>">
|
|
<td><%= name.humanize %></td>
|
|
<td><%= audit_parent @audit %></td>
|
|
<%# TODO: Refactor this whole code away from here -%>
|
|
<% record = true if name =~ /.*_id$/ -%>
|
|
<% if change.is_a?(Array) %>
|
|
<% change.each do |v| -%>
|
|
<% v = id_to_label(name,v) if record -%>
|
|
<td><%= h v %></td>
|
|
<% end -%>
|
|
<% else -%>
|
|
<% change = id_to_label(name,change) if record -%>
|
|
<%= change_order(@audit.action, change).map{|v| "<td>#{v}</td>"}.join.html_safe -%>
|
|
<% end -%>
|
|
</tr>
|
|
<% end -%>
|
|
</table>
|
|
|
|
<%= link_to 'Back', :back %>
|