effective_logging 1.10.7 → 1.10.8

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
  SHA1:
3
- metadata.gz: d829635a3ee649017e547dee63b92aa3971493b3
4
- data.tar.gz: 8f515ec5922a6e4861394bd426e7608d3cfcde88
3
+ metadata.gz: 920a2af8081f9e1e2fe559a021364991886fb1c5
4
+ data.tar.gz: 6f92283ff64d146864918064bf1c963dc12ef161
5
5
  SHA512:
6
- metadata.gz: 9c00de12b0954fa2372fa5b5cd6753781044bb992499a543035e218a6db85bf43363a52369c6052726496450e1b40a75bcd819cd64552b521a44d283eb2a5c34
7
- data.tar.gz: 9cb295a0bc4c563ddb4262dc37728151767a395773124e5d9c5146af1b116bb9c09ff5317960501034d97bf059dc76af50f0e3e60671e93d53918e33fc662f20
6
+ metadata.gz: c92036f53396c19543a05f374e10371506ab548eefa528bcf1d39a83871279af4a24a15e48f1a048a9078dc14ac30597fa643f694a7e64730bd7c37383d51074
7
+ data.tar.gz: e95c9fcfce61a22c01bc0e3b73f191705460efae4dcb852583a28e2c57572bdca49156a1551c0a31b3de7ba9d779caab57af54fe5f95bcd47d9ae254bab28662
@@ -13,7 +13,7 @@ unless Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
13
13
  elsif attributes[:user].present?
14
14
  col :user, search: { collection: User.where(id: Array(attributes[:user]).map { |user| user.to_param }) }
15
15
  else
16
- col :user, search: { as: :string }
16
+ col :user
17
17
  end
18
18
 
19
19
  unless attributes[:status] == false
@@ -21,14 +21,17 @@ unless Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
21
21
  end
22
22
 
23
23
  unless attributes[:log_changes]
24
- col :associated
25
- #col :associated_type, search: { as: :string }, visible: false
26
- #col :associated_id, search: { as: :integer }, visible: false, label: 'Associated Id'
27
- #col :associated_to_s, search: { as: :string }, label: 'Associated'
24
+ col :associated_type, search: { as: :string }, visible: false
25
+ col :associated_id, search: { as: :integer }, visible: false, label: 'Associated Id'
26
+ col :associated_to_s, search: { as: :string }, label: 'Associated'
28
27
  end
29
28
 
30
- col :message do |log|
31
- log.message.starts_with?("\t") ? log.message.gsub("\t", "&nbsp;&nbsp;") : log.message
29
+ if attributes[:log_changes]
30
+ col :message do |log|
31
+ log.message.starts_with?("\t") ? log.message.gsub("\t", "&nbsp;&nbsp;") : log.message
32
+ end
33
+ else
34
+ col :message
32
35
  end
33
36
 
34
37
  col :logs_count, visible: false
@@ -37,7 +40,9 @@ unless Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
37
40
  tableize_hash(log.details.except(:email), th: true, sub_th: false, width: '100%')
38
41
  end
39
42
 
40
- actions_col partial: 'admin/logs/actions', partial_as: :log
43
+ unless attributes[:actions] == false
44
+ actions_col partial: 'admin/logs/actions', partial_as: :log
45
+ end
41
46
  end
42
47
 
43
48
  # A nil attributes[:log_id] means give me all the top level log entries
@@ -6,7 +6,7 @@ module ActsAsLoggable
6
6
  @acts_as_loggable_options = options.try(:first) || {}
7
7
 
8
8
  unless @acts_as_loggable_options.kind_of?(Hash)
9
- raise ArgumentError.new("invalid arguments passed to (effective_logging) log_changes. Example usage: log_changes except: [:created_at]")
9
+ raise ArgumentError.new('invalid arguments passed to (effective_logging) log_changes. Example usage: log_changes except: [:created_at]')
10
10
  end
11
11
 
12
12
  include ::ActsAsLoggable
@@ -69,11 +69,15 @@ module ActsAsLoggable
69
69
  end
70
70
 
71
71
  def log_changes_datatable
72
- if persisted?
73
- @log_changes_datatable ||= (
72
+ return nil unless persisted?
73
+
74
+ @log_changes_datatable ||= (
75
+ if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
74
76
  Effective::Datatables::Logs.new(associated_id: id, associated_type: self.class.name, log_changes: true, status: false)
75
- )
76
- end
77
+ else
78
+ EffectiveLogsDatatable.new(associated_id: id, associated_type: self.class.name, log_changes: true, status: false)
79
+ end
80
+ )
77
81
  end
78
82
 
79
83
  end
@@ -30,8 +30,12 @@ if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
30
30
  table_column :associated_to_s, label: 'Associated'
31
31
  end
32
32
 
33
- table_column :message do |log|
34
- log.message.starts_with?("\t") ? log.message.gsub("\t", "&nbsp;&nbsp;") : log.message
33
+ if attributes[:log_changes]
34
+ table_column :message do |log|
35
+ log.message.starts_with?("\t") ? log.message.gsub("\t", "&nbsp;&nbsp;") : log.message
36
+ end
37
+ else
38
+ table_column :message
35
39
  end
36
40
 
37
41
  table_column :logs_count, visible: false
@@ -5,7 +5,7 @@
5
5
  - parents_of_log(log).each do |parent|
6
6
  = link_to(log.message, (request.fullpath.gsub(log.to_param, parent.to_param) rescue '#'))
7
7
  = ' > '
8
- %p= log.message
8
+ %p= log.message.html_safe
9
9
  .col-sm-2.text-right
10
10
  = link_to 'Prev', request.fullpath.gsub(log.to_param, log.prev_log.try(:to_param).to_s), class: 'btn btn-default', disabled: log.prev_log.blank?
11
11
  = link_to 'Next', request.fullpath.gsub(log.to_param, log.next_log.try(:to_param).to_s), class: 'btn btn-default', disabled: log.next_log.blank?
@@ -46,6 +46,8 @@ module EffectiveLogging
46
46
  # before_save
47
47
  def changed!
48
48
  applicable(resource.instance_changes).each do |attribute, (before, after)|
49
+ next if before == nil && after == ''.freeze
50
+
49
51
  if object.respond_to?(:log_changes_formatted_value)
50
52
  before = object.log_changes_formatted_value(attribute, before) || before
51
53
  after = object.log_changes_formatted_value(attribute, after) || after
@@ -66,7 +68,7 @@ module EffectiveLogging
66
68
  title = association.name.to_s.singularize.titleize
67
69
 
68
70
  Array(object.send(association.name)).each_with_index do |child, index|
69
- ActiveRecordLogger.new(child, options.merge(logger: logger, depth: (depth + 1), prefix: "#{title} ##{index+1}: ")).execute!
71
+ ActiveRecordLogger.new(child, options.merge(logger: logger, depth: (depth + 1), prefix: "#{title} #{index} - #{child} - ")).execute!
70
72
  end
71
73
  end
72
74
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveLogging
2
- VERSION = '1.10.7'.freeze
2
+ VERSION = '1.10.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.7
4
+ version: 1.10.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-10 00:00:00.000000000 Z
11
+ date: 2017-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails