paper_trail_history 0.1.2 → 0.2.0

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: 610995c7d553d9d0297dd185308472f16747173affa787d2fc31bcac0fd08707
4
- data.tar.gz: 2537b34e9d014b62071d700f8ff002970993ec2ca7adb69d60071faf21b3ca14
3
+ metadata.gz: 9d4cf46205ebd10b78ce9d159df2a384e2b00071a80efad39bf2e79bbcb84b05
4
+ data.tar.gz: 7b1155089a6b7328d76d63d137fb527e0e68219da77da09f1358d824c6f2bfe5
5
5
  SHA512:
6
- metadata.gz: d21d583f1bd7d035c751c8362de1d77e49df19d1a01970e8fd49c973f9c98f84451c7fcbca8a19ec2d712b37c4a4a85600cb5776814813f8b891e7bceef2e010
7
- data.tar.gz: cf3bf56a5e65c21281bef09e298ea1038af99c39cf5899675adcf9dbe910a23591229f5b92e7e357461f2dc37155071454ba9bf7cb2b86c5b7b4a94e3e76391a
6
+ metadata.gz: 92abd0ba47e73f3980186c8f52819b58b7cdf33becc042d49703233a070c3a43a312f45d2d69ecd9bc10e67bb974675c93749f05eb528dd1806f410763e36ff4
7
+ data.tar.gz: f9a7cd1637b73274d866138706ad49ff1f1b1222575f4aca7dff2f8114584c9b30bcfb20f71ed731fb0af1234cb6bebef631f5eb2d23584a0bcd571dbee8cbec
data/README.md CHANGED
@@ -37,7 +37,7 @@ end
37
37
  ## Prerequisites
38
38
 
39
39
  This engine requires:
40
- - Rails >= 8.0.2
40
+ - Rails >= 7.2
41
41
  - PaperTrail >= 15.0 (configured with `has_paper_trail` in your models)
42
42
 
43
43
  Make sure you have PaperTrail properly configured in your Rails application before using this engine.
@@ -89,7 +89,24 @@ You can restore any version (except create events) by:
89
89
 
90
90
  ## Development
91
91
 
92
- ### Setting up the Test Environment
92
+ ### Quick Start
93
+
94
+ After cloning the repository, run the setup script to get started:
95
+
96
+ ```bash
97
+ # Automated setup - installs dependencies, sets up database, runs tests
98
+ bin/setup
99
+ ```
100
+
101
+ This script will:
102
+ - Install bundler and project dependencies
103
+ - Set up the test dummy app with database and seed data
104
+ - Run initial tests to verify everything works
105
+ - Run the linter to check code quality
106
+
107
+ ### Manual Setup (Alternative)
108
+
109
+ If you prefer manual setup:
93
110
 
94
111
  ```bash
95
112
  # Install dependencies
@@ -97,9 +114,9 @@ bundle install
97
114
 
98
115
  # Set up test database with sample data
99
116
  cd test/dummy
100
- bundle exec rails db:create RAILS_ENV=test
101
- bundle exec rails db:migrate RAILS_ENV=test
102
- bundle exec rails db:seed RAILS_ENV=test
117
+ bundle install --gemfile=../../Gemfile
118
+ bundle exec rails db:prepare
119
+ bundle exec rails db:seed
103
120
  cd ../..
104
121
  ```
105
122
 
@@ -140,7 +157,10 @@ bundle exec rake test TEST="test/integration/**/*_test.rb"
140
157
  The `test/dummy` directory contains a full Rails application with sample models and data for testing:
141
158
 
142
159
  ```bash
143
- # Start the development server
160
+ # Start the development server (from project root)
161
+ bin/dummy
162
+
163
+ # Alternative: manual approach
144
164
  cd test/dummy && bundle exec rails server
145
165
 
146
166
  # Visit the engine interface
@@ -158,9 +178,9 @@ The dummy app includes:
158
178
  For comprehensive compatibility testing, use the provided Gemfiles:
159
179
 
160
180
  ```bash
161
- # Test against Rails 7.1
162
- BUNDLE_GEMFILE=gemfiles/rails_7.1.gemfile bundle install
163
- BUNDLE_GEMFILE=gemfiles/rails_7.1.gemfile bundle exec rake test
181
+ # Test against Rails 7.2
182
+ BUNDLE_GEMFILE=gemfiles/rails_7.2.gemfile bundle install
183
+ BUNDLE_GEMFILE=gemfiles/rails_7.2.gemfile bundle exec rake test
164
184
 
165
185
  # Test against Rails 8.0
166
186
  BUNDLE_GEMFILE=gemfiles/rails_8.0.gemfile bundle install
@@ -186,3 +206,7 @@ The project uses GitHub Actions to test against multiple Ruby and Rails versions
186
206
  ## License
187
207
 
188
208
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
209
+
210
+ ---
211
+
212
+ Kindly supported by [aifinyo AG](https://aifinyo.de)
@@ -14,11 +14,10 @@ module PaperTrailHistory
14
14
  result = VersionService.restore_version(@version.id)
15
15
 
16
16
  if result[:success]
17
- redirect_back fallback_location: version_path(@version),
18
- notice: result[:message]
17
+ redirect_back_or_to(version_path(@version), notice: result[:message])
19
18
  else
20
- redirect_back fallback_location: version_path(@version),
21
- alert: t('paper_trail_history.errors.restore_failed', error: result[:error])
19
+ redirect_back_or_to(version_path(@version),
20
+ alert: t('paper_trail_history.errors.restore_failed', error: result[:error]))
22
21
  end
23
22
  end
24
23
 
@@ -8,13 +8,92 @@
8
8
 
9
9
  <%= yield :head %>
10
10
 
11
- <%= stylesheet_link_tag "paper_trail_history/application", media: "all" %>
12
11
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
13
12
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
13
+
14
+ <style>
15
+ /* Git-style diff formatting */
16
+ .diff-container {
17
+ font-family: 'SFMono-Regular', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
18
+ font-size: 0.9rem;
19
+ }
20
+
21
+ .diff-section {
22
+ border: 1px solid #e1e4e8;
23
+ border-radius: 6px;
24
+ overflow: hidden;
25
+ }
26
+
27
+ .diff-header {
28
+ background-color: #f6f8fa;
29
+ padding: 8px 12px;
30
+ border-bottom: 1px solid #e1e4e8;
31
+ font-weight: 600;
32
+ color: #586069;
33
+ }
34
+
35
+ .diff-content {
36
+ background-color: #fff;
37
+ }
38
+
39
+ .diff-line {
40
+ display: flex;
41
+ align-items: flex-start;
42
+ padding: 2px 0;
43
+ line-height: 1.45;
44
+ position: relative;
45
+ }
46
+
47
+ .diff-line code {
48
+ background: none;
49
+ border: none;
50
+ padding: 4px 8px;
51
+ margin: 0;
52
+ flex: 1;
53
+ font-size: 0.85rem;
54
+ white-space: pre-wrap;
55
+ word-break: break-all;
56
+ }
57
+
58
+ .diff-marker {
59
+ display: inline-block;
60
+ width: 20px;
61
+ text-align: center;
62
+ font-weight: bold;
63
+ flex-shrink: 0;
64
+ font-size: 0.9rem;
65
+ padding: 4px 0;
66
+ user-select: none;
67
+ }
68
+
69
+ .diff-removed {
70
+ background-color: #ffeef0;
71
+ border-left: 3px solid #f85149;
72
+ }
73
+
74
+ .diff-removed .diff-marker {
75
+ color: #f85149;
76
+ background-color: #ffdddf;
77
+ }
78
+
79
+ .diff-added {
80
+ background-color: #e6ffed;
81
+ border-left: 3px solid #2ea043;
82
+ }
83
+
84
+ .diff-added .diff-marker {
85
+ color: #2ea043;
86
+ background-color: #ccf2d4;
87
+ }
88
+
89
+ .diff-line:hover {
90
+ background-color: rgba(0, 0, 0, 0.05);
91
+ }
92
+ </style>
14
93
  </head>
15
94
  <body>
16
95
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
17
- <div class="container">
96
+ <div class="container-fluid">
18
97
  <%= link_to "Paper Trail History", root_path, class: "navbar-brand" %>
19
98
 
20
99
  <div class="navbar-nav ms-auto">
@@ -23,7 +102,7 @@
23
102
  </div>
24
103
  </nav>
25
104
 
26
- <div class="container mt-4">
105
+ <div class="container-fluid mt-4">
27
106
  <% if notice %>
28
107
  <div class="alert alert-success alert-dismissible fade show" role="alert">
29
108
  <%= notice %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PaperTrailHistory
4
- VERSION = '0.1.2'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail_history
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Deutscher
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2025-08-07 00:00:00.000000000 Z
11
+ date: 2025-12-04 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: paper_trail
@@ -29,14 +30,14 @@ dependencies:
29
30
  requirements:
30
31
  - - ">="
31
32
  - !ruby/object:Gem::Version
32
- version: '7.2'
33
+ version: '8.0'
33
34
  type: :runtime
34
35
  prerelease: false
35
36
  version_requirements: !ruby/object:Gem::Requirement
36
37
  requirements:
37
38
  - - ">="
38
39
  - !ruby/object:Gem::Version
39
- version: '7.2'
40
+ version: '8.0'
40
41
  description: |
41
42
  PaperTrailHistory is a mountable Rails engine that provides a comprehensive web interface for viewing, searching,
42
43
  and managing audit trail versions created by the PaperTrail gem. Features include listing trackable models,
@@ -50,7 +51,6 @@ files:
50
51
  - MIT-LICENSE
51
52
  - README.md
52
53
  - Rakefile
53
- - app/assets/stylesheets/paper_trail_history/application.css
54
54
  - app/controllers/paper_trail_history/application_controller.rb
55
55
  - app/controllers/paper_trail_history/models_controller.rb
56
56
  - app/controllers/paper_trail_history/records_controller.rb
@@ -86,6 +86,7 @@ metadata:
86
86
  source_code_uri: https://github.com/its-bede/paper_trail_history
87
87
  changelog_uri: https://github.com/its-bede/paper_trail_history/blob/main/CHANGELOG.md
88
88
  rubygems_mfa_required: 'true'
89
+ post_install_message:
89
90
  rdoc_options: []
90
91
  require_paths:
91
92
  - lib
@@ -93,14 +94,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
94
  requirements:
94
95
  - - ">="
95
96
  - !ruby/object:Gem::Version
96
- version: 3.1.0
97
+ version: 3.3.0
97
98
  required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  requirements:
99
100
  - - ">="
100
101
  - !ruby/object:Gem::Version
101
102
  version: '0'
102
103
  requirements: []
103
- rubygems_version: 3.6.6
104
+ rubygems_version: 3.5.23
105
+ signing_key:
104
106
  specification_version: 4
105
107
  summary: A Rails engine providing a web interface for managing PaperTrail versions.
106
108
  test_files: []
@@ -1,93 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
16
-
17
- /* Git-style diff formatting */
18
- .diff-container {
19
- font-family: 'SFMono-Regular', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
20
- font-size: 0.9rem;
21
- }
22
-
23
- .diff-section {
24
- border: 1px solid #e1e4e8;
25
- border-radius: 6px;
26
- overflow: hidden;
27
- }
28
-
29
- .diff-header {
30
- background-color: #f6f8fa;
31
- padding: 8px 12px;
32
- border-bottom: 1px solid #e1e4e8;
33
- font-weight: 600;
34
- color: #586069;
35
- }
36
-
37
- .diff-content {
38
- background-color: #fff;
39
- }
40
-
41
- .diff-line {
42
- display: flex;
43
- align-items: flex-start;
44
- padding: 2px 0;
45
- line-height: 1.45;
46
- position: relative;
47
- }
48
-
49
- .diff-line code {
50
- background: none;
51
- border: none;
52
- padding: 4px 8px;
53
- margin: 0;
54
- flex: 1;
55
- font-size: 0.85rem;
56
- white-space: pre-wrap;
57
- word-break: break-all;
58
- }
59
-
60
- .diff-marker {
61
- display: inline-block;
62
- width: 20px;
63
- text-align: center;
64
- font-weight: bold;
65
- flex-shrink: 0;
66
- font-size: 0.9rem;
67
- padding: 4px 0;
68
- user-select: none;
69
- }
70
-
71
- .diff-removed {
72
- background-color: #ffeef0;
73
- border-left: 3px solid #f85149;
74
- }
75
-
76
- .diff-removed .diff-marker {
77
- color: #f85149;
78
- background-color: #ffdddf;
79
- }
80
-
81
- .diff-added {
82
- background-color: #e6ffed;
83
- border-left: 3px solid #2ea043;
84
- }
85
-
86
- .diff-added .diff-marker {
87
- color: #2ea043;
88
- background-color: #ccf2d4;
89
- }
90
-
91
- .diff-line:hover {
92
- background-color: rgba(0, 0, 0, 0.05);
93
- }