effective_datatables 4.13.2 → 4.13.4

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: 583ae9463f2ad7039927ee730e77d0735a25aa2659706aed89a1e1e60fc2b097
4
- data.tar.gz: aae985bb6164d773959732e955ce1a9264be1830544fbce3676707e05a48ce25
3
+ metadata.gz: bb08f8a05559f50227ad9957db50f1fe46952a3509b8ec2a633b5991cc2984fb
4
+ data.tar.gz: 161bf01768bd46d37eac6e15e966b7dc5c2c9bc6a120c28510cc47b5d92414dd
5
5
  SHA512:
6
- metadata.gz: 30fbdba242e5697eda518dfe4115eb17f31840bfe1c1400493abd7b82111a0eb5a6c4ebf0ce20f70d281d30310651722931540e3a6524795fa4866cbea9de96c
7
- data.tar.gz: 85328b0f4914e3d9a7d43b777b10dde7aeae118041781f039aca78f96671f387556fcc6ca7d5d51b02eff338943ebeef52d138374d5786f8d7c402a6ba20de31
6
+ metadata.gz: 7b7f399eccc357014bbcbce19dc9e75cc8196865a5a6943d0dbf8f850e9acd316a5ece105d03ccca61efc774faf3a627b4e9d48b0d93ec230af128b99e1eb07e
7
+ data.tar.gz: 778322bf428c4528520b7726466ac7bb57e63105967809c30846c12e2f351c613a18928efde8bf999ee89d6e2d492ad0eae3541543ff0f337733b99776789337
@@ -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 ||= []
@@ -36,20 +36,24 @@ module Effective
36
36
  EffectiveResources.with_resource_enumerator do |lines|
37
37
  lines << CSV.generate_line(csv_header)
38
38
 
39
- collection.public_send(csv_collection_method) do |resources|
40
- resources = arrayize(resources, csv: true)
39
+ if active_record_collection?
40
+ collection.find_in_batches do |resources|
41
+ resources = arrayize(resources, csv: true)
42
+ format(resources, csv: true)
43
+ finalize(resources)
44
+
45
+ resources.each { |resource| lines << CSV.generate_line(resource) }
46
+ end
47
+ else
48
+ resources = collection
49
+
41
50
  format(resources, csv: true)
42
51
  finalize(resources)
43
52
 
44
53
  resources.each { |resource| lines << CSV.generate_line(resource) }
45
54
  end
46
- end
47
- end
48
-
49
- private
50
55
 
51
- def csv_collection_method
52
- (active_record_collection? ? :find_in_batches : :to_a)
56
+ end
53
57
  end
54
58
 
55
59
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.13.2'.freeze
2
+ VERSION = '4.13.4'.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.13.2
4
+ version: 4.13.4
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-11-23 00:00:00.000000000 Z
11
+ date: 2022-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails