activeadmin-history 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf532560bcd712ca0e5f8b05dc3a7b3f6b896ed84b8deec06be5fce932edd6a9
|
4
|
+
data.tar.gz: 372677dfa74e0dbca215fdf1c77ab4f19080c128d2e11fcc124e6739d692c58f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 591030ee279d7f476fbf3c9af023489cf6a7352696eb924df69f8b34f47c3b074f79383d038aa51c619ac1d9eca89d4134f25f307f5fc1c18f7fa1cf56f19f40
|
7
|
+
data.tar.gz: 631f46fd01f5ea3f23111f2c961b43dca22c30c1d34fa3970993fb8f0e83b23ed81b94e2eb3e86dafd000672d79e45b31ef1dcd4ef899cd23ceee77ebffc9dac
|
@@ -1,4 +1,6 @@
|
|
1
1
|
ActiveAdmin.register AdminAction do
|
2
|
+
actions :index, :show
|
3
|
+
|
2
4
|
index do
|
3
5
|
column 'ID', :id
|
4
6
|
column 'Admin', :admin_user_id do |a|
|
@@ -9,20 +11,49 @@ ActiveAdmin.register AdminAction do
|
|
9
11
|
end
|
10
12
|
column 'Object', :object_id do |o|
|
11
13
|
if o.object_type
|
12
|
-
link_to o.object_type, send("admin_#{o.object_type.constantize.table_name.singularize}_path", o)
|
14
|
+
link_to o.object_type, send("admin_#{o.object_type.constantize.table_name.singularize}_path", o.object_id)
|
13
15
|
end
|
14
16
|
end
|
15
|
-
column '
|
16
|
-
column 'Diff', :object_diff do |o|
|
17
|
+
column 'Diffs', :object_diff do |o|
|
17
18
|
decoded = ActiveSupport::JSON.decode(o.object_diff)
|
18
|
-
|
19
|
-
|
20
|
-
decoded&.each do |k, v|
|
21
|
-
formatted << "#{k}: #{v[0]} => #{v[1]}<br/>"
|
22
|
-
end
|
23
|
-
formatted.html_safe
|
19
|
+
decoded.nil? ? 0 : decoded.size
|
24
20
|
end
|
25
21
|
column 'Performed', :created_at
|
26
22
|
actions
|
27
23
|
end
|
24
|
+
|
25
|
+
show do
|
26
|
+
attributes_table do
|
27
|
+
row :id
|
28
|
+
row 'Admin', :admin_user_id do |a|
|
29
|
+
link_to a.admin_user.email, admin_admin_user_path(a.admin_user)
|
30
|
+
end
|
31
|
+
row 'Action', :action do |a|
|
32
|
+
a.action.humanize
|
33
|
+
end
|
34
|
+
row 'Object', :object_id do |o|
|
35
|
+
if o.object_type
|
36
|
+
link_to o.object_type, send("admin_#{o.object_type.constantize.table_name.singularize}_path", o.object_id)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
row 'Performed', :created_at do |p|
|
40
|
+
p.created_at
|
41
|
+
end
|
42
|
+
row :object_diff do |od|
|
43
|
+
decoded = ActiveSupport::JSON.decode(od.object_diff)
|
44
|
+
formatted = '<table><tbody>'
|
45
|
+
|
46
|
+
decoded&.each do |k, v|
|
47
|
+
formatted << "<tr><td>#{k}</strong></td><td><span style=\"color: red;\">#{v[0]}</span></td><td><span style=\"color: green;\">#{v[1]}</span></td></tr>"
|
48
|
+
end
|
49
|
+
|
50
|
+
formatted << '</tbody></table>'
|
51
|
+
formatted.html_safe
|
52
|
+
end
|
53
|
+
row :object_params do |op|
|
54
|
+
"<pre>#{JSON.pretty_generate(ActiveSupport::JSON.decode(op.object_params))}</pre>".html_safe
|
55
|
+
end
|
56
|
+
end
|
57
|
+
active_admin_comments
|
58
|
+
end
|
28
59
|
end
|