Commit 1a66b02
Changed files (3)
app
views
my
audits
config
locales
app/views/my/audits/_audit.html.erb
@@ -0,0 +1,33 @@
+<div class="box">
+ <article class="media">
+ <div class="media-left">
+ <figure class="image is-64x64">
+ <img src="https://bulma.io/images/placeholders/128x128.png" alt="Image">
+ </figure>
+ </div>
+ <div class="media-content">
+ <div class="content">
+ <p>
+ <strong><%= audit&.auditable&.class&.model_name&.human %></strong> <small><%= audit.action %></small> <small><%= local_time_ago(audit.created_at) %></small>
+ <pre><%= JSON.pretty_generate(audit.audited_changes) %></pre>
+ </p>
+ <table class="table is-bordered is-narrow is-hoverable is-striped is-fullwidth">
+ <thead>
+ <th><%= t('.associated') %></th>
+ <th><%= t('.user') %></th>
+ <th><%= t('.version') %></th>
+ <th><%= t('.remote_address') %></th>
+ </thead>
+ <tbody>
+ <tr>
+ <td><%= audit.associated&.flipper_id %></td>
+ <td><%= audit.user&.email %></td>
+ <td><%= audit.version %></td>
+ <td><%= audit.remote_address %></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </article>
+</div>
app/views/my/audits/index.html.erb
@@ -2,33 +2,7 @@
<div class="columns">
<div class="column">
<h1 class="title"><%= t('.title') %></h1>
-
- <table class="table is-bordered is-narrow is-hoverable is-striped is-fullwidth">
- <thead>
- <th><%= t('.action') %></th>
- <th><%= t('.auditable') %></th>
- <th><%= t('.changes') %></th>
- <th><%= t('.associated') %></th>
- <th><%= t('.user') %></th>
- <th><%= t('.version') %></th>
- <th><%= t('.remote_address') %></th>
- <th><%= t('.created_at') %></th>
- </thead>
- <tbody>
- <% @audits.each do |audit| %>
- <tr>
- <td><%= audit.action %></td>
- <td><%= audit&.auditable&.class %></td>
- <td><%= JSON.pretty_generate(audit.audited_changes) %></td>
- <td><%= audit.associated&.flipper_id %></td>
- <td><%= audit.user&.email %></td>
- <td><%= audit.version %></td>
- <td><%= audit.remote_address %></td>
- <td><%= local_time_ago(audit.created_at) %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
+ <%= render partial: "audit", collection: @audits %>
</div>
</div>
</div>
config/locales/en.yml
@@ -39,7 +39,7 @@ en:
changes: Changes
created_at: Created at
remote_address: Remote address
- title: Audits
+ title: Audit Log
user: User
version: Version
clients:
@@ -100,7 +100,7 @@ en:
login: Login
title: Login
show:
- audits: Audits
+ audits: Audit Log
clients: Clients
documentation: Documentation
home: Home