rails_audit 1.0.2 → 1.0.3

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: 6d50c98345e6f706bd94e663c32e2c7828e0827f4f9a20cfef5cd9a9c2449485
4
- data.tar.gz: 1e3eebf5617f1ac04c2b48c557e28b091872f3981a41708ab6d20371e293d34f
3
+ metadata.gz: 67897d442197db804293d954208b48bfcaceadd7730310cba9f0d3ee724c693e
4
+ data.tar.gz: c8a2ed471e28ca72fc846998e06823ba9d598a1d434fa90bc690145ea1cf1622
5
5
  SHA512:
6
- metadata.gz: e91b1cf7a13adeb1c95635e17643e7d02283dadbec0869ca45468e780f6d5f515560db29840952b80c16c79e4d7dabc001212d5b21e92dcac4d062fe49317235
7
- data.tar.gz: fa650178970ab4c665ebb84d90dfc66970452af276d27f06d08ffc42f1745214138fac51b393d82bafebcb81d984a60c39b528d9127b1499bc761017ec558537
6
+ metadata.gz: b9501a18ac159a5e516d6f1593393de260286a4c9f37c7892974d919d3a397bdaf0ecc155d709a5b7500de28aa3ec62a5ad865bcc5ff7bc237e337e347518dec
7
+ data.tar.gz: 90276e232870b03aeb98d7da0d2994c952674e1f7f0286425259e91d94a99715b55604d3d168e1b6f797a869ae154b6224f906f4e1a332674988f6c81ea7cb29
data/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
1
  GNU LESSER GENERAL PUBLIC LICENSE
2
2
  Version 3, 29 June 2007
3
3
 
4
- Copyright (C) 2018 Mingyuan Qin.
4
+ Copyright (C) 2019 Mingyuan Qin.
5
5
  Everyone is permitted to copy and distribute verbatim copies
6
6
  of this license document, but changing it is not allowed.
7
7
 
@@ -1,5 +1,7 @@
1
- class Audit::Admin::BaseController < RailsAudit.config.app_class.constantize
2
- default_form_builder 'RailsAuditFormBuilder'
1
+ class Audit::Admin::BaseController < RailsAudit.config.admin_class.constantize
3
2
 
3
+ def current_operator
4
+ @current_operator ||= send(RailsAudit.config.current_operator)
5
+ end
4
6
 
5
7
  end
@@ -54,11 +54,11 @@ class Audit::Admin::ChecksController < Audit::Admin::BaseController
54
54
  def check_params
55
55
  q = params.fetch(:check, {}).permit(
56
56
  :comment,
57
- :verified,
57
+ :confirmed,
58
58
  :state
59
59
  )
60
60
  q.merge! checking_type: params[:checking_type], checking_id: params[:checking_id]
61
- q.merge! member_id: current_member.id
61
+ q.merge! operator_type: current_operator.class.name, operator_id: current_operator.id
62
62
  q
63
63
  end
64
64
 
@@ -0,0 +1,9 @@
1
+ module CheckMachine
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ include StateMachine
6
+ has_many :checks, as: :checking
7
+ end
8
+
9
+ end
@@ -1,13 +1,13 @@
1
1
  class Check < ApplicationRecord
2
- attribute :verified, :boolean, default: true
2
+ attribute :confirmed, :boolean, default: true
3
3
 
4
4
  belongs_to :checking, polymorphic: true
5
- belongs_to :member
5
+ belongs_to :operator, polymorphic: true
6
6
 
7
7
  after_create_commit :checking_trigger
8
8
 
9
9
  def checking_trigger
10
- if self.verified
10
+ if self.confirmed
11
11
  checking.do_trigger state: self.state
12
12
  end
13
13
  end
@@ -0,0 +1,16 @@
1
+ <table class="ui very basic table">
2
+ <% target.checks.each do |check| %>
3
+ <tr>
4
+ <td>
5
+ <span class="ui label"><%= target.class.enum_i18n(:state, check.state) %></span>
6
+ <% if check.confirmed? %>
7
+ <i class="green check icon"></i>
8
+ <% else %>
9
+ <i class="red question icon"></i>
10
+ <% end %>
11
+ </td>
12
+ <td><%= check.comment %></td>
13
+ <td><%= check.operator.name %></td>
14
+ </tr>
15
+ <% end %>
16
+ </table>
@@ -1,7 +1,7 @@
1
1
  <div class="ui modal" id="modal">
2
2
  <i class="close icon"></i>
3
3
  <div class="ui header blue">
4
- Add Note
4
+ <%= t('.check') %>
5
5
  </div>
6
6
 
7
7
  <div class="content">
@@ -9,9 +9,9 @@
9
9
  <%= render 'shared/error_messages', target: @check %>
10
10
  <%= f.hidden_field :state %>
11
11
  <%= f.text_area :comment %>
12
- <%= f.check_box :verified %>
12
+ <%= f.check_box :confirmed %>
13
13
  <%= f.submit %>
14
14
  <% end %>
15
15
  </div>
16
16
 
17
- </div>
17
+ </div>
@@ -5,5 +5,12 @@
5
5
  </div>
6
6
 
7
7
  <div class="ui segment">
8
- <%= render 'form' %>
9
- </div>
8
+ <%= form_with model: @check, local: true do |f| %>
9
+ <%= render 'shared/error_messages', target: @check %>
10
+ <%= f.number_field :member_id %>
11
+ <%= f.text_field :comment %>
12
+ <%= f.check_box :confirmed %>
13
+ <%= f.number_field :position %>
14
+ <%= f.submit %>
15
+ <% end %>
16
+ </div>
@@ -0,0 +1,12 @@
1
+ en:
2
+ audit/admin:
3
+ checks:
4
+ new:
5
+ check: 审核
6
+ activerecord:
7
+ models:
8
+ check: 审核
9
+ attributes:
10
+ check:
11
+ confirmed: 确认?
12
+ comment: 备注
@@ -0,0 +1,12 @@
1
+ zh:
2
+ audit/admin:
3
+ checks:
4
+ new:
5
+ check: 审核
6
+ activerecord:
7
+ models:
8
+ check: 审核
9
+ attributes:
10
+ check:
11
+ confirmed: 确认?
12
+ comment: 备注
@@ -1,6 +1,6 @@
1
- class CreateAudits < ActiveRecord::Migration[5.1]
1
+ class RailsAuditInit < ActiveRecord::Migration[5.1]
2
2
  def change
3
-
3
+
4
4
  create_table :audits do |t|
5
5
  t.references :auditable, polymorphic: true
6
6
  t.references :operator, polymorphic: true
@@ -15,6 +15,21 @@ class CreateAudits < ActiveRecord::Migration[5.1]
15
15
  t.string :extra, limit: 4096
16
16
  t.datetime :created_at, index: true, null: false
17
17
  end
18
-
18
+
19
+ create_table :checks do |t|
20
+ t.references :checking, polymorphic: true
21
+ t.references :operator, polymorphic: true
22
+ t.string :state
23
+ t.string :comment
24
+ t.boolean :confirmed, default: true
25
+ t.timestamps
26
+ end
27
+
28
+ create_table :check_settings do |t|
29
+ t.references :checking, polymorphic: true
30
+ t.string :code
31
+ t.timestamps
32
+ end
33
+
19
34
  end
20
35
  end
@@ -7,6 +7,7 @@ module RailsAudit #:nodoc:
7
7
  config.app_class = 'ApplicationController'
8
8
  config.my_class = 'MyController'
9
9
  config.admin_class = 'AdminController'
10
+ config.current_operator = :current_user
10
11
  end
11
12
 
12
13
  end
@@ -2,8 +2,7 @@ module RailsAudit
2
2
  class Engine < ::Rails::Engine
3
3
 
4
4
  config.eager_load_paths += Dir[
5
- "#{config.root}/app/models/rails_audit",
6
- "#{config.root}/app/models/rails_audit/concerns"
5
+ "#{config.root}/app/models/rails_audit"
7
6
  ]
8
7
 
9
8
  end
@@ -1,3 +1,3 @@
1
1
  module RailsAudit
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
@@ -0,0 +1,8 @@
1
+ class AdminController < ApplicationController
2
+ include RailsAuthController
3
+
4
+ default_form_builder 'AdminBuilder' do |config|
5
+
6
+ end
7
+
8
+ end
@@ -0,0 +1,3 @@
1
+ class ApiController < ActionController::API
2
+
3
+ end
@@ -1,4 +1,4 @@
1
- class My::BaseController < ApplicationController
1
+ class MyController < ApplicationController
2
2
  include RailsAuthController
3
3
  before_action :require_login_from_session
4
4
 
@@ -1,4 +1,4 @@
1
1
  class User < ApplicationRecord
2
2
  has_one_attached :avatar
3
- include RailsAuthUser
3
+
4
4
  end
@@ -0,0 +1 @@
1
+ N4kJIGMXbRXdmE9rFepLqUOB8d1J/Ai93p6x/Y+8YcrBP1+oqFZWj11SwNyrXWiNr+5yhuu7akvenuUY4MQ+KPwF1ZecFxSez1fjOMYRZrKmxzpWyD8E9EIAvTgJlJ7Pak/cYSgUBxb5iaNPoDEV5lE/nQ/rfRpMlsw6pJIxl4SSkQl3NLlS9ve/Swzxoy3CyrBDCRfrTLCQRoKJ1tMXoGRh+bND/Kn3Oxzj1n15QQrgoGYX8ILGEp+s1wvymt8qYsYxi2wk03gmNUhV5I7jFcGklawkuPEguKb4QNndxLt7oKfLu5yd73N0xjJ8/XYzeuSbfq8E3UHejydpkDCVudHK/Ph8lsv0L3s2wGNMgpiUOnovs8eY8marXcZRwdPSr/pFTiMY8G+7bKyvC4+i9dFhuTCZj9Ixj6hBls/pDRQpDSlOtAd1R/oblJtVDmwDZP5Ud4w8ecKfhE5wQRKd96iSv42ktTqsqj+ucBUptiVBmLGoWIshjRAqFMEoAXMw2EtsT3zKzevVGNcOdpGNUkg8KLaPHdl6ySDOhQ5RzsY7o0MUoMKWLDQ=--WwCj2066Qf/eytYh--RdGloM5S4PoKV9d5fmCI7A==
@@ -45,6 +45,8 @@ Rails.application.configure do
45
45
  # Suppress logger output for asset requests.
46
46
  config.assets.quiet = true
47
47
 
48
+ config.active_storage.service = :qiniu
49
+
48
50
  # Raises error for missing translations
49
51
  # config.action_view.raise_on_missing_translations = true
50
52
 
@@ -52,3 +54,5 @@ Rails.application.configure do
52
54
  # routes, locales, etc. This feature depends on the listen gem.
53
55
  # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
54
56
  end
57
+
58
+ ENV['EDITOR'] = 'code --wait'
@@ -1,3 +1,11 @@
1
1
  local_test:
2
2
  service: Disk
3
- root: <%= Rails.root.join('tmp/storage') %>
3
+ root: <%= Rails.root.join('tmp/storage') %>
4
+
5
+ qiniu:
6
+ service: Qiniu
7
+ host: assets-yigenongfu.one.work
8
+ access_key: <%= Rails.application.credentials.dig(:qiniu, :access_key) %>
9
+ secret_key: <%= Rails.application.credentials.dig(:qiniu, :secret_key) %>
10
+ bucket: yigenongfu
11
+ protocol: http
@@ -4,6 +4,7 @@ class CreateUsers < ActiveRecord::Migration[5.2]
4
4
  t.string :name
5
5
  t.string :email
6
6
  t.string :mobile
7
+ t.string :password_digest
7
8
  t.timestamps
8
9
  end unless table_exists?(:users)
9
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - qinmingyuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-10 00:00:00.000000000 Z
11
+ date: 2018-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '6.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rails_com
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.2'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.2'
33
47
  description: Description of RailsAudit.
34
48
  email:
35
49
  - mingyuan0715@foxmail.com
@@ -44,10 +58,12 @@ files:
44
58
  - app/controllers/audit/admin/base_controller.rb
45
59
  - app/controllers/audit/admin/check_settings_controller.rb
46
60
  - app/controllers/audit/admin/checks_controller.rb
61
+ - app/models/concerns/auditable.rb
62
+ - app/models/concerns/check_machine.rb
47
63
  - app/models/rails_audit/audit.rb
48
64
  - app/models/rails_audit/check.rb
49
65
  - app/models/rails_audit/check_setting.rb
50
- - app/models/rails_audit/concerns/auditable.rb
66
+ - app/views/audit/_checks.html.erb
51
67
  - app/views/audit/admin/audits/_index.html.erb
52
68
  - app/views/audit/admin/audits/_table.html.erb
53
69
  - app/views/audit/admin/audits/index.html.erb
@@ -58,7 +74,6 @@ files:
58
74
  - app/views/audit/admin/check_settings/index.html.erb
59
75
  - app/views/audit/admin/check_settings/new.html.erb
60
76
  - app/views/audit/admin/check_settings/show.html.erb
61
- - app/views/audit/admin/checks/_form.html.erb
62
77
  - app/views/audit/admin/checks/_new.html.erb
63
78
  - app/views/audit/admin/checks/_search_form.html.erb
64
79
  - app/views/audit/admin/checks/create.js.erb
@@ -67,14 +82,15 @@ files:
67
82
  - app/views/audit/admin/checks/new.html.erb
68
83
  - app/views/audit/admin/checks/new.js.erb
69
84
  - app/views/audit/admin/checks/show.html.erb
85
+ - config/locales/en.yml
86
+ - config/locales/zh.yml
70
87
  - config/routes.rb
71
- - db/migrate/20170314035239_create_audits.rb
88
+ - db/migrate/20170314035239_rails_audit_init.rb
72
89
  - lib/rails_audit.rb
73
90
  - lib/rails_audit/config.rb
74
91
  - lib/rails_audit/controller_helper.rb
75
92
  - lib/rails_audit/engine.rb
76
93
  - lib/rails_audit/version.rb
77
- - lib/tasks/the_history_tasks.rake
78
94
  - test/dummy/README.md
79
95
  - test/dummy/Rakefile
80
96
  - test/dummy/app/assets/config/manifest.js
@@ -85,10 +101,11 @@ files:
85
101
  - test/dummy/app/assets/stylesheets/application.css
86
102
  - test/dummy/app/channels/application_cable/channel.rb
87
103
  - test/dummy/app/channels/application_cable/connection.rb
88
- - test/dummy/app/controllers/admin/base_controller.rb
104
+ - test/dummy/app/controllers/admin_controller.rb
105
+ - test/dummy/app/controllers/api_controller.rb
89
106
  - test/dummy/app/controllers/application_controller.rb
90
107
  - test/dummy/app/controllers/home_controller.rb
91
- - test/dummy/app/controllers/my/base_controller.rb
108
+ - test/dummy/app/controllers/my_controller.rb
92
109
  - test/dummy/app/helpers/application_helper.rb
93
110
  - test/dummy/app/jobs/application_job.rb
94
111
  - test/dummy/app/mailers/application_mailer.rb
@@ -110,6 +127,7 @@ files:
110
127
  - test/dummy/config/application.rb
111
128
  - test/dummy/config/boot.rb
112
129
  - test/dummy/config/cable.yml
130
+ - test/dummy/config/credentials.yml.enc
113
131
  - test/dummy/config/database.yml
114
132
  - test/dummy/config/database.yml.mysql
115
133
  - test/dummy/config/database.yml.sqlite3
@@ -164,7 +182,7 @@ files:
164
182
  - test/integration/navigation_test.rb
165
183
  - test/test_helper.rb
166
184
  - test/the_audit_test.rb
167
- homepage: https://github.com/yougexiangfa/rails_audit
185
+ homepage: https://github.com/work-design/rails_audit
168
186
  licenses:
169
187
  - LGPL-3.0
170
188
  metadata: {}
@@ -194,9 +212,10 @@ test_files:
194
212
  - test/dummy/app/models/user.rb
195
213
  - test/dummy/app/jobs/application_job.rb
196
214
  - test/dummy/app/controllers/application_controller.rb
197
- - test/dummy/app/controllers/admin/base_controller.rb
215
+ - test/dummy/app/controllers/api_controller.rb
216
+ - test/dummy/app/controllers/my_controller.rb
198
217
  - test/dummy/app/controllers/home_controller.rb
199
- - test/dummy/app/controllers/my/base_controller.rb
218
+ - test/dummy/app/controllers/admin_controller.rb
200
219
  - test/dummy/app/views/home/index.html.erb
201
220
  - test/dummy/app/views/layouts/_navbar.html.erb
202
221
  - test/dummy/app/views/layouts/application.html.erb
@@ -231,6 +250,7 @@ test_files:
231
250
  - test/dummy/config/storage.yml
232
251
  - test/dummy/config/application.rb
233
252
  - test/dummy/config/puma.rb
253
+ - test/dummy/config/credentials.yml.enc
234
254
  - test/dummy/config/database.yml
235
255
  - test/dummy/config/database.yml.sqlite3
236
256
  - test/dummy/config/boot.rb
@@ -1,8 +0,0 @@
1
- <%= form_with model: @check, local: true do |f| %>
2
- <%= render 'shared/error_messages', target: @check %>
3
- <%= f.number_field :member_id %>
4
- <%= f.text_field :comment %>
5
- <%= f.check_box :verified %>
6
- <%= f.number_field :position %>
7
- <%= f.submit %>
8
- <% end %>
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :the_history do
3
- # # Task goes here
4
- # end
@@ -1,7 +0,0 @@
1
- class Admin::BaseController < ApplicationController
2
-
3
- default_form_builder 'AdminBuilder' do |config|
4
-
5
- end
6
-
7
- end