paper_trail_manager 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/Gemfile.lock +0 -2
- data/VERSION +1 -1
- data/app/views/paper_trail_manager/changes/_version.html.erb +36 -0
- data/app/views/paper_trail_manager/changes/index.html.erb +35 -0
- data/app/views/paper_trail_manager/changes/show.html.erb +10 -0
- data/paper_trail_manager.gemspec +5 -8
- metadata +27 -42
- data/app/views/paper_trail_manager/changes/_version.html.haml +0 -32
- data/app/views/paper_trail_manager/changes/index.html.haml +0 -26
- data/app/views/paper_trail_manager/changes/show.html.haml +0 -8
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -54,7 +54,6 @@ GEM
|
|
54
54
|
ffi (1.0.7)
|
55
55
|
rake (>= 0.8.7)
|
56
56
|
git (1.2.5)
|
57
|
-
haml (3.1.2)
|
58
57
|
i18n (0.5.0)
|
59
58
|
jeweler (1.5.2)
|
60
59
|
bundler (~> 1.0.0)
|
@@ -135,7 +134,6 @@ PLATFORMS
|
|
135
134
|
DEPENDENCIES
|
136
135
|
capybara (>= 0.4.0)
|
137
136
|
factory_girl_rails (~> 1.1.beta1)
|
138
|
-
haml (~> 3.0)
|
139
137
|
jeweler (~> 1.5.2)
|
140
138
|
paper_trail (~> 2.0)
|
141
139
|
rails (~> 3.0)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<tr class='change_row <%= "#{version.event}, #{version.item_type.downcase}" %>'>
|
2
|
+
<td class='change_time'>
|
3
|
+
<span class='change_id'>Change #<%= version.id %></span>
|
4
|
+
<div class='date'> <%= version.created_at.strftime('%Y-%m-%d') %> </div>
|
5
|
+
<div class='time'> <%= version.created_at.strftime('%H:%M:%S') %> </div>
|
6
|
+
</td>
|
7
|
+
<td class='change_details'>
|
8
|
+
<p class='change_details_description'>
|
9
|
+
<strong class='event'><%= version.event %></strong>
|
10
|
+
<span class='item_type'><%= version.item_type %></span>
|
11
|
+
<span class='item_id'><%= version.item_id %></span>
|
12
|
+
<%= change_item_link(version) %>
|
13
|
+
<% if PaperTrailManager.whodunnit_class && version.whodunnit %>
|
14
|
+
<% if user = PaperTrailManager.whodunnit_class.find(version.whodunnit) rescue nil %>
|
15
|
+
by <%= link_to(h(user.send(PaperTrailManager.whodunnit_name_method)), user_path(user)) %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
<% if change_revert_allowed?(version) %>
|
19
|
+
<%= link_to 'Roll back', change_path(version), :method => 'put', :confirm => 'Are you sure?', :class => 'rollback' %>
|
20
|
+
<% end %>
|
21
|
+
</p>
|
22
|
+
<% if version.event == 'update' or version.event == 'create' %>
|
23
|
+
<% changes = changes_for(version) %>
|
24
|
+
<table class='change_details_table'>
|
25
|
+
<% changes.keys.sort.each_with_index do |key, i| %>
|
26
|
+
<tr class='<%= i%2==0 ? 'even' : 'odd' %>'>
|
27
|
+
<td class='change_detail_key previous'><%= key %></td>
|
28
|
+
<td class='change_detail_value previous'><%= text_or_nil(changes[key][:previous]) %></td>
|
29
|
+
<td class='change_detail_spacer'> → </td>
|
30
|
+
<td class='change_detail_value current'><%= text_or_nil(changes[key][:current]) %></td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
</table>
|
34
|
+
<% end %>
|
35
|
+
</td>
|
36
|
+
</tr>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<h1>Changes</h1>
|
2
|
+
|
3
|
+
<p class='changes_feed'><%= link_to 'Changes feed', changes_path(:format => 'atom') %></p>
|
4
|
+
|
5
|
+
<p>
|
6
|
+
Show:
|
7
|
+
<%= ([link_to('All', changes_path)] + change_item_types.map { |type| link_to(type.pluralize, changes_path(:type => type)) }).join(' | ').html_safe %>
|
8
|
+
</p>
|
9
|
+
|
10
|
+
<table class='changes_table'>
|
11
|
+
<tfoot>
|
12
|
+
<tr>
|
13
|
+
<td colspan='2'>
|
14
|
+
<%= will_paginate @versions %>
|
15
|
+
</td>
|
16
|
+
</tr>
|
17
|
+
</tfoot>
|
18
|
+
<thead>
|
19
|
+
<tr class='changes_header'>
|
20
|
+
<th class='change_time'>Time</th>
|
21
|
+
<th class='change_details'>Attribute with previous and current values</th>
|
22
|
+
</tr>
|
23
|
+
</thead>
|
24
|
+
<tbody>
|
25
|
+
<% if @versions.any? %>
|
26
|
+
<% @versions.each do |version| %>
|
27
|
+
<% next unless change_show_allowed?(version) %>
|
28
|
+
<%= render :partial => 'version', :object => version %>
|
29
|
+
<% end %>
|
30
|
+
<% else %>
|
31
|
+
<td rowspan='2'> — No changes found — </td>
|
32
|
+
<% end %>
|
33
|
+
</tbody>
|
34
|
+
</table>
|
35
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<h1>Change <%= @version.id %></h1>
|
2
|
+
|
3
|
+
<table class='changes_table'>
|
4
|
+
<tr class='changes_header'>
|
5
|
+
<th class='change_time'>Time</th>
|
6
|
+
<th class='change_details'>Attribute with previous and current values</th>
|
7
|
+
<%= render :partial => 'version', :object => @version %>
|
8
|
+
</tr>
|
9
|
+
</table>
|
10
|
+
|
data/paper_trail_manager.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{paper_trail_manager}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Igal Koshevoy"]
|
12
|
-
s.date = %q{2011-07-
|
12
|
+
s.date = %q{2011-07-18}
|
13
13
|
s.description = %q{A user interface for `paper_trail` versioning data in Ruby on Rails 3 applications.}
|
14
14
|
s.email = %q{igal@pragmaticraft.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -25,10 +25,10 @@ Gem::Specification.new do |s|
|
|
25
25
|
"VERSION",
|
26
26
|
"app/controllers/paper_trail_manager/changes_controller.rb",
|
27
27
|
"app/helpers/paper_trail_manager/changes_helper.rb",
|
28
|
-
"app/views/paper_trail_manager/changes/_version.html.
|
28
|
+
"app/views/paper_trail_manager/changes/_version.html.erb",
|
29
29
|
"app/views/paper_trail_manager/changes/index.atom.builder",
|
30
|
-
"app/views/paper_trail_manager/changes/index.html.
|
31
|
-
"app/views/paper_trail_manager/changes/show.html.
|
30
|
+
"app/views/paper_trail_manager/changes/index.html.erb",
|
31
|
+
"app/views/paper_trail_manager/changes/show.html.erb",
|
32
32
|
"lib/paper_trail_manager.rb",
|
33
33
|
"paper_trail_manager.gemspec",
|
34
34
|
"spec/controllers/paper_trail_manager/changes_controller_spec.rb",
|
@@ -166,7 +166,6 @@ Gem::Specification.new do |s|
|
|
166
166
|
|
167
167
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
168
168
|
s.add_runtime_dependency(%q<rails>, ["~> 3.0"])
|
169
|
-
s.add_runtime_dependency(%q<haml>, ["~> 3.0"])
|
170
169
|
s.add_runtime_dependency(%q<paper_trail>, ["~> 2.0"])
|
171
170
|
s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
|
172
171
|
s.add_development_dependency(%q<capybara>, [">= 0.4.0"])
|
@@ -179,7 +178,6 @@ Gem::Specification.new do |s|
|
|
179
178
|
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
|
180
179
|
else
|
181
180
|
s.add_dependency(%q<rails>, ["~> 3.0"])
|
182
|
-
s.add_dependency(%q<haml>, ["~> 3.0"])
|
183
181
|
s.add_dependency(%q<paper_trail>, ["~> 2.0"])
|
184
182
|
s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
|
185
183
|
s.add_dependency(%q<capybara>, [">= 0.4.0"])
|
@@ -193,7 +191,6 @@ Gem::Specification.new do |s|
|
|
193
191
|
end
|
194
192
|
else
|
195
193
|
s.add_dependency(%q<rails>, ["~> 3.0"])
|
196
|
-
s.add_dependency(%q<haml>, ["~> 3.0"])
|
197
194
|
s.add_dependency(%q<paper_trail>, ["~> 2.0"])
|
198
195
|
s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
|
199
196
|
s.add_dependency(%q<capybara>, [">= 0.4.0"])
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paper_trail_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igal Koshevoy
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-18 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -33,25 +33,10 @@ dependencies:
|
|
33
33
|
version: "3.0"
|
34
34
|
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: haml
|
38
|
-
prerelease: false
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 7
|
45
|
-
segments:
|
46
|
-
- 3
|
47
|
-
- 0
|
48
|
-
version: "3.0"
|
49
|
-
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
36
|
- !ruby/object:Gem::Dependency
|
52
37
|
name: paper_trail
|
53
38
|
prerelease: false
|
54
|
-
requirement: &
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
55
40
|
none: false
|
56
41
|
requirements:
|
57
42
|
- - ~>
|
@@ -62,11 +47,11 @@ dependencies:
|
|
62
47
|
- 0
|
63
48
|
version: "2.0"
|
64
49
|
type: :runtime
|
65
|
-
version_requirements: *
|
50
|
+
version_requirements: *id002
|
66
51
|
- !ruby/object:Gem::Dependency
|
67
52
|
name: will_paginate
|
68
53
|
prerelease: false
|
69
|
-
requirement: &
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
70
55
|
none: false
|
71
56
|
requirements:
|
72
57
|
- - ~>
|
@@ -79,11 +64,11 @@ dependencies:
|
|
79
64
|
- 2
|
80
65
|
version: 3.0.pre2
|
81
66
|
type: :runtime
|
82
|
-
version_requirements: *
|
67
|
+
version_requirements: *id003
|
83
68
|
- !ruby/object:Gem::Dependency
|
84
69
|
name: capybara
|
85
70
|
prerelease: false
|
86
|
-
requirement: &
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
87
72
|
none: false
|
88
73
|
requirements:
|
89
74
|
- - ">="
|
@@ -95,11 +80,11 @@ dependencies:
|
|
95
80
|
- 0
|
96
81
|
version: 0.4.0
|
97
82
|
type: :development
|
98
|
-
version_requirements: *
|
83
|
+
version_requirements: *id004
|
99
84
|
- !ruby/object:Gem::Dependency
|
100
85
|
name: factory_girl_rails
|
101
86
|
prerelease: false
|
102
|
-
requirement: &
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
103
88
|
none: false
|
104
89
|
requirements:
|
105
90
|
- - ~>
|
@@ -112,11 +97,11 @@ dependencies:
|
|
112
97
|
- 1
|
113
98
|
version: 1.1.beta1
|
114
99
|
type: :development
|
115
|
-
version_requirements: *
|
100
|
+
version_requirements: *id005
|
116
101
|
- !ruby/object:Gem::Dependency
|
117
102
|
name: jeweler
|
118
103
|
prerelease: false
|
119
|
-
requirement: &
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
120
105
|
none: false
|
121
106
|
requirements:
|
122
107
|
- - ~>
|
@@ -128,11 +113,11 @@ dependencies:
|
|
128
113
|
- 2
|
129
114
|
version: 1.5.2
|
130
115
|
type: :development
|
131
|
-
version_requirements: *
|
116
|
+
version_requirements: *id006
|
132
117
|
- !ruby/object:Gem::Dependency
|
133
118
|
name: rdoc
|
134
119
|
prerelease: false
|
135
|
-
requirement: &
|
120
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
136
121
|
none: false
|
137
122
|
requirements:
|
138
123
|
- - ">="
|
@@ -142,11 +127,11 @@ dependencies:
|
|
142
127
|
- 0
|
143
128
|
version: "0"
|
144
129
|
type: :development
|
145
|
-
version_requirements: *
|
130
|
+
version_requirements: *id007
|
146
131
|
- !ruby/object:Gem::Dependency
|
147
132
|
name: rspec-rails
|
148
133
|
prerelease: false
|
149
|
-
requirement: &
|
134
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
150
135
|
none: false
|
151
136
|
requirements:
|
152
137
|
- - ~>
|
@@ -158,11 +143,11 @@ dependencies:
|
|
158
143
|
- 0
|
159
144
|
version: 2.5.0
|
160
145
|
type: :development
|
161
|
-
version_requirements: *
|
146
|
+
version_requirements: *id008
|
162
147
|
- !ruby/object:Gem::Dependency
|
163
148
|
name: ruby-debug
|
164
149
|
prerelease: false
|
165
|
-
requirement: &
|
150
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
166
151
|
none: false
|
167
152
|
requirements:
|
168
153
|
- - ">="
|
@@ -172,11 +157,11 @@ dependencies:
|
|
172
157
|
- 0
|
173
158
|
version: "0"
|
174
159
|
type: :development
|
175
|
-
version_requirements: *
|
160
|
+
version_requirements: *id009
|
176
161
|
- !ruby/object:Gem::Dependency
|
177
162
|
name: spork
|
178
163
|
prerelease: false
|
179
|
-
requirement: &
|
164
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
180
165
|
none: false
|
181
166
|
requirements:
|
182
167
|
- - ~>
|
@@ -189,11 +174,11 @@ dependencies:
|
|
189
174
|
- rc
|
190
175
|
version: 0.9.0.rc
|
191
176
|
type: :development
|
192
|
-
version_requirements: *
|
177
|
+
version_requirements: *id010
|
193
178
|
- !ruby/object:Gem::Dependency
|
194
179
|
name: sqlite3-ruby
|
195
180
|
prerelease: false
|
196
|
-
requirement: &
|
181
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
197
182
|
none: false
|
198
183
|
requirements:
|
199
184
|
- - ">="
|
@@ -203,7 +188,7 @@ dependencies:
|
|
203
188
|
- 0
|
204
189
|
version: "0"
|
205
190
|
type: :development
|
206
|
-
version_requirements: *
|
191
|
+
version_requirements: *id011
|
207
192
|
description: A user interface for `paper_trail` versioning data in Ruby on Rails 3 applications.
|
208
193
|
email: igal@pragmaticraft.com
|
209
194
|
executables: []
|
@@ -222,10 +207,10 @@ files:
|
|
222
207
|
- VERSION
|
223
208
|
- app/controllers/paper_trail_manager/changes_controller.rb
|
224
209
|
- app/helpers/paper_trail_manager/changes_helper.rb
|
225
|
-
- app/views/paper_trail_manager/changes/_version.html.
|
210
|
+
- app/views/paper_trail_manager/changes/_version.html.erb
|
226
211
|
- app/views/paper_trail_manager/changes/index.atom.builder
|
227
|
-
- app/views/paper_trail_manager/changes/index.html.
|
228
|
-
- app/views/paper_trail_manager/changes/show.html.
|
212
|
+
- app/views/paper_trail_manager/changes/index.html.erb
|
213
|
+
- app/views/paper_trail_manager/changes/show.html.erb
|
229
214
|
- lib/paper_trail_manager.rb
|
230
215
|
- paper_trail_manager.gemspec
|
231
216
|
- spec/controllers/paper_trail_manager/changes_controller_spec.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
%tr.change_row{:class => [version.event, version.item_type.downcase]}
|
2
|
-
%td.change_time
|
3
|
-
%span.change_id== Change ##{version.id}
|
4
|
-
.date
|
5
|
-
= version.created_at.strftime('%Y-%m-%d')
|
6
|
-
.time
|
7
|
-
= version.created_at.strftime('%H:%M:%S')
|
8
|
-
%td.change_details
|
9
|
-
%p.change_details_description
|
10
|
-
%strong.event= version.event
|
11
|
-
%span.item_type= version.item_type
|
12
|
-
%span.item_id== ##{version.item_id}
|
13
|
-
= change_item_link(version)
|
14
|
-
- if PaperTrailManager.whodunnit_class
|
15
|
-
- if version.whodunnit
|
16
|
-
- if user = PaperTrailManager.whodunnit_class.find(version.whodunnit) rescue nil
|
17
|
-
by
|
18
|
-
= link_to(h(user.send(PaperTrailManager.whodunnit_name_method)), user_path(user))
|
19
|
-
- if change_revert_allowed?(version)
|
20
|
-
= link_to 'Roll back', change_path(version), :method => 'put', :confirm => 'Are you sure?', :class => 'rollback'
|
21
|
-
|
22
|
-
|
23
|
-
- if version.event == 'update' or version.event == 'create'
|
24
|
-
- changes = changes_for(version)
|
25
|
-
%table.change_details_table
|
26
|
-
- changes.keys.sort.each do |key|
|
27
|
-
%tr{:class => cycle('odd', 'even')}
|
28
|
-
%td.change_detail_key.previous= key
|
29
|
-
%td.change_detail_value.previous= text_or_nil(changes[key][:previous])
|
30
|
-
%td.change_detail_spacer →
|
31
|
-
%td.change_detail_value.current= text_or_nil(changes[key][:current])
|
32
|
-
- reset_cycle('change_detail')
|
@@ -1,26 +0,0 @@
|
|
1
|
-
%h1 Changes
|
2
|
-
|
3
|
-
%p.changes_feed
|
4
|
-
= link_to 'Changes feed', changes_path(:format => 'atom')
|
5
|
-
|
6
|
-
%p
|
7
|
-
Show:
|
8
|
-
!= ([link_to('All', changes_path)] + change_item_types.map { |type| link_to(type.pluralize, changes_path(:type => type)) }).join(' | ')
|
9
|
-
|
10
|
-
%table.changes_table
|
11
|
-
%tfoot
|
12
|
-
%tr
|
13
|
-
%td{:colspan => 2}
|
14
|
-
= will_paginate @versions
|
15
|
-
%thead
|
16
|
-
%tr.changes_header
|
17
|
-
%th.change_time Time
|
18
|
-
%th.change_details Attribute with previous and current values
|
19
|
-
%tbody
|
20
|
-
- if @versions.any?
|
21
|
-
- @versions.each do |version|
|
22
|
-
- next unless change_show_allowed?(version)
|
23
|
-
= render :partial => 'version', :object => version
|
24
|
-
- else
|
25
|
-
%td{:rowspan => 2}
|
26
|
-
— No changes found —
|