paper_trail_manager 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/Gemfile +17 -0
  2. data/Gemfile.lock +147 -0
  3. data/LICENSE.txt +20 -0
  4. data/README.md +32 -0
  5. data/Rakefile +52 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/paper_trail_manager/changes_controller.rb +109 -0
  8. data/app/helpers/paper_trail_manager/changes_helper.rb +99 -0
  9. data/app/views/paper_trail_manager/changes/_version.html.haml +32 -0
  10. data/app/views/paper_trail_manager/changes/index.atom.builder +44 -0
  11. data/app/views/paper_trail_manager/changes/index.html.haml +26 -0
  12. data/app/views/paper_trail_manager/changes/show.html.haml +8 -0
  13. data/lib/paper_trail_manager.rb +70 -0
  14. data/paper_trail_manager.gemspec +209 -0
  15. data/spec/controllers/paper_trail_manager/changes_controller_spec.rb +8 -0
  16. data/spec/dummy/Rakefile +7 -0
  17. data/spec/dummy/app/controllers/application_controller.rb +7 -0
  18. data/spec/dummy/app/controllers/entities_controller.rb +83 -0
  19. data/spec/dummy/app/controllers/platforms_controller.rb +83 -0
  20. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  21. data/spec/dummy/app/helpers/entities_helper.rb +2 -0
  22. data/spec/dummy/app/helpers/platforms_helper.rb +2 -0
  23. data/spec/dummy/app/models/entity.rb +6 -0
  24. data/spec/dummy/app/models/platform.rb +6 -0
  25. data/spec/dummy/app/views/entities/_form.html.erb +17 -0
  26. data/spec/dummy/app/views/entities/edit.html.erb +6 -0
  27. data/spec/dummy/app/views/entities/index.html.erb +21 -0
  28. data/spec/dummy/app/views/entities/new.html.erb +5 -0
  29. data/spec/dummy/app/views/entities/show.html.erb +5 -0
  30. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  31. data/spec/dummy/app/views/platforms/_form.html.erb +17 -0
  32. data/spec/dummy/app/views/platforms/edit.html.erb +6 -0
  33. data/spec/dummy/app/views/platforms/index.html.erb +21 -0
  34. data/spec/dummy/app/views/platforms/new.html.erb +5 -0
  35. data/spec/dummy/app/views/platforms/show.html.erb +5 -0
  36. data/spec/dummy/config.ru +4 -0
  37. data/spec/dummy/config/application.rb +45 -0
  38. data/spec/dummy/config/boot.rb +10 -0
  39. data/spec/dummy/config/database.yml +22 -0
  40. data/spec/dummy/config/environment.rb +5 -0
  41. data/spec/dummy/config/environments/development.rb +26 -0
  42. data/spec/dummy/config/environments/production.rb +49 -0
  43. data/spec/dummy/config/environments/test.rb +35 -0
  44. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  45. data/spec/dummy/config/initializers/inflections.rb +10 -0
  46. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  47. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  48. data/spec/dummy/config/initializers/session_store.rb +8 -0
  49. data/spec/dummy/config/locales/en.yml +5 -0
  50. data/spec/dummy/config/routes.rb +64 -0
  51. data/spec/dummy/db/migrate/20110228091428_create_entities.rb +14 -0
  52. data/spec/dummy/db/migrate/20110228093241_create_platforms.rb +14 -0
  53. data/spec/dummy/db/migrate/20110228094444_create_versions.rb +18 -0
  54. data/spec/dummy/db/schema.rb +40 -0
  55. data/spec/dummy/public/404.html +26 -0
  56. data/spec/dummy/public/422.html +26 -0
  57. data/spec/dummy/public/500.html +26 -0
  58. data/spec/dummy/public/favicon.ico +0 -0
  59. data/spec/dummy/public/javascripts/application.js +2 -0
  60. data/spec/dummy/public/javascripts/controls.js +965 -0
  61. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  62. data/spec/dummy/public/javascripts/effects.js +1123 -0
  63. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  64. data/spec/dummy/public/javascripts/rails.js +175 -0
  65. data/spec/dummy/script/rails +6 -0
  66. data/spec/dummy/spec/controllers/entities_controller_spec.rb +125 -0
  67. data/spec/dummy/spec/controllers/platforms_controller_spec.rb +125 -0
  68. data/spec/dummy/spec/helpers/entities_helper_spec.rb +15 -0
  69. data/spec/dummy/spec/helpers/platforms_helper_spec.rb +15 -0
  70. data/spec/dummy/spec/integration/navigation_spec.rb +9 -0
  71. data/spec/dummy/spec/integration/paper_trail_manager_spec.rb +194 -0
  72. data/spec/dummy/spec/models/entity_spec.rb +14 -0
  73. data/spec/dummy/spec/models/platform_spec.rb +14 -0
  74. data/spec/dummy/spec/requests/entities_spec.rb +11 -0
  75. data/spec/dummy/spec/requests/platforms_spec.rb +11 -0
  76. data/spec/dummy/spec/routing/entities_routing_spec.rb +35 -0
  77. data/spec/dummy/spec/routing/platforms_routing_spec.rb +35 -0
  78. data/spec/dummy/spec/views/entities/edit.html.erb_spec.rb +15 -0
  79. data/spec/dummy/spec/views/entities/index.html.erb_spec.rb +14 -0
  80. data/spec/dummy/spec/views/entities/new.html.erb_spec.rb +15 -0
  81. data/spec/dummy/spec/views/entities/show.html.erb_spec.rb +11 -0
  82. data/spec/dummy/spec/views/platforms/edit.html.erb_spec.rb +15 -0
  83. data/spec/dummy/spec/views/platforms/index.html.erb_spec.rb +14 -0
  84. data/spec/dummy/spec/views/platforms/new.html.erb_spec.rb +15 -0
  85. data/spec/dummy/spec/views/platforms/show.html.erb_spec.rb +11 -0
  86. data/spec/paper_trail_manager_spec.rb +7 -0
  87. data/spec/spec_helper.rb +82 -0
  88. data/spec/support/factories.rb +12 -0
  89. metadata +387 -0
@@ -0,0 +1,32 @@
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')
@@ -0,0 +1,44 @@
1
+ atom_feed do |feed|
2
+ feed.title("Changes")
3
+ date = @versions.first.try(:created_at) || Time.at(0)
4
+ feed.updated(date)
5
+
6
+ @versions.each do |version|
7
+ next unless change_show_allowed?(version)
8
+
9
+ feed.entry(version, :url => change_url(version)) do |entry|
10
+ changes = changes_for(version)
11
+
12
+ if PaperTrailManager.whodunnit_class && version.whodunnit
13
+ user = PaperTrailManager.whodunnit_class.find(version.whodunnit) rescue nil
14
+ else
15
+ user = nil
16
+ end
17
+
18
+ entry.title "#{version.event.upcase} #{version.item_type} «#{change_title_for(version)}» #{user ? 'by '+user.send(PaperTrailManager.whodunnit_name_method) : ''}"
19
+ entry.updated version.created_at.utc.xmlschema
20
+
21
+ xm = ::Builder::XmlMarkup.new
22
+ xm.div {
23
+ xm.p {
24
+ xm.span << 'Go to: '
25
+ xm.span << link_to('Change', change_url(version))
26
+ xm.span << ' | '
27
+ xm.span << link_to('Record', change_item_url(version))
28
+ }
29
+ xm.table {
30
+ changes.keys.sort.each do |key|
31
+ xm.tr {
32
+ xm.td { xm.b key }
33
+ xm.td changes[key][:previous].inspect
34
+ xm.td { xm.span << "&rarr;" }
35
+ xm.td changes[key][:current].inspect
36
+ }
37
+ end
38
+ }
39
+ }
40
+
41
+ entry.content(xm.to_s, :type => 'html')
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,26 @@
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
+ &mdash; No changes found &mdash;
@@ -0,0 +1,8 @@
1
+ %h1
2
+ == Change ##{@version.id}
3
+
4
+ %table.changes_table
5
+ %tr.changes_header
6
+ %th.change_time Time
7
+ %th.change_details Attribute with previous and current values
8
+ = render :partial => 'version', :object => @version
@@ -0,0 +1,70 @@
1
+ require 'rails'
2
+ require 'paper_trail'
3
+
4
+ # = PaperTrailManager
5
+ #
6
+ # == Example usage
7
+ #
8
+ # To specify when reverts are allowed, write an initializer similar to this:
9
+ #
10
+ # # config/initializers/paper_trail_manager.rb
11
+ # PaperTrailManager.allow_revert_when do |controller, version|
12
+ # controller.current_user and controller.current_user.admin?
13
+ # end
14
+ #
15
+ # To specify how to look up users/memebers/etc specified in Paper Trail's 'whodunnit' column:
16
+ #
17
+ # PaperTrailManager.whodunnit_class = User
18
+ # PaperTrailManager.whodunnit_name_method = :nicename # defaults to :name
19
+ #
20
+ class PaperTrailManager < Rails::Engine
21
+ @@whodunnit_name_method = :name
22
+ cattr_accessor :whodunnit_class, :whodunnit_name_method
23
+
24
+ (Pathname(__FILE__).dirname + '..').tap do |base|
25
+ paths.app.controllers = base + 'app/controllers'
26
+ paths.app.views = base + 'app/views'
27
+ end
28
+
29
+ def self._allow_set(action, block)
30
+ send(:class_variable_set, "@@allow_#{action}_block", block)
31
+ end
32
+
33
+ def self._allow_check(action, *args)
34
+ begin
35
+ block = send(:class_variable_get, "@@allow_#{action}_block")
36
+ rescue NameError => e
37
+ return true
38
+ end
39
+
40
+ return block.call(*args)
41
+ end
42
+
43
+ def self.allow_index_when(&block)
44
+ _allow_set(:index, block)
45
+ end
46
+
47
+ def self.allow_index?(controller)
48
+ _allow_check(:index, controller)
49
+ end
50
+
51
+ def self.allow_show_when(&block)
52
+ _allow_set(:show, block)
53
+ end
54
+
55
+ def self.allow_show?(controller, version)
56
+ _allow_check(:index, controller, version)
57
+ end
58
+
59
+ # Describe when to allow reverts. Call this with a block that accepts
60
+ # arguments for +controller+ and +version+.
61
+ def self.allow_revert_when(&block)
62
+ _allow_set(:revert, block)
63
+ end
64
+
65
+ # Allow revert given the +controller+ and +version+? If no
66
+ # ::allow_revert_when was specified, always return +true+.
67
+ def self.allow_revert?(controller, version)
68
+ _allow_check(:revert, controller, version)
69
+ end
70
+ end
@@ -0,0 +1,209 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{paper_trail_manager}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Igal Koshevoy"]
12
+ s.date = %q{2011-07-13}
13
+ s.description = %q{A user interface for `paper_trail` versioning data in Ruby on Rails 3 applications.}
14
+ s.email = %q{igal@pragmaticraft.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ "Gemfile",
21
+ "Gemfile.lock",
22
+ "LICENSE.txt",
23
+ "README.md",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "app/controllers/paper_trail_manager/changes_controller.rb",
27
+ "app/helpers/paper_trail_manager/changes_helper.rb",
28
+ "app/views/paper_trail_manager/changes/_version.html.haml",
29
+ "app/views/paper_trail_manager/changes/index.atom.builder",
30
+ "app/views/paper_trail_manager/changes/index.html.haml",
31
+ "app/views/paper_trail_manager/changes/show.html.haml",
32
+ "lib/paper_trail_manager.rb",
33
+ "paper_trail_manager.gemspec",
34
+ "spec/controllers/paper_trail_manager/changes_controller_spec.rb",
35
+ "spec/dummy/Rakefile",
36
+ "spec/dummy/app/controllers/application_controller.rb",
37
+ "spec/dummy/app/controllers/entities_controller.rb",
38
+ "spec/dummy/app/controllers/platforms_controller.rb",
39
+ "spec/dummy/app/helpers/application_helper.rb",
40
+ "spec/dummy/app/helpers/entities_helper.rb",
41
+ "spec/dummy/app/helpers/platforms_helper.rb",
42
+ "spec/dummy/app/models/entity.rb",
43
+ "spec/dummy/app/models/platform.rb",
44
+ "spec/dummy/app/views/entities/_form.html.erb",
45
+ "spec/dummy/app/views/entities/edit.html.erb",
46
+ "spec/dummy/app/views/entities/index.html.erb",
47
+ "spec/dummy/app/views/entities/new.html.erb",
48
+ "spec/dummy/app/views/entities/show.html.erb",
49
+ "spec/dummy/app/views/layouts/application.html.erb",
50
+ "spec/dummy/app/views/platforms/_form.html.erb",
51
+ "spec/dummy/app/views/platforms/edit.html.erb",
52
+ "spec/dummy/app/views/platforms/index.html.erb",
53
+ "spec/dummy/app/views/platforms/new.html.erb",
54
+ "spec/dummy/app/views/platforms/show.html.erb",
55
+ "spec/dummy/config.ru",
56
+ "spec/dummy/config/application.rb",
57
+ "spec/dummy/config/boot.rb",
58
+ "spec/dummy/config/database.yml",
59
+ "spec/dummy/config/environment.rb",
60
+ "spec/dummy/config/environments/development.rb",
61
+ "spec/dummy/config/environments/production.rb",
62
+ "spec/dummy/config/environments/test.rb",
63
+ "spec/dummy/config/initializers/backtrace_silencers.rb",
64
+ "spec/dummy/config/initializers/inflections.rb",
65
+ "spec/dummy/config/initializers/mime_types.rb",
66
+ "spec/dummy/config/initializers/secret_token.rb",
67
+ "spec/dummy/config/initializers/session_store.rb",
68
+ "spec/dummy/config/locales/en.yml",
69
+ "spec/dummy/config/routes.rb",
70
+ "spec/dummy/db/migrate/20110228091428_create_entities.rb",
71
+ "spec/dummy/db/migrate/20110228093241_create_platforms.rb",
72
+ "spec/dummy/db/migrate/20110228094444_create_versions.rb",
73
+ "spec/dummy/db/schema.rb",
74
+ "spec/dummy/public/404.html",
75
+ "spec/dummy/public/422.html",
76
+ "spec/dummy/public/500.html",
77
+ "spec/dummy/public/favicon.ico",
78
+ "spec/dummy/public/javascripts/application.js",
79
+ "spec/dummy/public/javascripts/controls.js",
80
+ "spec/dummy/public/javascripts/dragdrop.js",
81
+ "spec/dummy/public/javascripts/effects.js",
82
+ "spec/dummy/public/javascripts/prototype.js",
83
+ "spec/dummy/public/javascripts/rails.js",
84
+ "spec/dummy/script/rails",
85
+ "spec/dummy/spec/controllers/entities_controller_spec.rb",
86
+ "spec/dummy/spec/controllers/platforms_controller_spec.rb",
87
+ "spec/dummy/spec/helpers/entities_helper_spec.rb",
88
+ "spec/dummy/spec/helpers/platforms_helper_spec.rb",
89
+ "spec/dummy/spec/integration/navigation_spec.rb",
90
+ "spec/dummy/spec/integration/paper_trail_manager_spec.rb",
91
+ "spec/dummy/spec/models/entity_spec.rb",
92
+ "spec/dummy/spec/models/platform_spec.rb",
93
+ "spec/dummy/spec/requests/entities_spec.rb",
94
+ "spec/dummy/spec/requests/platforms_spec.rb",
95
+ "spec/dummy/spec/routing/entities_routing_spec.rb",
96
+ "spec/dummy/spec/routing/platforms_routing_spec.rb",
97
+ "spec/dummy/spec/views/entities/edit.html.erb_spec.rb",
98
+ "spec/dummy/spec/views/entities/index.html.erb_spec.rb",
99
+ "spec/dummy/spec/views/entities/new.html.erb_spec.rb",
100
+ "spec/dummy/spec/views/entities/show.html.erb_spec.rb",
101
+ "spec/dummy/spec/views/platforms/edit.html.erb_spec.rb",
102
+ "spec/dummy/spec/views/platforms/index.html.erb_spec.rb",
103
+ "spec/dummy/spec/views/platforms/new.html.erb_spec.rb",
104
+ "spec/dummy/spec/views/platforms/show.html.erb_spec.rb",
105
+ "spec/paper_trail_manager_spec.rb",
106
+ "spec/spec_helper.rb",
107
+ "spec/support/factories.rb"
108
+ ]
109
+ s.homepage = %q{http://github.com/igal/paper_trail_manager}
110
+ s.require_paths = ["lib"]
111
+ s.rubygems_version = %q{1.6.2}
112
+ s.summary = %q{A user interface for `paper_trail` versioning data in Ruby on Rails 3 applications.}
113
+ s.test_files = [
114
+ "spec/controllers/paper_trail_manager/changes_controller_spec.rb",
115
+ "spec/dummy/app/controllers/application_controller.rb",
116
+ "spec/dummy/app/controllers/entities_controller.rb",
117
+ "spec/dummy/app/controllers/platforms_controller.rb",
118
+ "spec/dummy/app/helpers/application_helper.rb",
119
+ "spec/dummy/app/helpers/entities_helper.rb",
120
+ "spec/dummy/app/helpers/platforms_helper.rb",
121
+ "spec/dummy/app/models/entity.rb",
122
+ "spec/dummy/app/models/platform.rb",
123
+ "spec/dummy/config/application.rb",
124
+ "spec/dummy/config/boot.rb",
125
+ "spec/dummy/config/environment.rb",
126
+ "spec/dummy/config/environments/development.rb",
127
+ "spec/dummy/config/environments/production.rb",
128
+ "spec/dummy/config/environments/test.rb",
129
+ "spec/dummy/config/initializers/backtrace_silencers.rb",
130
+ "spec/dummy/config/initializers/inflections.rb",
131
+ "spec/dummy/config/initializers/mime_types.rb",
132
+ "spec/dummy/config/initializers/secret_token.rb",
133
+ "spec/dummy/config/initializers/session_store.rb",
134
+ "spec/dummy/config/routes.rb",
135
+ "spec/dummy/db/migrate/20110228091428_create_entities.rb",
136
+ "spec/dummy/db/migrate/20110228093241_create_platforms.rb",
137
+ "spec/dummy/db/migrate/20110228094444_create_versions.rb",
138
+ "spec/dummy/db/schema.rb",
139
+ "spec/dummy/spec/controllers/entities_controller_spec.rb",
140
+ "spec/dummy/spec/controllers/platforms_controller_spec.rb",
141
+ "spec/dummy/spec/helpers/entities_helper_spec.rb",
142
+ "spec/dummy/spec/helpers/platforms_helper_spec.rb",
143
+ "spec/dummy/spec/integration/navigation_spec.rb",
144
+ "spec/dummy/spec/integration/paper_trail_manager_spec.rb",
145
+ "spec/dummy/spec/models/entity_spec.rb",
146
+ "spec/dummy/spec/models/platform_spec.rb",
147
+ "spec/dummy/spec/requests/entities_spec.rb",
148
+ "spec/dummy/spec/requests/platforms_spec.rb",
149
+ "spec/dummy/spec/routing/entities_routing_spec.rb",
150
+ "spec/dummy/spec/routing/platforms_routing_spec.rb",
151
+ "spec/dummy/spec/views/entities/edit.html.erb_spec.rb",
152
+ "spec/dummy/spec/views/entities/index.html.erb_spec.rb",
153
+ "spec/dummy/spec/views/entities/new.html.erb_spec.rb",
154
+ "spec/dummy/spec/views/entities/show.html.erb_spec.rb",
155
+ "spec/dummy/spec/views/platforms/edit.html.erb_spec.rb",
156
+ "spec/dummy/spec/views/platforms/index.html.erb_spec.rb",
157
+ "spec/dummy/spec/views/platforms/new.html.erb_spec.rb",
158
+ "spec/dummy/spec/views/platforms/show.html.erb_spec.rb",
159
+ "spec/paper_trail_manager_spec.rb",
160
+ "spec/spec_helper.rb",
161
+ "spec/support/factories.rb"
162
+ ]
163
+
164
+ if s.respond_to? :specification_version then
165
+ s.specification_version = 3
166
+
167
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
168
+ s.add_runtime_dependency(%q<rails>, ["~> 3.0"])
169
+ s.add_runtime_dependency(%q<haml>, ["~> 3.0"])
170
+ s.add_runtime_dependency(%q<paper_trail>, ["~> 2.0"])
171
+ s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
172
+ s.add_development_dependency(%q<capybara>, [">= 0.4.0"])
173
+ s.add_development_dependency(%q<factory_girl_rails>, ["~> 1.1.beta1"])
174
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
175
+ s.add_development_dependency(%q<rdoc>, [">= 0"])
176
+ s.add_development_dependency(%q<rspec-rails>, ["~> 2.5.0"])
177
+ s.add_development_dependency(%q<ruby-debug>, [">= 0"])
178
+ s.add_development_dependency(%q<spork>, ["~> 0.9.0.rc"])
179
+ s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
180
+ else
181
+ s.add_dependency(%q<rails>, ["~> 3.0"])
182
+ s.add_dependency(%q<haml>, ["~> 3.0"])
183
+ s.add_dependency(%q<paper_trail>, ["~> 2.0"])
184
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
185
+ s.add_dependency(%q<capybara>, [">= 0.4.0"])
186
+ s.add_dependency(%q<factory_girl_rails>, ["~> 1.1.beta1"])
187
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
188
+ s.add_dependency(%q<rdoc>, [">= 0"])
189
+ s.add_dependency(%q<rspec-rails>, ["~> 2.5.0"])
190
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
191
+ s.add_dependency(%q<spork>, ["~> 0.9.0.rc"])
192
+ s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
193
+ end
194
+ else
195
+ s.add_dependency(%q<rails>, ["~> 3.0"])
196
+ s.add_dependency(%q<haml>, ["~> 3.0"])
197
+ s.add_dependency(%q<paper_trail>, ["~> 2.0"])
198
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
199
+ s.add_dependency(%q<capybara>, [">= 0.4.0"])
200
+ s.add_dependency(%q<factory_girl_rails>, ["~> 1.1.beta1"])
201
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
202
+ s.add_dependency(%q<rdoc>, [">= 0"])
203
+ s.add_dependency(%q<rspec-rails>, ["~> 2.5.0"])
204
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
205
+ s.add_dependency(%q<spork>, ["~> 0.9.0.rc"])
206
+ s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
207
+ end
208
+ end
209
+
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe PaperTrailManager::ChangesController do
4
+ it "should load" do
5
+ true.should be_true
6
+ end
7
+ end
8
+
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,7 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+
4
+ def index
5
+ render :text => "Hello."
6
+ end
7
+ end
@@ -0,0 +1,83 @@
1
+ class EntitiesController < ApplicationController
2
+ # GET /entities
3
+ # GET /entities.xml
4
+ def index
5
+ @entities = Entity.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.xml { render :xml => @entities }
10
+ end
11
+ end
12
+
13
+ # GET /entities/1
14
+ # GET /entities/1.xml
15
+ def show
16
+ @entity = Entity.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.xml { render :xml => @entity }
21
+ end
22
+ end
23
+
24
+ # GET /entities/new
25
+ # GET /entities/new.xml
26
+ def new
27
+ @entity = Entity.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.xml { render :xml => @entity }
32
+ end
33
+ end
34
+
35
+ # GET /entities/1/edit
36
+ def edit
37
+ @entity = Entity.find(params[:id])
38
+ end
39
+
40
+ # POST /entities
41
+ # POST /entities.xml
42
+ def create
43
+ @entity = Entity.new(params[:entity])
44
+
45
+ respond_to do |format|
46
+ if @entity.save
47
+ format.html { redirect_to(@entity, :notice => 'Entity was successfully created.') }
48
+ format.xml { render :xml => @entity, :status => :created, :location => @entity }
49
+ else
50
+ format.html { render :action => "new" }
51
+ format.xml { render :xml => @entity.errors, :status => :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /entities/1
57
+ # PUT /entities/1.xml
58
+ def update
59
+ @entity = Entity.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @entity.update_attributes(params[:entity])
63
+ format.html { redirect_to(@entity, :notice => 'Entity was successfully updated.') }
64
+ format.xml { head :ok }
65
+ else
66
+ format.html { render :action => "edit" }
67
+ format.xml { render :xml => @entity.errors, :status => :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /entities/1
73
+ # DELETE /entities/1.xml
74
+ def destroy
75
+ @entity = Entity.find(params[:id])
76
+ @entity.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to(entities_url) }
80
+ format.xml { head :ok }
81
+ end
82
+ end
83
+ end