effective_datatables 4.30.2 → 4.31.1

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
  SHA256:
3
- metadata.gz: 9ec07c03e5278144171de22592740123dbc4db6999d5a9e39c2d06c665e661f2
4
- data.tar.gz: c446501978993cca11e309326b466afb9f14afe8cd41d92243099c26bfb3a0cc
3
+ metadata.gz: 890644cd1a399947c8b3deb2d12880367b1b225dd6ff41400bf50fa6aaa01b75
4
+ data.tar.gz: dcb2353768e455e880798aac5929413166fe1a756872c0e984bab73706bf064b
5
5
  SHA512:
6
- metadata.gz: 549c5d46a0f4c624ed98d6cc7c986e50f1567a2617c08fc39f81eb76dda49446908d23c5d9ae40bd7e4ab6c56950a369c63f8730b8992be315bc76295c87124c
7
- data.tar.gz: 1a1aba3d33d2160a78fb6f93755a352dbb5eb73dcadc5a83363f5b7ce21cc0ddaaa18fa497e472e538b2a9a1afa78c165c794f664b54bae193d4ce2433880bf6
6
+ metadata.gz: 625aad5dfc3f4e5615e7d6294c17548bb9ae40698311a180635566c290bed3d8ef7a86f13fe2bc526fb77f71a515f1376daaed39cb4ad7804ba3e0f0ea7d38e8
7
+ data.tar.gz: 751a5b50f64124797862d8b194fac5662f939dcd3b2aacf4e707d781ae10477754aa08774494eb8a426ec3944ccd789cdbc30b248a911b7c4eedbfaff4ca2c54
@@ -6,7 +6,10 @@ getFilterParams = ->
6
6
  params = {}
7
7
 
8
8
  if $form.length > 0
9
- params['scope'] = $form.find("input[name='filters[scope]']:checked").val() || ''
9
+ params['scope'] = $form.find("input[name='filters[scope]']:checked").val()
10
+ params['scope'] ||= $form.find("input[name='filters[scope]']:not([type='hidden'])").first().val()
11
+ params['scope'] ||= 'effective_datatables_empty_scope'
12
+
10
13
  params['filter'] = {}
11
14
 
12
15
  $form.find("select,textarea,input:enabled:not([type=submit])").each ->
@@ -77,20 +77,23 @@ module Effective
77
77
  )
78
78
 
79
79
  if csv && (opts[:format] || opts[:partial]) && !formatted.frozen?
80
+ html_content = formatted.include?('<') && formatted.include?('>')
81
+
82
+ formatted.gsub!("&nbsp;", ' ')
80
83
  formatted.gsub!("<br>\n", ' ')
81
84
  formatted.gsub!("<br> ", ' ')
82
85
  formatted.gsub!("<br>", ' ')
83
86
  formatted.gsub!("<br/>", ' ')
84
87
  formatted.gsub!("<br />", ' ')
85
- formatted.gsub!("\n\n", ' ')
86
- formatted.gsub!("\n", ' ') unless formatted.include?('<')
87
-
88
- if formatted.include?('<')
89
- formatted.gsub!("\n", '')
90
- formatted.gsub!("<div class='col-resource_item'>", ' ')
88
+ formatted.gsub!("\n", ' ')
91
89
 
90
+ if html_content
91
+ formatted.gsub!(/<span[^>]*\bclass=["']?badge\b[^>]*>.*?<\/span>/, '') # strip badges
92
+ formatted.gsub!('</div>', "</div>\n") if formatted.include?('col-resource_item')
92
93
  formatted = view.strip_tags(formatted).strip
93
94
  end
95
+
96
+ formatted.gsub!(' ', ' ')
94
97
  end
95
98
 
96
99
  row[index] = formatted
@@ -130,7 +133,7 @@ module Effective
130
133
  when :duration
131
134
  view.number_to_duration(value)
132
135
  when :effective_addresses
133
- csv ? value.to_html.gsub('<br>', "\n") : value.to_html
136
+ csv ? value.to_html.gsub('<br>', '').gsub("&nbsp;", ' ') : value.to_html
134
137
  when :effective_obfuscation
135
138
  value.to_s
136
139
  when :effective_roles
@@ -139,7 +142,7 @@ module Effective
139
142
  csv ? value : view.mail_to(value)
140
143
  when :integer
141
144
  value.to_s
142
- when :percent
145
+ when :percent, :percentage
143
146
  case value
144
147
  when Integer ; view.number_to_percentage(value / 1000.0, precision: 3).gsub('.000%', '%')
145
148
  when Numeric ; view.number_to_percentage(value, precision: 3).gsub('.000%', '%')
@@ -73,7 +73,11 @@ module Effective
73
73
 
74
74
  def load_filters!
75
75
  state[:filter] = _filters.inject({}) { |h, (name, opts)| h[name] = opts[:value]; h }
76
- state[:scope] = _scopes.find { |_, opts| opts[:default] }.try(:first) || _scopes.keys.first
76
+ state[:scope] = initial_scope()
77
+ end
78
+
79
+ def initial_scope
80
+ _scopes.find { |_, opts| opts[:default] }.try(:first) || _scopes.keys.first
77
81
  end
78
82
 
79
83
  def load_filter_params!
@@ -112,7 +116,7 @@ module Effective
112
116
  state[:order_index] = params[:order]['0'][:column].to_i
113
117
  end
114
118
 
115
- state[:scope] = _scopes.keys.find { |name| params[:scope] == name.to_s }
119
+ state[:scope] = _scopes.keys.find { |name| params[:scope] == name.to_s } || initial_scope()
116
120
  state[:start] = params[:start].to_i
117
121
 
118
122
  state[:search] = {}
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.30.2'.freeze
2
+ VERSION = '4.31.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.30.2
4
+ version: 4.31.1
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: 2024-12-13 00:00:00.000000000 Z
11
+ date: 2025-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails