avo-diff_field 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81dd10a1bf80eb260edb069cb2f3980950788d78e9e4c4c70da7f0b684d238a6
|
4
|
+
data.tar.gz: 7629f9c59c58d0fd21e22667ab3eea630755e0b87b910859cb6c578cfd47fabb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68ae3563cd16900dec9b1952843546cc9685f3474f5cc6c82ad61fca0991f93747567019fd68153dfc55c4824f214763a7175d23dd4629c8160b151dc7b2de67
|
7
|
+
data.tar.gz: 8c51c749e6e1bd93699ff2c3cd1ef46ec1cb8ab9cdd86b680cac2ddf6678bd3aa48c2a6d66c9d00e4fd5989a68e371a8a0d3590e6d4cb72f09af7cc04de5a621
|
@@ -4,17 +4,23 @@ class Avo::DiffField::Fields::DiffField::ShowComponent < Avo::Fields::ShowCompon
|
|
4
4
|
def initialize **args
|
5
5
|
super(**args)
|
6
6
|
@diffy_value = @field.value&.map do |k, v|
|
7
|
-
|
8
|
-
when 'update'
|
7
|
+
if @field.record.class == "PaperTrail::Version".safe_constantize
|
9
8
|
left_value = v[0]
|
10
9
|
right_value = v[1]
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
elsif @field.record.class == "Audited::Audit".safe_constantize
|
11
|
+
case @field.record.action
|
12
|
+
when 'update'
|
13
|
+
left_value = v[0]
|
14
|
+
right_value = v[1]
|
15
|
+
when 'destroy'
|
16
|
+
left_value = v
|
17
|
+
right_value = ''
|
18
|
+
when 'create'
|
19
|
+
left_value = ''
|
20
|
+
right_value = v
|
21
|
+
end
|
17
22
|
end
|
23
|
+
|
18
24
|
[k, Diffy::Diff.new(left_value.to_s, right_value.to_s, format: :html, include_plus_and_minus_in_html: true)]
|
19
25
|
end
|
20
26
|
end
|