effective_logging 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a53ba2fe5f709b8ed5dab64862c8cd7b0d0d7d4
4
- data.tar.gz: e7e8cf96aef015e480854c983775476ced0456ef
3
+ metadata.gz: 2550444086d62748f932f3159e689e05ecc9dee2
4
+ data.tar.gz: fc672fff6b8098329188b3e2f3eb17912673eb04
5
5
  SHA512:
6
- metadata.gz: ba39530e19aa75e37faba8ed946f3c5cb0ba2e535953f3ceda1ecb1e9014c075def5bf6144cc3ea79f6bf529304521578b5ff190f98633e6725dbc7c8d3edd7c
7
- data.tar.gz: a3b9220d9f97ffe7fd791f2b7f88f45b8dd618917d8566e6b5e840ec6aa8acc31b508392115af1e676909c997a19bff6fbe1cf65c1f104701322bb9ed8f47b74
6
+ metadata.gz: 5d6ac3fd3a4ab436e8b7782d3d210a04be89144f06deb8ede33d8f398bc5f1048ca3dfe284a121ce64f15e3370f1b9f9dd6783bcba192f49f569c67752ef3485
7
+ data.tar.gz: 6279a5a67694fa532eadfb2b9b87be7724e83bc8511f90e6ebd852e1c451914e47b63cd0db7889200baf23ae06b1fd49a014a80237023eec3ba5b70a34fbca1a
@@ -1,4 +1,7 @@
1
1
  module EffectiveLoggingHelper
2
+ ALLOWED_TAGS = ActionView::Base.sanitized_allowed_tags.to_a + ['table', 'thead', 'tbody', 'tfoot', 'tr', 'td', 'th']
3
+ ALLOWED_ATTRIBUTES = ActionView::Base.sanitized_allowed_attributes.to_a + ['colspan', 'rowspan']
4
+
2
5
  def bootstrap_class_for_status(status)
3
6
  case status
4
7
  when 'success' ; 'success'
@@ -55,5 +58,15 @@ module EffectiveLoggingHelper
55
58
  end
56
59
  end
57
60
 
61
+ def format_log_details_value(value)
62
+ if value.kind_of?(Hash)
63
+ tableize_hash(value, :class => 'table', :style => 'width: 50%', :th => true)
64
+ elsif value.kind_of?(Array)
65
+ value.map { |value| simple_format(sanitize(value.to_s, :tags => ALLOWED_TAGS, :attributes => ALLOWED_ATTRIBUTES), {}, :sanitize => false) }.join('').html_safe
66
+ else
67
+ simple_format(sanitize(value.to_s, :tags => ALLOWED_TAGS, :attributes => ALLOWED_ATTRIBUTES), {}, :sanitize => false)
68
+ end
69
+ end
70
+
58
71
 
59
72
  end
@@ -38,12 +38,7 @@
38
38
  %br
39
39
  %p
40
40
  %strong= "#{key.to_s.titleize}:"
41
- - if value.kind_of?(Hash)
42
- = tableize_hash(value, :class => 'table', :style => 'width: 50%', :th => true)
43
- - else
44
- - allowed_tags = ActionView::Base.sanitized_allowed_tags.to_a + ['table', 'thead', 'tbody', 'tfoot', 'tr', 'td', 'th']
45
- - allowed_attributes = ActionView::Base.sanitized_allowed_attributes.to_a + ['colspan', 'rowspan']
46
- = simple_format(sanitize(value.to_s, :tags => allowed_tags, :attributes => allowed_attributes), {}, :sanitize => false)
41
+ = format_log_details_value(value)
47
42
 
48
43
  - if log.logs.present?
49
44
  .row
@@ -1,3 +1,3 @@
1
1
  module EffectiveLogging
2
- VERSION = '1.1.2'.freeze
2
+ VERSION = '1.1.3'.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.1.2
4
+ version: 1.1.3
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: 2015-01-27 00:00:00.000000000 Z
11
+ date: 2015-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails