rails_audit 1.0.0 → 1.0.4

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.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +20 -165
  3. data/README.md +17 -5
  4. data/app/controllers/auditor/admin/approvals_controller.rb +44 -0
  5. data/app/controllers/auditor/admin/audits_controller.rb +11 -0
  6. data/app/controllers/auditor/admin/base_controller.rb +4 -0
  7. data/app/controllers/auditor/admin/verifications_controller.rb +61 -0
  8. data/app/controllers/auditor/admin/verifiers_controller.rb +69 -0
  9. data/app/controllers/auditor/controller/application.rb +32 -0
  10. data/app/models/auditor/approval.rb +5 -0
  11. data/app/models/auditor/audit.rb +5 -0
  12. data/app/models/auditor/ext/audited.rb +58 -0
  13. data/app/models/auditor/ext/verifiable.rb +10 -0
  14. data/app/models/auditor/ext/verified.rb +25 -0
  15. data/app/models/auditor/model/approval.rb +59 -0
  16. data/app/models/auditor/model/approving.rb +65 -0
  17. data/app/models/auditor/model/audit.rb +25 -0
  18. data/app/models/auditor/model/verification.rb +32 -0
  19. data/app/models/auditor/model/verifier.rb +20 -0
  20. data/app/models/auditor/verification.rb +5 -0
  21. data/app/models/auditor/verifier.rb +5 -0
  22. data/app/models/auditor.rb +11 -0
  23. data/app/views/auditor/_approvals.html.erb +14 -0
  24. data/app/views/auditor/_checks.html.erb +16 -0
  25. data/app/views/auditor/admin/approvals/_filter.html.erb +7 -0
  26. data/app/views/auditor/admin/approvals/_form.html.erb +6 -0
  27. data/app/views/auditor/admin/approvals/_index.html.erb +10 -0
  28. data/app/views/auditor/admin/approvals/_show_table.html.erb +28 -0
  29. data/app/views/auditor/admin/approvals/_table.html.erb +28 -0
  30. data/app/views/auditor/admin/approvals/index.js.erb +3 -0
  31. data/app/views/auditor/admin/audits/_button.html.erb +0 -0
  32. data/app/views/auditor/admin/audits/_index_tbody.html.erb +38 -0
  33. data/app/views/auditor/admin/audits/_index_thead.html.erb +4 -0
  34. data/app/views/auditor/admin/audits/index.html.erb +7 -0
  35. data/app/views/auditor/admin/verifications/_edit_form.html.erb +7 -0
  36. data/app/views/auditor/admin/verifications/_filter_form.html.erb +5 -0
  37. data/app/views/auditor/admin/verifications/_index_tbody.html.erb +4 -0
  38. data/app/views/auditor/admin/verifications/_index_thead.html.erb +5 -0
  39. data/app/views/auditor/admin/verifications/_new_form.html.erb +7 -0
  40. data/app/views/auditor/admin/verifications/_show_table.html.erb +16 -0
  41. data/app/views/auditor/admin/verifiers/_edit_form.html.erb +3 -0
  42. data/app/views/auditor/admin/verifiers/_filter_form.html.erb +9 -0
  43. data/app/views/auditor/admin/verifiers/_form.html.erb +5 -0
  44. data/app/views/auditor/admin/verifiers/_index_tbody.html.erb +3 -0
  45. data/app/views/auditor/admin/verifiers/_index_thead.html.erb +4 -0
  46. data/app/views/auditor/admin/verifiers/_member_field.html.erb +1 -0
  47. data/app/views/auditor/admin/verifiers/_new_form.html.erb +3 -0
  48. data/app/views/auditor/admin/verifiers/_show_table.html.erb +24 -0
  49. data/app/views/auditor/admin/verifiers/members.turbo_stream.erb +3 -0
  50. data/config/locales/en.yml +12 -0
  51. data/config/locales/zh.controller.yml +13 -0
  52. data/config/locales/zh.enum.yml +7 -0
  53. data/config/locales/zh.yml +21 -0
  54. data/config/routes.rb +22 -2
  55. data/lib/rails_audit/config.rb +14 -0
  56. data/lib/rails_audit/engine.rb +15 -6
  57. data/lib/rails_audit.rb +3 -2
  58. data/test/controllers/audit/admin/approvals_controller_test.rb +36 -0
  59. data/test/dummy/Gemfile +54 -0
  60. data/test/dummy/Gemfile.lock +382 -0
  61. data/test/dummy/README.md +8 -1
  62. data/test/dummy/app/assets/images/default_avatar.jpg +0 -0
  63. data/test/dummy/app/assets/images/logo.png +0 -0
  64. data/test/dummy/app/assets/javascripts/admin/application.js +1 -0
  65. data/test/dummy/app/assets/javascripts/application.js +11 -2
  66. data/test/dummy/app/assets/javascripts/phone.js +5 -0
  67. data/test/dummy/app/assets/stylesheets/css.scss +4 -0
  68. data/test/dummy/app/controllers/active_storage/base_controller.rb +19 -0
  69. data/test/dummy/app/controllers/admin_controller.rb +3 -0
  70. data/test/dummy/app/controllers/application_controller.rb +10 -1
  71. data/test/dummy/app/controllers/home_controller.rb +0 -5
  72. data/test/dummy/app/controllers/me_controller.rb +4 -0
  73. data/test/dummy/app/controllers/my_controller.rb +4 -0
  74. data/test/dummy/app/models/auth/user.rb +7 -0
  75. data/test/dummy/app/views/home/index.css +3 -0
  76. data/test/dummy/app/views/home/index.html.erb +0 -0
  77. data/test/dummy/app/views/layouts/_right_menu.html.erb +0 -20
  78. data/test/dummy/bin/bundle +1 -1
  79. data/test/dummy/bin/setup +1 -1
  80. data/test/dummy/bin/vite +19 -0
  81. data/test/dummy/bin/yarn +11 -0
  82. data/test/dummy/config/application.rb +12 -5
  83. data/test/dummy/config/boot.rb +8 -4
  84. data/test/dummy/config/credentials/development.key +1 -0
  85. data/test/dummy/config/credentials/test.key +1 -0
  86. data/test/dummy/config/credentials.yml.enc +1 -0
  87. data/test/dummy/config/database.yml +16 -0
  88. data/test/dummy/config/environment.rb +0 -2
  89. data/test/dummy/config/environments/development.rb +19 -32
  90. data/test/dummy/config/environments/production.rb +1 -13
  91. data/test/dummy/config/environments/test.rb +5 -0
  92. data/test/dummy/config/initializers/mime_types.rb +0 -4
  93. data/test/dummy/config/initializers/new_framework_defaults.rb +0 -4
  94. data/test/dummy/config/locales/en.yml +1 -22
  95. data/test/dummy/config/master.key +1 -0
  96. data/test/dummy/config/puma.rb +28 -41
  97. data/test/dummy/config/routes.rb +9 -2
  98. data/test/dummy/config/storage.yml +11 -0
  99. data/test/dummy/config/vite/base.js +5 -0
  100. data/test/dummy/config/vite/development.js +12 -0
  101. data/test/dummy/config/vite/production.js +6 -0
  102. data/test/dummy/config.ru +2 -0
  103. data/test/dummy/lib/deploy.rb +115 -0
  104. data/test/dummy/package.json +23 -2
  105. data/test/dummy/postcss.config.js +11 -0
  106. data/test/dummy/yarn.lock +2140 -4
  107. data/test/factories/approvals.rb +7 -0
  108. data/test/factories/infos.rb +8 -0
  109. data/test/{the_audit_test.rb → rails_audit_test.rb} +3 -1
  110. data/test/test_helper.rb +9 -16
  111. metadata +151 -97
  112. data/app/controllers/admin/audits_controller.rb +0 -12
  113. data/app/models/rails_audit/audit.rb +0 -14
  114. data/app/models/rails_audit/concerns/auditable.rb +0 -59
  115. data/app/models/rails_audit/history.rb +0 -36
  116. data/app/models/rails_audit/major_record.rb +0 -14
  117. data/app/models/rails_audit/minor_record.rb +0 -15
  118. data/app/views/admin/audits/_index.html.erb +0 -9
  119. data/app/views/admin/audits/_table.html.erb +0 -61
  120. data/app/views/admin/audits/index.html.erb +0 -3
  121. data/app/views/admin/audits/index.js.erb +0 -8
  122. data/db/migrate/20170314035239_create_audits.rb +0 -20
  123. data/lib/rails_audit/controller_helper.rb +0 -39
  124. data/lib/rails_audit/version.rb +0 -3
  125. data/lib/tasks/the_history_tasks.rake +0 -4
  126. data/test/dummy/app/assets/config/manifest.js +0 -3
  127. data/test/dummy/app/assets/javascripts/cable.js +0 -13
  128. data/test/dummy/app/assets/stylesheets/application.css +0 -5
  129. data/test/dummy/app/controllers/admin/base_controller.rb +0 -7
  130. data/test/dummy/app/controllers/my/base_controller.rb +0 -7
  131. data/test/dummy/app/models/application_record.rb +0 -3
  132. data/test/dummy/app/models/user.rb +0 -3
  133. data/test/dummy/app/views/layouts/_navbar.html.erb +0 -18
  134. data/test/dummy/app/views/layouts/application.html.erb +0 -19
  135. data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
  136. data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
  137. data/test/dummy/bin/update +0 -29
  138. data/test/dummy/config/database.yml.mysql +0 -14
  139. data/test/dummy/config/database.yml.sqlite3 +0 -12
  140. data/test/dummy/config/initializers/assets.rb +0 -6
  141. data/test/dummy/config/secrets.yml +0 -22
  142. data/test/dummy/db/migrate/20180525090830_create_active_storage_tables.active_storage.rb +0 -26
  143. data/test/dummy/log/development.log +0 -2
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :approval do
3
+ association :approving, factory: :info
4
+ comment { 'MyString' }
5
+ approved_at { '2019-11-07 15:48:45' }
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :info do
3
+ code { 'MyString' }
4
+ value { 'MyString' }
5
+ version { 'MyString' }
6
+ platform { 'ios' }
7
+ end
8
+ end
@@ -1,7 +1,9 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class RailsAuditTest < ActiveSupport::TestCase
4
- test "truth" do
4
+
5
+ test 'truth' do
5
6
  assert_kind_of Module, RailsAudit
6
7
  end
8
+
7
9
  end
data/test/test_helper.rb CHANGED
@@ -1,20 +1,13 @@
1
- # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
1
+ ENV['RAILS_ENV'] = 'test'
2
+ require_relative 'dummy/config/environment'
3
+ require 'rails/test_help'
4
+ require 'minitest/mock'
5
+ require 'factory_bot'
3
6
 
4
- require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
5
- ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
6
- require "rails/test_help"
7
-
8
- # Filter out Minitest backtrace while allowing backtrace from other libraries
9
- # to be shown.
10
7
  Minitest.backtrace_filter = Minitest::BacktraceFilter.new
8
+ FactoryBot.find_definitions
11
9
 
12
- # Load support files
13
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
14
-
15
- # Load fixtures from the engine
16
- if ActiveSupport::TestCase.respond_to?(:fixture_path=)
17
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
18
- ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
19
- ActiveSupport::TestCase.fixtures :all
10
+ class ActiveSupport::TestCase
11
+ include FactoryBot::Syntax::Methods
12
+ self.file_fixture_path = File.expand_path('fixtures/files', __dir__)
20
13
  end
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - qinmingyuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-21 00:00:00.000000000 Z
11
+ date: 2021-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: rails_com
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
20
- - - "<="
21
- - !ruby/object:Gem::Version
22
- version: '6.0'
19
+ version: '1.2'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '5.0'
30
- - - "<="
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '6.0'
26
+ version: '1.2'
33
27
  description: Description of RailsAudit.
34
28
  email:
35
29
  - mingyuan0715@foxmail.com
@@ -40,62 +34,105 @@ files:
40
34
  - LICENSE
41
35
  - README.md
42
36
  - Rakefile
43
- - app/controllers/admin/audits_controller.rb
44
- - app/models/rails_audit/audit.rb
45
- - app/models/rails_audit/concerns/auditable.rb
46
- - app/models/rails_audit/history.rb
47
- - app/models/rails_audit/major_record.rb
48
- - app/models/rails_audit/minor_record.rb
49
- - app/views/admin/audits/_index.html.erb
50
- - app/views/admin/audits/_table.html.erb
51
- - app/views/admin/audits/index.html.erb
52
- - app/views/admin/audits/index.js.erb
37
+ - app/controllers/auditor/admin/approvals_controller.rb
38
+ - app/controllers/auditor/admin/audits_controller.rb
39
+ - app/controllers/auditor/admin/base_controller.rb
40
+ - app/controllers/auditor/admin/verifications_controller.rb
41
+ - app/controllers/auditor/admin/verifiers_controller.rb
42
+ - app/controllers/auditor/controller/application.rb
43
+ - app/models/auditor.rb
44
+ - app/models/auditor/approval.rb
45
+ - app/models/auditor/audit.rb
46
+ - app/models/auditor/ext/audited.rb
47
+ - app/models/auditor/ext/verifiable.rb
48
+ - app/models/auditor/ext/verified.rb
49
+ - app/models/auditor/model/approval.rb
50
+ - app/models/auditor/model/approving.rb
51
+ - app/models/auditor/model/audit.rb
52
+ - app/models/auditor/model/verification.rb
53
+ - app/models/auditor/model/verifier.rb
54
+ - app/models/auditor/verification.rb
55
+ - app/models/auditor/verifier.rb
56
+ - app/views/auditor/_approvals.html.erb
57
+ - app/views/auditor/_checks.html.erb
58
+ - app/views/auditor/admin/approvals/_filter.html.erb
59
+ - app/views/auditor/admin/approvals/_form.html.erb
60
+ - app/views/auditor/admin/approvals/_index.html.erb
61
+ - app/views/auditor/admin/approvals/_show_table.html.erb
62
+ - app/views/auditor/admin/approvals/_table.html.erb
63
+ - app/views/auditor/admin/approvals/index.js.erb
64
+ - app/views/auditor/admin/audits/_button.html.erb
65
+ - app/views/auditor/admin/audits/_index_tbody.html.erb
66
+ - app/views/auditor/admin/audits/_index_thead.html.erb
67
+ - app/views/auditor/admin/audits/index.html.erb
68
+ - app/views/auditor/admin/verifications/_edit_form.html.erb
69
+ - app/views/auditor/admin/verifications/_filter_form.html.erb
70
+ - app/views/auditor/admin/verifications/_index_tbody.html.erb
71
+ - app/views/auditor/admin/verifications/_index_thead.html.erb
72
+ - app/views/auditor/admin/verifications/_new_form.html.erb
73
+ - app/views/auditor/admin/verifications/_show_table.html.erb
74
+ - app/views/auditor/admin/verifiers/_edit_form.html.erb
75
+ - app/views/auditor/admin/verifiers/_filter_form.html.erb
76
+ - app/views/auditor/admin/verifiers/_form.html.erb
77
+ - app/views/auditor/admin/verifiers/_index_tbody.html.erb
78
+ - app/views/auditor/admin/verifiers/_index_thead.html.erb
79
+ - app/views/auditor/admin/verifiers/_member_field.html.erb
80
+ - app/views/auditor/admin/verifiers/_new_form.html.erb
81
+ - app/views/auditor/admin/verifiers/_show_table.html.erb
82
+ - app/views/auditor/admin/verifiers/members.turbo_stream.erb
83
+ - config/locales/en.yml
84
+ - config/locales/zh.controller.yml
85
+ - config/locales/zh.enum.yml
86
+ - config/locales/zh.yml
53
87
  - config/routes.rb
54
- - db/migrate/20170314035239_create_audits.rb
55
88
  - lib/rails_audit.rb
56
- - lib/rails_audit/controller_helper.rb
89
+ - lib/rails_audit/config.rb
57
90
  - lib/rails_audit/engine.rb
58
- - lib/rails_audit/version.rb
59
- - lib/tasks/the_history_tasks.rake
91
+ - test/controllers/audit/admin/approvals_controller_test.rb
92
+ - test/dummy/Gemfile
93
+ - test/dummy/Gemfile.lock
60
94
  - test/dummy/README.md
61
95
  - test/dummy/Rakefile
62
- - test/dummy/app/assets/config/manifest.js
96
+ - test/dummy/app/assets/images/default_avatar.jpg
97
+ - test/dummy/app/assets/images/logo.png
98
+ - test/dummy/app/assets/javascripts/admin/application.js
63
99
  - test/dummy/app/assets/javascripts/application.js
64
- - test/dummy/app/assets/javascripts/cable.js
65
- - test/dummy/app/assets/stylesheets/application.css
100
+ - test/dummy/app/assets/javascripts/phone.js
101
+ - test/dummy/app/assets/stylesheets/css.scss
66
102
  - test/dummy/app/channels/application_cable/channel.rb
67
103
  - test/dummy/app/channels/application_cable/connection.rb
68
- - test/dummy/app/controllers/admin/base_controller.rb
104
+ - test/dummy/app/controllers/active_storage/base_controller.rb
105
+ - test/dummy/app/controllers/admin_controller.rb
69
106
  - test/dummy/app/controllers/application_controller.rb
70
107
  - test/dummy/app/controllers/home_controller.rb
71
- - test/dummy/app/controllers/my/base_controller.rb
108
+ - test/dummy/app/controllers/me_controller.rb
109
+ - test/dummy/app/controllers/my_controller.rb
72
110
  - test/dummy/app/helpers/application_helper.rb
73
111
  - test/dummy/app/jobs/application_job.rb
74
112
  - test/dummy/app/mailers/application_mailer.rb
75
- - test/dummy/app/models/application_record.rb
76
- - test/dummy/app/models/user.rb
77
- - test/dummy/app/views/layouts/_navbar.html.erb
113
+ - test/dummy/app/models/auth/user.rb
114
+ - test/dummy/app/views/home/index.css
115
+ - test/dummy/app/views/home/index.html.erb
78
116
  - test/dummy/app/views/layouts/_right_menu.html.erb
79
- - test/dummy/app/views/layouts/application.html.erb
80
- - test/dummy/app/views/layouts/mailer.html.erb
81
- - test/dummy/app/views/layouts/mailer.text.erb
82
117
  - test/dummy/bin/bundle
83
118
  - test/dummy/bin/rails
84
119
  - test/dummy/bin/rake
85
120
  - test/dummy/bin/setup
86
- - test/dummy/bin/update
121
+ - test/dummy/bin/vite
122
+ - test/dummy/bin/yarn
87
123
  - test/dummy/config.ru
88
124
  - test/dummy/config/application.rb
89
125
  - test/dummy/config/boot.rb
90
126
  - test/dummy/config/cable.yml
91
- - test/dummy/config/database.yml.mysql
92
- - test/dummy/config/database.yml.sqlite3
127
+ - test/dummy/config/credentials.yml.enc
128
+ - test/dummy/config/credentials/development.key
129
+ - test/dummy/config/credentials/test.key
130
+ - test/dummy/config/database.yml
93
131
  - test/dummy/config/environment.rb
94
132
  - test/dummy/config/environments/development.rb
95
133
  - test/dummy/config/environments/production.rb
96
134
  - test/dummy/config/environments/test.rb
97
135
  - test/dummy/config/initializers/application_controller_renderer.rb
98
- - test/dummy/config/initializers/assets.rb
99
136
  - test/dummy/config/initializers/backtrace_silencers.rb
100
137
  - test/dummy/config/initializers/cookies_serializer.rb
101
138
  - test/dummy/config/initializers/filter_parameter_logging.rb
@@ -105,13 +142,17 @@ files:
105
142
  - test/dummy/config/initializers/session_store.rb
106
143
  - test/dummy/config/initializers/wrap_parameters.rb
107
144
  - test/dummy/config/locales/en.yml
145
+ - test/dummy/config/master.key
108
146
  - test/dummy/config/puma.rb
109
147
  - test/dummy/config/routes.rb
110
- - test/dummy/config/secrets.yml
111
148
  - test/dummy/config/spring.rb
112
- - test/dummy/db/migrate/20180525090830_create_active_storage_tables.active_storage.rb
113
- - test/dummy/log/development.log
149
+ - test/dummy/config/storage.yml
150
+ - test/dummy/config/vite/base.js
151
+ - test/dummy/config/vite/development.js
152
+ - test/dummy/config/vite/production.js
153
+ - test/dummy/lib/deploy.rb
114
154
  - test/dummy/package.json
155
+ - test/dummy/postcss.config.js
115
156
  - test/dummy/public/404.html
116
157
  - test/dummy/public/422.html
117
158
  - test/dummy/public/500.html
@@ -119,12 +160,14 @@ files:
119
160
  - test/dummy/public/apple-touch-icon.png
120
161
  - test/dummy/public/favicon.ico
121
162
  - test/dummy/yarn.lock
163
+ - test/factories/approvals.rb
164
+ - test/factories/infos.rb
122
165
  - test/integration/navigation_test.rb
166
+ - test/rails_audit_test.rb
123
167
  - test/test_helper.rb
124
- - test/the_audit_test.rb
125
- homepage: https://github.com/yougexiangfa/rails_audit
168
+ homepage: https://github.com/work-design/rails_audit
126
169
  licenses:
127
- - LGPL-3.0
170
+ - MIT
128
171
  metadata: {}
129
172
  post_install_message:
130
173
  rdoc_options: []
@@ -141,74 +184,85 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
184
  - !ruby/object:Gem::Version
142
185
  version: '0'
143
186
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.7.7
187
+ rubygems_version: 3.2.22
146
188
  signing_key:
147
189
  specification_version: 4
148
- summary: Summary of RailsAudit.
190
+ summary: Audit changes for model with operator
149
191
  test_files:
150
- - test/dummy/app/mailers/application_mailer.rb
151
- - test/dummy/app/models/application_record.rb
152
- - test/dummy/app/models/user.rb
153
- - test/dummy/app/jobs/application_job.rb
192
+ - test/controllers/audit/admin/approvals_controller_test.rb
193
+ - test/dummy/Gemfile
194
+ - test/dummy/Gemfile.lock
195
+ - test/dummy/README.md
196
+ - test/dummy/Rakefile
197
+ - test/dummy/app/assets/images/default_avatar.jpg
198
+ - test/dummy/app/assets/images/logo.png
199
+ - test/dummy/app/assets/javascripts/admin/application.js
200
+ - test/dummy/app/assets/javascripts/application.js
201
+ - test/dummy/app/assets/javascripts/phone.js
202
+ - test/dummy/app/assets/stylesheets/css.scss
203
+ - test/dummy/app/channels/application_cable/channel.rb
204
+ - test/dummy/app/channels/application_cable/connection.rb
205
+ - test/dummy/app/controllers/active_storage/base_controller.rb
206
+ - test/dummy/app/controllers/admin_controller.rb
154
207
  - test/dummy/app/controllers/application_controller.rb
155
- - test/dummy/app/controllers/admin/base_controller.rb
156
208
  - test/dummy/app/controllers/home_controller.rb
157
- - test/dummy/app/controllers/my/base_controller.rb
158
- - test/dummy/app/views/layouts/_navbar.html.erb
159
- - test/dummy/app/views/layouts/application.html.erb
160
- - test/dummy/app/views/layouts/mailer.html.erb
161
- - test/dummy/app/views/layouts/mailer.text.erb
162
- - test/dummy/app/views/layouts/_right_menu.html.erb
163
- - test/dummy/app/assets/config/manifest.js
164
- - test/dummy/app/assets/javascripts/cable.js
165
- - test/dummy/app/assets/javascripts/application.js
166
- - test/dummy/app/assets/stylesheets/application.css
209
+ - test/dummy/app/controllers/me_controller.rb
210
+ - test/dummy/app/controllers/my_controller.rb
167
211
  - test/dummy/app/helpers/application_helper.rb
168
- - test/dummy/app/channels/application_cable/connection.rb
169
- - test/dummy/app/channels/application_cable/channel.rb
170
- - test/dummy/bin/update
171
- - test/dummy/bin/rake
172
- - test/dummy/bin/setup
212
+ - test/dummy/app/jobs/application_job.rb
213
+ - test/dummy/app/mailers/application_mailer.rb
214
+ - test/dummy/app/models/auth/user.rb
215
+ - test/dummy/app/views/home/index.css
216
+ - test/dummy/app/views/home/index.html.erb
217
+ - test/dummy/app/views/layouts/_right_menu.html.erb
173
218
  - test/dummy/bin/bundle
174
219
  - test/dummy/bin/rails
175
- - test/dummy/config/database.yml.mysql
176
- - test/dummy/config/secrets.yml
177
- - test/dummy/config/routes.rb
178
- - test/dummy/config/locales/en.yml
220
+ - test/dummy/bin/rake
221
+ - test/dummy/bin/setup
222
+ - test/dummy/bin/vite
223
+ - test/dummy/bin/yarn
224
+ - test/dummy/config/application.rb
225
+ - test/dummy/config/boot.rb
179
226
  - test/dummy/config/cable.yml
180
- - test/dummy/config/environments/production.rb
227
+ - test/dummy/config/credentials/development.key
228
+ - test/dummy/config/credentials/test.key
229
+ - test/dummy/config/credentials.yml.enc
230
+ - test/dummy/config/database.yml
231
+ - test/dummy/config/environment.rb
181
232
  - test/dummy/config/environments/development.rb
233
+ - test/dummy/config/environments/production.rb
182
234
  - test/dummy/config/environments/test.rb
183
- - test/dummy/config/spring.rb
184
- - test/dummy/config/environment.rb
185
- - test/dummy/config/application.rb
186
- - test/dummy/config/puma.rb
187
- - test/dummy/config/database.yml.sqlite3
188
- - test/dummy/config/boot.rb
189
235
  - test/dummy/config/initializers/application_controller_renderer.rb
190
236
  - test/dummy/config/initializers/backtrace_silencers.rb
191
- - test/dummy/config/initializers/mime_types.rb
237
+ - test/dummy/config/initializers/cookies_serializer.rb
192
238
  - test/dummy/config/initializers/filter_parameter_logging.rb
239
+ - test/dummy/config/initializers/inflections.rb
240
+ - test/dummy/config/initializers/mime_types.rb
241
+ - test/dummy/config/initializers/new_framework_defaults.rb
193
242
  - test/dummy/config/initializers/session_store.rb
194
243
  - test/dummy/config/initializers/wrap_parameters.rb
195
- - test/dummy/config/initializers/new_framework_defaults.rb
196
- - test/dummy/config/initializers/assets.rb
197
- - test/dummy/config/initializers/cookies_serializer.rb
198
- - test/dummy/config/initializers/inflections.rb
244
+ - test/dummy/config/locales/en.yml
245
+ - test/dummy/config/master.key
246
+ - test/dummy/config/puma.rb
247
+ - test/dummy/config/routes.rb
248
+ - test/dummy/config/spring.rb
249
+ - test/dummy/config/storage.yml
250
+ - test/dummy/config/vite/base.js
251
+ - test/dummy/config/vite/development.js
252
+ - test/dummy/config/vite/production.js
199
253
  - test/dummy/config.ru
200
- - test/dummy/README.md
201
- - test/dummy/Rakefile
202
- - test/dummy/yarn.lock
203
- - test/dummy/public/favicon.ico
254
+ - test/dummy/lib/deploy.rb
255
+ - test/dummy/package.json
256
+ - test/dummy/postcss.config.js
257
+ - test/dummy/public/404.html
204
258
  - test/dummy/public/422.html
205
- - test/dummy/public/apple-touch-icon.png
206
259
  - test/dummy/public/500.html
207
- - test/dummy/public/404.html
208
260
  - test/dummy/public/apple-touch-icon-precomposed.png
209
- - test/dummy/package.json
210
- - test/dummy/db/migrate/20180525090830_create_active_storage_tables.active_storage.rb
211
- - test/dummy/log/development.log
261
+ - test/dummy/public/apple-touch-icon.png
262
+ - test/dummy/public/favicon.ico
263
+ - test/dummy/yarn.lock
264
+ - test/factories/approvals.rb
265
+ - test/factories/infos.rb
212
266
  - test/integration/navigation_test.rb
213
- - test/the_audit_test.rb
267
+ - test/rails_audit_test.rb
214
268
  - test/test_helper.rb
@@ -1,12 +0,0 @@
1
- class Admin::AuditsController < Admin::BaseController
2
-
3
- def index
4
- @audits = Audit.where(auditable_type: params[:auditable_type], auditable_id: params[:auditable_id]).page(params[:page])
5
-
6
- respond_to do |format|
7
- format.html
8
- format.js
9
- end
10
- end
11
-
12
- end
@@ -1,14 +0,0 @@
1
- class Audit < ApplicationRecord
2
- serialize :audited_changes, Hash
3
- serialize :related_changes, Hash
4
- serialize :unconfirmed_changes, Hash
5
- serialize :extra, Hash
6
-
7
- belongs_to :auditable, polymorphic: true
8
- belongs_to :operator, polymorphic: true
9
-
10
- def audited_changes_i18n
11
- audited_changes.transform_keys { |key| auditable.class.human_attribute_name(key) }
12
- end
13
-
14
- end
@@ -1,59 +0,0 @@
1
- module Auditable
2
- extend ActiveSupport::Concern
3
- IGNORE = ['updated_at']
4
-
5
- included do
6
- has_many :audits, as: :auditable
7
- end
8
-
9
- # user: {
10
- # id: 1,
11
- # changes: {
12
- # name: ['a', 'b']
13
- # }
14
- # }
15
-
16
- def save_audits(operator: current_operator, include: [], **extra_options)
17
- audit = self.audits.build
18
- audit.audited_changes = self.saved_changes.except(*IGNORE)
19
- audit.unconfirmed_changes = self.changes
20
-
21
- if include.present?
22
- result = {}
23
-
24
- include.each do |key|
25
- targets = self.send(key)
26
- result[key] = []
27
-
28
- Array(targets).each do |target|
29
- _saved_changes = target.saved_changes.except(*IGNORE)
30
- _changes = target.changes
31
-
32
- if _saved_changes.present? || _changes.present?
33
- result[key] << {
34
- id: target.id,
35
- saved_changes: _saved_changes,
36
- changes: _changes
37
- }
38
- end
39
- end
40
- end
41
-
42
- audit.related_changes = result
43
- end
44
-
45
- if self.destroyed?
46
- audit.action = 'destroy'
47
- end
48
-
49
- audit.operator_type = operator.class.name
50
- audit.operator_id = operator.id
51
- audit.note = extra_options.delete(:note)
52
- audit.controller_path = extra_options.delete(:controller_path)
53
- audit.action_name = extra_options.delete(:action_name)
54
- audit.remote_ip = extra_options.delete(:remote_ip)
55
- audit.extra = extra_options
56
- audit.save
57
- end
58
-
59
- end
@@ -1,36 +0,0 @@
1
- class History < ApplicationRecord
2
- paginates_per 10
3
-
4
- belongs_to :wiki
5
- belongs_to :knowledge
6
- belongs_to :commit, class_name: 'User', foreign_key: 'commit_id'
7
- validates :commit_id, presence: true
8
- validates :active, uniqueness: { scope: :knowledge_id }
9
-
10
- enum status: [:status_initial, :status_passed]
11
-
12
- default_scope -> { order(id: :desc) }
13
- def set_active
14
- self.class.where.not(id: self.id).where(knowledge_id: self.knowledge_id).update_all(active: false)
15
- self.update(active: true)
16
- move_to_wiki
17
- end
18
-
19
- end
20
-
21
- # :item_id, :integer
22
- # :user_id, :integer
23
- # :content, :string, limit: 65535
24
- # :commit_id, :integer
25
- # :commit_message, :string
26
- #
27
- # t.integer "wiki_id", limit: 4
28
- # t.integer "knowledge_id", limit: 4
29
- # t.text "body", limit: 65535
30
- # t.string "commit_message", limit: 4096
31
- # t.datetime "created_at"
32
- # t.datetime "updated_at"
33
- # t.integer "commit_id", limit: 4
34
- # t.boolean "active", default: false
35
- # t.integer "status", limit: 4, default: 0
36
- # t.string "type", limit: 255
@@ -1,14 +0,0 @@
1
- class MajorRecord < ApplicationRecord
2
-
3
- belongs_to :knowledge, counter_cache: true
4
-
5
- def move_to_wiki
6
- wiki = knowledge.major || knowledge.build_major
7
- wiki.commit_id = self.commit_id
8
- wiki.commit_message = self.commit_message
9
- wiki.body = self.body
10
- wiki.save
11
- end
12
-
13
- end
14
-
@@ -1,15 +0,0 @@
1
- class MinorRecord < ApplicationRecord
2
-
3
- belongs_to :knowledge, counter_cache: true
4
-
5
- def move_to_wiki
6
- wiki = knowledge.minor || knowledge.build_minor
7
- wiki.commit_id = self.commit_id
8
- wiki.commit_message = self.commit_message
9
- wiki.body = self.body
10
- wiki.save
11
- end
12
-
13
- end
14
-
15
-
@@ -1,9 +0,0 @@
1
- <div class="ui modal" id="audits_index">
2
- <i class="close icon"></i>
3
- <div class="ui header blue">
4
- 系统日志
5
- </div>
6
- <div class="content">
7
- <%= render 'table' %>
8
- </div>
9
- </div>
@@ -1,61 +0,0 @@
1
- <table class="ui table">
2
- <thead>
3
- <tr>
4
- <th>Operator</th>
5
- <th>Note</th>
6
- <th>Changes</th>
7
- <th>Related Changes</th>
8
- </tr>
9
- </thead>
10
-
11
- <tbody>
12
- <% @audits.each do |audit| %>
13
- <tr id="audit_<%= audit.id %>">
14
- <td>
15
- <p><%= audit.operator&.name %></p>
16
- <p><%= audit.action %></p>
17
- <p><time><%= audit.created_at.to_s(:rfc822) %></time></p>
18
- <div class="ui labels">
19
- <span class="ui label">Action: <%= audit.action %></span>
20
- <span class="ui label">Path: <%= audit.controller_path %>/<%= audit.action_name %></span>
21
- </div>
22
- <p>IP: <%= audit.remote_ip %></p>
23
- </td>
24
- <td><%= audit.note %></td>
25
- <td class="ui list">
26
- <% audit.audited_changes_i18n.each do |key, value| %>
27
- <div class="item">
28
- <div class="ui label">
29
- <%= key %>:
30
- <div class="detail">
31
- <span><%= value[0] %></span>
32
- <i class="arrow circle right icon grey"></i>
33
- <span><%= value[1] %></span>
34
- </div>
35
- </div>
36
- </div>
37
- <% end %>
38
- </td>
39
- <td>
40
- <% audit.related_changes.each do |key, value| %>
41
- <% value.each do |relate| %>
42
- <div class="ui segment">
43
- <span class="ui blue label"><%= key %>: <%= relate[:id] %></span>
44
- <div class="ui divider"></div>
45
- <% relate[:changes].each do |k, v| %>
46
- <div class="ui label"><%= k %>: </div>
47
- <%= v[0] %>
48
- <i class="arrow circle right icon grey"></i>
49
- <%= v[1] %>
50
- <% end %>
51
- </div>
52
- <% end %>
53
- <% end %>
54
- </td>
55
- </tr>
56
- <% end %>
57
- </tbody>
58
- </table>
59
-
60
-
61
-
@@ -1,3 +0,0 @@
1
-
2
-
3
-
@@ -1,8 +0,0 @@
1
- if ($('.ui.modals').length === 0) {
2
- $('body').append('<%= j(render 'index') %>');
3
- } else {
4
- $('.ui.modals').html('<%= j(render 'index') %>');
5
- }
6
-
7
-
8
- $('#audits_index').modal('setting', {autofocus: false}).modal('show');