audited-timeline 1.0.3 → 1.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
  SHA1:
3
- metadata.gz: 083535249481fe590d1af6da60cc27a1f276af09
4
- data.tar.gz: ebdaf6694704f78c453b609bb07d1ab39afd8ecd
3
+ metadata.gz: 547a60fab678cf1729d21c4e8ce557da4592b69f
4
+ data.tar.gz: 61c8a528f2754570fca8add02b79e682d3cd42a6
5
5
  SHA512:
6
- metadata.gz: 3e3f874e563e7d42d0226bb180e7c77487fe64b3ac20afa71c6c5b1facf704890ed20626dcba610712730ee8fc0c9b2cfa4fc94aaebaf559eee8fc5f5e292e08
7
- data.tar.gz: 147a84ebb69b48b383310dd83333ba3cd62f7cf380846569dab8a142fa4f93af035296450c6c7a9848863def2d33fe2295758642d434a1f354b4fcd42d438c58
6
+ metadata.gz: ac0aeed4f9926b65e5536d85100e5820bbf79f6d1a1ae27538d5d0f30ebf5c32fd688255f52e600cb7f0e504e9b593fef216d64070d29d29ed90e37a7386b5e2
7
+ data.tar.gz: 2389deb4a8097921242a5ede04bd2312bfdc6e0547f8e79ea69b180623d42a6b8376cac8afd3c70f1f274deaba0338c189755ce568418f51b8d81809b202ebb6
@@ -1,91 +1,125 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- customer-client (0.0.1)
5
- activesupport (> 3.0.0)
6
- faraday
7
- faraday_middleware
8
- rest-in-peace
9
- webmock
10
-
11
- PATH
12
- remote: ../REST-in-Peace
13
- specs:
14
- rest-in-peace (3.0.0)
15
- activemodel (>= 3.2, < 5)
4
+ audited-timeline (1.0.3)
5
+ audited (>= 4.2.0)
6
+ draper (>= 2.1.0)
7
+ rails (>= 4.0.0)
16
8
 
17
9
  GEM
18
10
  remote: https://rubygems.org/
19
11
  specs:
20
- activemodel (4.2.0)
21
- activesupport (= 4.2.0)
12
+ actionmailer (4.2.7.1)
13
+ actionpack (= 4.2.7.1)
14
+ actionview (= 4.2.7.1)
15
+ activejob (= 4.2.7.1)
16
+ mail (~> 2.5, >= 2.5.4)
17
+ rails-dom-testing (~> 1.0, >= 1.0.5)
18
+ actionpack (4.2.7.1)
19
+ actionview (= 4.2.7.1)
20
+ activesupport (= 4.2.7.1)
21
+ rack (~> 1.6)
22
+ rack-test (~> 0.6.2)
23
+ rails-dom-testing (~> 1.0, >= 1.0.5)
24
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
25
+ actionview (4.2.7.1)
26
+ activesupport (= 4.2.7.1)
22
27
  builder (~> 3.1)
23
- activesupport (4.2.0)
28
+ erubis (~> 2.7.0)
29
+ rails-dom-testing (~> 1.0, >= 1.0.5)
30
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
+ activejob (4.2.7.1)
32
+ activesupport (= 4.2.7.1)
33
+ globalid (>= 0.3.0)
34
+ activemodel (4.2.7.1)
35
+ activesupport (= 4.2.7.1)
36
+ builder (~> 3.1)
37
+ activerecord (4.2.7.1)
38
+ activemodel (= 4.2.7.1)
39
+ activesupport (= 4.2.7.1)
40
+ arel (~> 6.0)
41
+ activesupport (4.2.7.1)
24
42
  i18n (~> 0.7)
25
43
  json (~> 1.7, >= 1.7.7)
26
44
  minitest (~> 5.1)
27
45
  thread_safe (~> 0.3, >= 0.3.4)
28
46
  tzinfo (~> 1.1)
29
- addressable (2.3.6)
47
+ arel (6.0.3)
48
+ audited (4.3.0)
49
+ activerecord (>= 4.0, < 5.1)
50
+ rails-observers (~> 0.1.2)
30
51
  builder (3.2.2)
31
- coderay (1.1.0)
32
- columnize (0.9.0)
33
- crack (0.4.2)
34
- safe_yaml (~> 1.0.0)
35
- debugger (1.6.8)
36
- columnize (>= 0.3.1)
37
- debugger-linecache (~> 1.2.0)
38
- debugger-ruby_core_source (~> 1.3.5)
39
- debugger-linecache (1.2.0)
40
- debugger-ruby_core_source (1.3.8)
41
- diff-lcs (1.2.5)
42
- faraday (0.9.1)
43
- multipart-post (>= 1.2, < 3)
44
- faraday_middleware (0.9.1)
45
- faraday (>= 0.7.4, < 0.10)
52
+ concurrent-ruby (1.0.2)
53
+ draper (2.1.0)
54
+ actionpack (>= 3.0)
55
+ activemodel (>= 3.0)
56
+ activesupport (>= 3.0)
57
+ request_store (~> 1.0)
58
+ erubis (2.7.0)
59
+ globalid (0.3.7)
60
+ activesupport (>= 4.1.0)
46
61
  i18n (0.7.0)
47
- json (1.8.2)
48
- method_source (0.8.2)
49
- minitest (5.5.1)
50
- multipart-post (2.0.0)
51
- pry (0.10.1)
52
- coderay (~> 1.1.0)
53
- method_source (~> 0.8.1)
54
- slop (~> 3.4)
55
- pry-debugger (0.2.3)
56
- debugger (~> 1.3)
57
- pry (>= 0.9.10, < 0.11.0)
58
- rake (10.4.2)
59
- rspec (3.2.0)
60
- rspec-core (~> 3.2.0)
61
- rspec-expectations (~> 3.2.0)
62
- rspec-mocks (~> 3.2.0)
63
- rspec-core (3.2.0)
64
- rspec-support (~> 3.2.0)
65
- rspec-expectations (3.2.0)
66
- diff-lcs (>= 1.2.0, < 2.0)
67
- rspec-support (~> 3.2.0)
68
- rspec-mocks (3.2.0)
69
- diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.2.0)
71
- rspec-support (3.2.1)
72
- safe_yaml (1.0.4)
73
- slop (3.6.0)
74
- thread_safe (0.3.4)
62
+ json (1.8.3)
63
+ loofah (2.0.3)
64
+ nokogiri (>= 1.5.9)
65
+ mail (2.6.4)
66
+ mime-types (>= 1.16, < 4)
67
+ mime-types (3.1)
68
+ mime-types-data (~> 3.2015)
69
+ mime-types-data (3.2016.0521)
70
+ mini_portile2 (2.1.0)
71
+ minitest (5.9.1)
72
+ nokogiri (1.6.8.1)
73
+ mini_portile2 (~> 2.1.0)
74
+ rack (1.6.4)
75
+ rack-test (0.6.3)
76
+ rack (>= 1.0)
77
+ rails (4.2.7.1)
78
+ actionmailer (= 4.2.7.1)
79
+ actionpack (= 4.2.7.1)
80
+ actionview (= 4.2.7.1)
81
+ activejob (= 4.2.7.1)
82
+ activemodel (= 4.2.7.1)
83
+ activerecord (= 4.2.7.1)
84
+ activesupport (= 4.2.7.1)
85
+ bundler (>= 1.3.0, < 2.0)
86
+ railties (= 4.2.7.1)
87
+ sprockets-rails
88
+ rails-deprecated_sanitizer (1.0.3)
89
+ activesupport (>= 4.2.0.alpha)
90
+ rails-dom-testing (1.0.7)
91
+ activesupport (>= 4.2.0.beta, < 5.0)
92
+ nokogiri (~> 1.6.0)
93
+ rails-deprecated_sanitizer (>= 1.0.1)
94
+ rails-html-sanitizer (1.0.3)
95
+ loofah (~> 2.0)
96
+ rails-observers (0.1.2)
97
+ activemodel (~> 4.0)
98
+ railties (4.2.7.1)
99
+ actionpack (= 4.2.7.1)
100
+ activesupport (= 4.2.7.1)
101
+ rake (>= 0.8.7)
102
+ thor (>= 0.18.1, < 2.0)
103
+ rake (11.3.0)
104
+ request_store (1.3.1)
105
+ sprockets (3.7.0)
106
+ concurrent-ruby (~> 1.0)
107
+ rack (> 1, < 3)
108
+ sprockets-rails (3.2.0)
109
+ actionpack (>= 4.0)
110
+ activesupport (>= 4.0)
111
+ sprockets (>= 3.0.0)
112
+ thor (0.19.1)
113
+ thread_safe (0.3.5)
75
114
  tzinfo (1.2.2)
76
115
  thread_safe (~> 0.1)
77
- webmock (1.20.4)
78
- addressable (>= 2.3.6)
79
- crack (>= 0.3.2)
80
116
 
81
117
  PLATFORMS
82
118
  ruby
83
119
 
84
120
  DEPENDENCIES
121
+ audited-timeline!
85
122
  bundler (~> 1.6)
86
- customer-client!
87
- pry
88
- pry-debugger
89
- rake
90
- rest-in-peace!
91
- rspec
123
+
124
+ BUNDLED WITH
125
+ 1.12.5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -1,8 +1,12 @@
1
+ .audited-timeline-list .audited-timeline-wrapper:first-child {
2
+ margin-top: 0;
3
+ }
4
+
1
5
  .audited-timeline-wrapper {
2
- position: relative;
3
- padding: 2px 0px 2px 64px;
4
- margin-top: $base-spacing;
5
6
  margin-bottom: $base-spacing;
7
+ margin-top: $base-spacing;
8
+ padding: 2px 0px 2px;
9
+ position: relative;
6
10
 
7
11
  &:first-child {
8
12
  margin-top: 0;
@@ -13,37 +17,44 @@
13
17
  margin-left: -64px;
14
18
  border-radius: $base-border-radius;
15
19
  }
20
+
21
+ .with-avatars {
22
+ padding-left: 64px;
23
+ }
16
24
  }
17
25
 
18
- .audited-timeline-item {
26
+ .audited-timeline-wrapper .with-avatars .audited-timeline-item {
19
27
  position: relative;
20
- border: $base-border;
21
- border-radius: $base-border-radius;
22
28
 
23
29
  &:before, &:after {
24
- position: absolute;
25
- top: 11px;
30
+ border-color: transparent;
31
+ border-style: solid solid outset;
32
+ content: ' ';
33
+ display: block;
34
+ height: 0;
26
35
  left: -16px;
36
+ position: absolute;
27
37
  right: 100%;
38
+ top: 11px;
28
39
  width: 0;
29
- height: 0;
30
- display: block;
31
- content: " ";
32
- border-color: transparent;
33
- border-style: solid solid outset;
34
40
  }
35
41
 
36
42
  &:before {
37
- border-width: 8px;
38
43
  border-right-color: $base-border-color;
44
+ border-width: 8px;
39
45
  }
40
46
 
41
47
  &:after {
42
48
  border-right-color: #f2f8fa;
43
49
  border-width: 7px;
44
- margin-top: 1px;
45
50
  margin-left: 2px;
51
+ margin-top: 1px;
46
52
  }
53
+ }
54
+
55
+ .audited-timeline-item {
56
+ border: $base-border;
57
+ border-radius: $base-border-radius;
47
58
 
48
59
  &:hover .audited-timeline-header .audited-timeline-actions {
49
60
  visibility: visible;
@@ -51,20 +62,22 @@
51
62
  }
52
63
 
53
64
  .audited-timeline-header {
54
- padding: $base-spacing/3 $base-spacing/1.5;
55
65
  background-color: lighten($light-gray, 15%);
56
66
  border-bottom: 1px solid #eee;
57
67
  border-top-left-radius: $base-border-radius;
58
68
  border-top-right-radius: $base-border-radius;
69
+ padding: $base-spacing/3 $base-spacing/1.5;
59
70
 
60
71
  .audited-timeline-user {
61
72
  font-weight: bold;
62
73
  margin-right: 0.5em;
63
74
  }
75
+
64
76
  .audited-timeline-date {
65
77
  color: $dark-gray;
66
78
  font-size: 0.8em;
67
79
  }
80
+
68
81
  .audited-timeline-actions {
69
82
  float: right;
70
83
  visibility: hidden;
@@ -73,8 +86,8 @@
73
86
  }
74
87
  }
75
88
 
76
-
77
89
  .audited-timeline-body {
90
+ background: #fff;
78
91
  padding: $base-spacing/1.5;
79
92
 
80
93
  p {
@@ -83,8 +96,8 @@
83
96
 
84
97
  form.simple_form {
85
98
  float: none;
86
- width: 100%;
87
99
  margin: 0;
100
+ width: 100%;
88
101
  }
89
102
 
90
103
  table {
@@ -94,20 +107,29 @@
94
107
  padding: 0 0 .25em;
95
108
  }
96
109
 
110
+ th:first-child {
111
+ width: 12em;
112
+ }
113
+
97
114
  td {
98
- padding: .25em 0;
99
115
  font-size: .9em;
116
+ padding: .25em 0;
100
117
  }
101
118
 
102
119
  tr:last-child td {
103
- border-bottom: none;
120
+ border-bottom: 0;
121
+ }
122
+
123
+ tr th:first-child,
124
+ tr td:first-child {
125
+ white-space: nowrap;
104
126
  }
105
127
  }
106
128
 
107
129
  h1 {
108
130
  font-size: 1.2em;
131
+ height: auto !important;
109
132
  margin: 0 0 .5em;
110
133
  padding: 0;
111
- height: auto !important;
112
134
  }
113
135
  }
@@ -1,11 +1,15 @@
1
1
  <%= cache [audit, :diff] do %>
2
- <h1><%= audit.auditable_type.constantize.model_name.human %></h1>
2
+ <h1><%= audit.audited_title %></h1>
3
3
  <table class="diff">
4
4
  <thead>
5
5
  <tr>
6
6
  <th><%= t '.attribute' %></th>
7
- <th><%= t '.from' %></th>
8
- <th><%= t '.to' %></th>
7
+ <% if audit.action == 'update' %>
8
+ <th><%= t '.from' %></th>
9
+ <th><%= t '.to' %></th>
10
+ <% else %>
11
+ <th><%= t '.value' %></th>
12
+ <% end %>
9
13
  </tr>
10
14
  </thead>
11
15
  <tbody>
@@ -1,2 +1 @@
1
- <td></td>
2
1
  <td><%= value[0] %></td>
@@ -1,2 +1 @@
1
1
  <td><%= value[0] %></td>
2
- <td></td>
@@ -1,29 +1,33 @@
1
- <% audits.reorder('created_at desc').limit(10).decorate.each do |audit| %>
2
- <div id="<%= dom_id audit %>" class="audited-timeline-wrapper">
3
- <% if audit.user.present? %>
4
- <%= audited_timeline_user_gravatar audit.user %>
5
- <% end %>
1
+ <% with_avatars = local_assigns[:with_avatars] == true ? true : false %>
2
+ <% sort = local_assigns[:sort] || 'desc' %>
3
+ <div class="audited-timeline-list">
4
+ <% audits.reorder("created_at #{sort}").limit(10).decorate.each do |audit| %>
5
+ <div id="<%= dom_id audit %>" class="audited-timeline-wrapper <%= 'with-avatars' if with_avatars == true %> ">
6
+ <% if with_avatars == true && audit.user.present? %>
7
+ <%= audited_timeline_user_gravatar audit.user %>
8
+ <% end %>
6
9
 
7
- <div class="audited-timeline-item audited-timeline-audit <%= audit.action %>">
8
- <div class="audited-timeline-header">
9
- <span class="audited-timeline-user">
10
- <%= audit.user %>
11
- <%= audited_timeline_action_icon audit %>
12
- </span>
13
- <span class="audited-timeline-date">
14
- <%= l audit.created_at, format: :audited_timeline %>
15
- </span>
16
- </div>
17
- <div class="audited-timeline-body">
18
- <% if lookup_context.template_exists?(audited_timeline_partial_for(audit), [], true) %>
19
- <%= render audited_timeline_partial_for(audit), audit: audit %>
20
- <% else %>
21
- <% if Rails.env.development? %>
22
- <!-- create partial <%= audited_timeline_partial_for(audit) %> to override this table -->
10
+ <div class="audited-timeline-item audited-timeline-audit <%= audit.action %>">
11
+ <div class="audited-timeline-header">
12
+ <span class="audited-timeline-user">
13
+ <%= audit.user %>
14
+ <%= audited_timeline_action_icon audit %>
15
+ </span>
16
+ <span class="audited-timeline-date">
17
+ <%= l audit.created_at, format: :audited_timeline %>
18
+ </span>
19
+ </div>
20
+ <div class="audited-timeline-body">
21
+ <% if lookup_context.template_exists?(audited_timeline_partial_for(audit), [], true) %>
22
+ <%= render audited_timeline_partial_for(audit), audit: audit %>
23
+ <% else %>
24
+ <% if Rails.env.development? %>
25
+ <!-- create partial <%= audited_timeline_partial_for(audit) %> to override this table -->
26
+ <% end %>
27
+ <%= render 'audited_timeline/diff', audit: audit %>
23
28
  <% end %>
24
- <%= render 'audited_timeline/diff', audit: audit %>
25
- <% end %>
29
+ </div>
26
30
  </div>
27
31
  </div>
28
- </div>
29
- <% end %>
32
+ <% end %>
33
+ </div>
@@ -6,8 +6,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'audited-timeline'
8
8
  spec.version = File.read(File.expand_path('../VERSION', __FILE__)).strip
9
- spec.authors = ['Raffael Schmid']
10
- spec.email = ['raffael.schmid@nine.ch']
9
+ spec.authors = ['nine.ch Development']
10
+ spec.email = ['development@nine.ch']
11
11
  spec.summary = %q{Frontent to audited}
12
12
  spec.homepage = 'https://github.com/ninech/audited-timeline'
13
13
  spec.license = 'MIT'
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.6'
22
22
 
23
- spec.add_runtime_dependency 'audited', '>= 4.2.0', '< 5.0.0'
24
- spec.add_runtime_dependency 'rails', '>= 4.0.0', '< 5.0.0'
25
- spec.add_runtime_dependency 'draper', '>= 2.1.0', '< 3.0.0'
23
+ spec.add_runtime_dependency 'audited', '>= 4.2.0'
24
+ spec.add_runtime_dependency 'rails', '>= 4.0.0'
25
+ spec.add_runtime_dependency 'draper', '>= 2.1.0'
26
26
  end
@@ -5,6 +5,7 @@ de:
5
5
  attribute: Attribut
6
6
  from: Bisher
7
7
  to: Neu
8
+ value: Wert
8
9
  'yes': Ja
9
10
  'no': Nein
10
11
  time:
@@ -5,6 +5,7 @@ en:
5
5
  attribute: Attribute
6
6
  from: Old
7
7
  to: New
8
+ value: Value
8
9
  'yes': Yes
9
10
  'no': No
10
11
  time:
@@ -3,15 +3,6 @@ require 'draper'
3
3
  module AuditedTimeline
4
4
  class AuditDecorator < ::Draper::Decorator
5
5
  delegate_all
6
- delegate :fullname, to: :user, allow_nil: true, prefix: true
7
-
8
- def audited_contact
9
- Contact.unscoped.find(object.audited_changes['contact_id'])
10
- end
11
-
12
- def audited_role
13
- AccountContact.roles.key(object.audited_changes['role'])
14
- end
15
6
 
16
7
  def human_audited_changes
17
8
  human_changes = {}
@@ -26,6 +17,13 @@ module AuditedTimeline
26
17
  human_changes
27
18
  end
28
19
 
20
+ def audited_title
21
+ [
22
+ auditable_type.constantize.model_name.human,
23
+ object_name_by_type_and_value(auditable_type, auditable_id)
24
+ ].join(' ')
25
+ end
26
+
29
27
  private
30
28
 
31
29
  def human_value(field, value)
@@ -47,6 +45,15 @@ module AuditedTimeline
47
45
  end
48
46
  end
49
47
 
48
+ def object_name_by_type_and_value(type, value)
49
+ return nil unless value
50
+ begin
51
+ type.constantize.unscoped.find(value)
52
+ rescue
53
+ nil
54
+ end
55
+ end
56
+
50
57
  def enum_value(field, value)
51
58
  if value.kind_of?(Integer)
52
59
  enum_values(field).key(value)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audited-timeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
- - Raffael Schmid
7
+ - nine.ch Development
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2016-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -31,9 +31,6 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 4.2.0
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: 5.0.0
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,9 +38,6 @@ dependencies:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
40
  version: 4.2.0
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: 5.0.0
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: rails
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -51,9 +45,6 @@ dependencies:
51
45
  - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: 4.0.0
54
- - - "<"
55
- - !ruby/object:Gem::Version
56
- version: 5.0.0
57
48
  type: :runtime
58
49
  prerelease: false
59
50
  version_requirements: !ruby/object:Gem::Requirement
@@ -61,9 +52,6 @@ dependencies:
61
52
  - - ">="
62
53
  - !ruby/object:Gem::Version
63
54
  version: 4.0.0
64
- - - "<"
65
- - !ruby/object:Gem::Version
66
- version: 5.0.0
67
55
  - !ruby/object:Gem::Dependency
68
56
  name: draper
69
57
  requirement: !ruby/object:Gem::Requirement
@@ -71,9 +59,6 @@ dependencies:
71
59
  - - ">="
72
60
  - !ruby/object:Gem::Version
73
61
  version: 2.1.0
74
- - - "<"
75
- - !ruby/object:Gem::Version
76
- version: 3.0.0
77
62
  type: :runtime
78
63
  prerelease: false
79
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -81,12 +66,9 @@ dependencies:
81
66
  - - ">="
82
67
  - !ruby/object:Gem::Version
83
68
  version: 2.1.0
84
- - - "<"
85
- - !ruby/object:Gem::Version
86
- version: 3.0.0
87
69
  description: audited-timeline provides timeline frontend to audited
88
70
  email:
89
- - raffael.schmid@nine.ch
71
+ - development@nine.ch
90
72
  executables: []
91
73
  extensions: []
92
74
  extra_rdoc_files: []
@@ -143,4 +125,3 @@ signing_key:
143
125
  specification_version: 4
144
126
  summary: Frontent to audited
145
127
  test_files: []
146
- has_rdoc: