Improve interface of change log table

The name of the changed field is translated, values are truncated so
descriptions with thousands of character would make this table huge and
impossible to read, dates are localized, and values like arrays and
booleans are displayed properly.
This commit is contained in:
Javi Martín
2019-11-03 16:31:24 +01:00
parent 04cd3b460e
commit 98e836ea83
8 changed files with 24 additions and 13 deletions

View File

@@ -20,15 +20,15 @@
<% audit.audited_changes.each do |field, (old_value, new_value)| %>
<tr>
<td class="text-center"><%= audit.id %></td>
<td class="small"><%= field.capitalize %></td>
<td class="small"><%= sanitize(resource.class.human_attribute_name(field)) %></td>
<td class="small">
<div class="audit-value"><%= old_value %></div>
<div class="audit-value"><%= truncate_audit_value(resource, field, old_value) %></div>
</td>
<td class="small">
<div class="audit-value"><%= new_value %></div>
<div class="audit-value"><%= truncate_audit_value(resource, field, new_value) %></div>
</td>
<td class="small">
<%= audit.created_at.to_date %>
<%= l audit.created_at.to_date %>
</td>
<td class="small">
<%= audit.user&.name %>

View File

@@ -41,7 +41,7 @@
<div class="small-12 medium-4 column">
<p>
<strong><%= t("admin.budget_investments.show.selection.title") %></strong>:
<%= t("admin.budget_investments.show.selection.#{@investment.selected?}") %>
<%= @investment.class.human_attribute_name("selected_#{@investment.selected?}") %>
</p>
</div>
<div class="small-12 medium-4 column">