effective_datatables 4.13.3 → 4.13.5
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 +4 -4
- data/app/models/effective/datatable.rb +4 -0
- data/app/models/effective/effective_datatable/cookie.rb +2 -0
- data/app/models/effective/effective_datatable/csv.rb +1 -1
- data/app/models/effective/effective_datatable/dsl/datatable.rb +4 -0
- data/app/models/effective/effective_datatable/format.rb +6 -5
- data/lib/effective_datatables/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a652ec20b06f01718d88cbc9c6d78e6905c44239c577009b6df777d02432975
|
4
|
+
data.tar.gz: 6f148f5dd453d595ae3bca1592b179974802c2b3c6b83d0051bd6043ce39533e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9c0d5927da2c915118f5b0347591b38a8e355f1d2860548523da04a3cfd6b3dac10d66181f353552bc4bcfa63ba218d2254c55a38e3ad8c89c7869dcdfaadd2
|
7
|
+
data.tar.gz: 32b2a35689ca9591d7729b2ec72164c6b699d81dfbca19fd54948f866a952f364c9d5713db0617ad19deb285f1151be78b8bb8a961158d2833f3eaa8a2de76a8
|
@@ -182,6 +182,10 @@ module Effective
|
|
182
182
|
attributes[:downloadable] != false
|
183
183
|
end
|
184
184
|
|
185
|
+
def skip_save_state?
|
186
|
+
attributes[:skip_save_state] == true
|
187
|
+
end
|
188
|
+
|
185
189
|
# Whether the filters must be rendered as a <form> or we can keep the normal <div> behaviour
|
186
190
|
def _filters_form_required?
|
187
191
|
_form[:verb].present?
|
@@ -12,6 +12,7 @@ module Effective
|
|
12
12
|
|
13
13
|
def load_cookie!
|
14
14
|
return unless EffectiveDatatables.save_state
|
15
|
+
return if skip_save_state?
|
15
16
|
return unless (view.cookies rescue false) # Rails 6.1 view doesn't respond_to?(:cookies)
|
16
17
|
|
17
18
|
@dt_cookie = view.cookies.signed['_effective_dt']
|
@@ -36,6 +37,7 @@ module Effective
|
|
36
37
|
|
37
38
|
def save_cookie!
|
38
39
|
return unless EffectiveDatatables.save_state
|
40
|
+
return if skip_save_state?
|
39
41
|
return unless (view.cookies rescue false)
|
40
42
|
|
41
43
|
@dt_cookie ||= []
|
@@ -22,7 +22,7 @@ module Effective
|
|
22
22
|
CSV.generate do |csv|
|
23
23
|
csv << csv_header()
|
24
24
|
|
25
|
-
collection.
|
25
|
+
collection.find_in_batches do |resources|
|
26
26
|
resources = arrayize(resources, csv: true)
|
27
27
|
format(resources, csv: true)
|
28
28
|
finalize(resources)
|
@@ -30,6 +30,10 @@ module Effective
|
|
30
30
|
datatable.attributes[:downloadable] = bool
|
31
31
|
end
|
32
32
|
|
33
|
+
def skip_save_state!
|
34
|
+
datatable.attributes[:skip_save_state] = true
|
35
|
+
end
|
36
|
+
|
33
37
|
# A col has its internal values sorted/searched before the block is run
|
34
38
|
# Anything done in the block, is purely a format on the after sorted/ordered value
|
35
39
|
# the original object == the computed value, which is yielded to the format block
|
@@ -68,7 +68,7 @@ module Effective
|
|
68
68
|
elsif opts[:format] && rendered.key?(name)
|
69
69
|
dsl_tool.instance_exec(value, row, rendered[name][row_index], &opts[:format])
|
70
70
|
elsif opts[:format]
|
71
|
-
dsl_tool.instance_exec(value, row, &opts[:format])
|
71
|
+
dsl_tool.instance_exec(value, row, &opts[:format]).to_s
|
72
72
|
elsif opts[:partial]
|
73
73
|
rendered[name][row_index]
|
74
74
|
else
|
@@ -88,6 +88,7 @@ module Effective
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
# Must return a string
|
91
92
|
def format_column(value, column, csv: false)
|
92
93
|
return if value.nil? || (column[:resource] && value.blank?)
|
93
94
|
|
@@ -114,24 +115,24 @@ module Effective
|
|
114
115
|
value.respond_to?(:strftime) ? value.strftime(EffectiveDatatables.format_date) : BLANK
|
115
116
|
when :datetime
|
116
117
|
if csv
|
117
|
-
value
|
118
|
+
value.to_s
|
118
119
|
else
|
119
120
|
value.respond_to?(:strftime) ? value.strftime(EffectiveDatatables.format_datetime) : BLANK
|
120
121
|
end
|
121
122
|
when :decimal
|
122
|
-
value
|
123
|
+
value.to_s
|
123
124
|
when :duration
|
124
125
|
view.number_to_duration(value)
|
125
126
|
when :effective_addresses
|
126
127
|
csv ? value.to_html.gsub('<br>', "\n") : value.to_html
|
127
128
|
when :effective_obfuscation
|
128
|
-
value
|
129
|
+
value.to_s
|
129
130
|
when :effective_roles
|
130
131
|
value.join(', ')
|
131
132
|
when :email
|
132
133
|
csv ? value : view.mail_to(value)
|
133
134
|
when :integer
|
134
|
-
value
|
135
|
+
value.to_s
|
135
136
|
when :percent
|
136
137
|
case value
|
137
138
|
when Integer ; view.number_to_percentage(value / 1000.0, precision: 3).gsub('.000%', '%')
|
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.13.
|
4
|
+
version: 4.13.5
|
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: 2022-12-
|
11
|
+
date: 2022-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|