Commit d69ac9e3 authored by Ondřej Ezr's avatar Ondřej Ezr
Browse files

Add audits to Redemption detail

parent cabad35c
Pipeline #37 failed with stages
......@@ -7,7 +7,7 @@ PATH
PATH
remote: ../egov_utils
specs:
egov_utils (0.4.17)
egov_utils (0.4.18)
activeresource (~> 5.1)
audited (~> 4.4)
azahara_schema (~> 0.3)
......@@ -39,71 +39,71 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.3)
actionpack (= 5.2.3)
actioncable (5.2.4.3)
actionpack (= 5.2.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
actionmailer (5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
rack (~> 2.0)
actionpack (5.2.4.3)
actionview (= 5.2.4.3)
activesupport (= 5.2.4.3)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.3)
activesupport (= 5.2.3)
actionview (5.2.4.3)
activesupport (= 5.2.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.3)
activesupport (= 5.2.3)
activejob (5.2.4.3)
activesupport (= 5.2.4.3)
globalid (>= 0.3.6)
activemodel (5.2.3)
activesupport (= 5.2.3)
activemodel (5.2.4.3)
activesupport (= 5.2.4.3)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.4.3)
activemodel (= 5.2.4.3)
activesupport (= 5.2.4.3)
arel (>= 9.0)
activeresource (5.1.0)
activeresource (5.1.1)
activemodel (>= 5.0, < 7)
activemodel-serializers-xml (~> 1.0)
activesupport (>= 5.0, < 7)
activestorage (5.2.3)
actionpack (= 5.2.3)
activerecord (= 5.2.3)
activestorage (5.2.4.3)
actionpack (= 5.2.4.3)
activerecord (= 5.2.4.3)
marcel (~> 0.3.1)
activesupport (5.2.3)
activesupport (5.2.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
airbrussh (1.3.1)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
akami (1.3.1)
gyoku (>= 0.4.0)
nokogiri
apipie-rails (0.5.15)
apipie-rails (0.5.18)
rails (>= 4.1)
arel (9.0.0)
audited (4.8.0)
activerecord (>= 4.0, < 5.3)
autoprefixer-rails (9.5.1)
audited (4.9.0)
activerecord (>= 4.2, < 6.1)
autoprefixer-rails (9.8.4)
execjs
bcrypt (3.1.12)
bindex (0.7.0)
bcrypt (3.1.13)
bindex (0.8.1)
bootstrap (4.1.3)
autoprefixer-rails (>= 6.0.3)
popper_js (>= 1.12.9, < 2)
......@@ -114,26 +114,26 @@ GEM
momentjs-rails (>= 2.10.5, <= 3.0.0)
bootstrap_form (4.0.0)
rails (>= 5.0)
builder (3.2.3)
byebug (11.0.1)
builder (3.2.4)
byebug (11.1.3)
cancancan (2.3.0)
capistrano (3.11.0)
capistrano (3.14.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (1.5.0)
capistrano-bundler (1.6.0)
capistrano (~> 3.1)
capistrano-rails (1.4.0)
capistrano-rails (1.5.0)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-sidekiq (1.0.2)
capistrano-sidekiq (1.0.3)
capistrano (>= 3.9.0)
sidekiq (>= 3.4)
sidekiq (>= 3.4, < 6.0)
capistrano3-unicorn (0.2.1)
capistrano (~> 3.1, >= 3.1.0)
clipboard-rails (1.7.1)
coderay (1.1.2)
coderay (1.1.3)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
......@@ -141,18 +141,18 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
connection_pool (2.2.2)
cookies_eu (1.7.5)
concurrent-ruby (1.1.6)
connection_pool (2.2.3)
cookies_eu (1.7.6)
js_cookie_rails (~> 2.2.0)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.4)
database_cleaner (1.7.0)
diff-lcs (1.3)
crass (1.0.6)
database_cleaner (1.8.5)
diff-lcs (1.4.2)
egon_gate (0.1.0)
savon (~> 2.11.0)
erubi (1.8.0)
erubi (1.9.0)
execjs (2.7.0)
factory_bot (4.11.1)
activesupport (>= 3.0.0)
......@@ -160,32 +160,31 @@ GEM
factory_bot (~> 4.11.1)
railties (>= 3.0.0)
ffi (1.9.25)
font-awesome-sass (5.8.1)
font-awesome-sass (5.13.0)
sassc (>= 1.11)
globalid (0.4.2)
activesupport (>= 4.2.0)
gyoku (1.3.1)
builder (>= 2.1.2)
haml (5.0.4)
haml (5.1.2)
temple (>= 0.8.0)
tilt
hashdiff (0.3.8)
httparty (0.16.4)
hashdiff (1.0.1)
httparty (0.18.1)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
httpi (2.4.4)
rack
socksify
i18n (1.6.0)
i18n (1.8.3)
concurrent-ruby (~> 1.0)
i18n-debug (1.2.0)
i18n (< 2)
i18n-js (3.2.1)
i18n-js (3.7.0)
i18n (>= 0.6.6)
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-rails (4.3.3)
jbuilder (2.10.0)
activesupport (>= 5.0.0)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
......@@ -193,13 +192,13 @@ GEM
railties (>= 3.2.16)
js_cookie_rails (2.2.0)
railties (>= 3.1)
kgio (2.11.2)
libv8 (6.7.288.46.1)
kgio (2.11.3)
libv8 (7.3.492.27.1)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.3)
loofah (2.6.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
magic_lamp (1.9.0)
......@@ -210,104 +209,103 @@ GEM
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mime-types (3.2.2)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mimemagic (0.3.3)
mini_mime (1.0.1)
mime-types-data (3.2020.0512)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
mini_racer (0.2.4)
libv8 (>= 6.3)
minitest (5.11.3)
mini_racer (0.2.14)
libv8 (> 7.3)
minitest (5.14.1)
modernizr-rails (2.7.1)
moment-timezone-rails (1.0.0)
momentjs-rails (>= 2.10.5, <= 3.0.0)
momentjs-rails (2.20.1)
railties (>= 3.1)
money (6.13.3)
money (6.13.7)
i18n (>= 0.6.4, <= 2)
multi_json (1.13.1)
multi_xml (0.6.0)
net-ldap (0.16.1)
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
net-ssh (5.2.0)
nio4r (2.3.1)
nokogiri (1.10.2)
net-ldap (0.16.2)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
nio4r (2.5.2)
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
nori (2.6.0)
paranoia (2.4.1)
activerecord (>= 4.0, < 5.3)
pg (1.1.4)
popper_js (1.14.5)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
paranoia (2.4.2)
activerecord (>= 4.0, < 6.1)
pg (1.2.3)
popper_js (1.16.0)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (3.0.3)
puma (3.12.1)
rack (2.0.7)
rack-protection (2.0.5)
public_suffix (4.0.5)
puma (3.12.6)
rack (2.2.3)
rack-protection (2.0.8.1)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
activerecord (= 5.2.3)
activestorage (= 5.2.3)
activesupport (= 5.2.3)
rails (5.2.4.3)
actioncable (= 5.2.4.3)
actionmailer (= 5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
activemodel (= 5.2.4.3)
activerecord (= 5.2.4.3)
activestorage (= 5.2.4.3)
activesupport (= 5.2.4.3)
bundler (>= 1.3.0)
railties (= 5.2.3)
railties (= 5.2.4.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails-i18n (5.1.3)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
railties (5.2.4.3)
actionpack (= 5.2.4.3)
activesupport (= 5.2.4.3)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
raindrops (0.19.0)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
raindrops (0.19.1)
rake (13.0.1)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.1.0)
redis (4.1.4)
request_store_rails (1.0.3)
concurrent-ruby (~> 1.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-sidekiq (3.0.3)
rspec-support (~> 3.9.0)
rspec-rails (4.0.1)
actionpack (>= 4.2)
activesupport (>= 4.2)
railties (>= 4.2)
rspec-core (~> 3.9)
rspec-expectations (~> 3.9)
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-sidekiq (3.1.0)
rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0)
rspec-support (3.8.0)
rspec-support (3.9.3)
ruby_dep (1.5.0)
safe_yaml (1.0.5)
sass (3.7.4)
......@@ -334,16 +332,15 @@ GEM
nori (~> 2.4)
wasabi (~> 3.4)
settingslogic (2.0.9)
sidekiq (5.2.6)
sidekiq (5.2.9)
connection_pool (~> 2.2, >= 2.2.2)
rack (>= 1.5.0)
rack (~> 2.0)
rack-protection (>= 1.5.0)
redis (>= 3.3.5, < 5)
redis (>= 3.3.5, < 4.2)
signer (1.9.0)
nokogiri (>= 1.5.1)
socksify (1.7.1)
spring (2.0.2)
activesupport (>= 4.2)
spring (2.1.0)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
......@@ -354,23 +351,23 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.18.2)
sshkit (1.21.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
teaspoon (1.1.5)
railties (>= 3.2.5, < 6)
teaspoon (1.2.0)
railties (>= 3.2.5)
teaspoon-mocha (2.3.3)
teaspoon (>= 1.0.0)
temple (0.8.1)
thor (0.20.3)
temple (0.8.2)
thor (1.0.1)
thread_safe (0.3.6)
tilt (2.0.9)
turbolinks (5.2.0)
tilt (2.0.10)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.5)
tzinfo (1.2.7)
thread_safe (~> 0.1)
uglifier (4.1.20)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicorn (5.4.1)
kgio (~> 2.6)
......@@ -384,13 +381,13 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webmock (3.5.1)
webmock (3.8.3)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.7.0)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.2)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
websocket-extensions (0.1.5)
xmldsig (0.6.6)
nokogiri (>= 1.6.8, < 2.0.0)
......@@ -431,6 +428,7 @@ DEPENDENCIES
signer (~> 1.6)
spring
spring-watcher-listen (~> 2.0.0)
sprockets (~> 3.7)
teaspoon-mocha
turbolinks (~> 5)
tzinfo-data
......@@ -441,4 +439,4 @@ DEPENDENCIES
xmldsig (~> 0.6)
BUNDLED WITH
1.16.4
2.1.4
......@@ -8,6 +8,7 @@ class RedemptionsController < ApplicationController
end
def show
@audit_schema = AuditSchema.new(@redemption.payment.audits, columns: ['created_at', 'user', 'changes'], outputs: ['grid'])
end
def new
......
class AuditSchema < AzaharaSchema::ModelSchema
def initialize(scope = nil, *attrs)
@audited_scope = scope
super(Audited::Audit, *attrs)
end
def base_scope
@audited_scope || super
end
end
......@@ -36,3 +36,30 @@
= fields.hidden_field(:redemption_id)
= fields.hidden_field(:value)
= f.submit
.audits{ style: 'font-size: 85%;' }
- audit_formatter = attribute_formatter_for(@audit_schema)
- payment_formatter = attribute_formatter_for(payment_schema = PaymentSchema.new)
%h5= Audited::Audit.model_name.human(count: :other)
%table.table
%thead
%th= Audited::Audit.human_attribute_name('created_at')
%th= Audited::Audit.human_attribute_name('audited_changes')
%th= Audited::Audit.human_attribute_name('comment')
%tbody
- @audit_schema.entities.reorder(version: :desc).each do |audit|
- changes = audit.audited_changes.select { |n, ch| !ch.nil? && !%w(direction currency_code).include?(n) }
- next unless changes.any?
%tr
%td= audit_formatter.html_formatted_value(@audit_schema.attribute('created_at'), audit)
%td
- changes.each do |name, change|
.change
%b= payment_formatter.attribute_html_label(payment_schema.attribute(name)) + ': '
- if audit.action == 'create'
= payment_formatter.human_value(payment_schema.attribute(name), change)
- elsif audit.action == 'update'
= payment_formatter.human_value(payment_schema.attribute(name), change.first)
= ' -> '
= payment_formatter.human_value(payment_schema.attribute(name), change.second)
%td= audit_formatter.html_formatted_value(@audit_schema.attribute('comment'), audit)
compensator = FactoryBot.create(:egov_utils_user, lastname: 'Compensator', mail: 'compensator@example.com', roles: ['compensator'])
FactoryBot.create(:redemption, author: compensator)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment