effective_datatables 4.16.1 → 4.16.2

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: 4d8cb374a927e0b1b432de1382f2362c0cc58bf59c8994d64c252410f3325638
4
- data.tar.gz: da5f8129b039dcba1c39debf8ba3b42c066af7756b0bc01b090976ac1e2515a5
3
+ metadata.gz: '079ed09629f9c21a2d1e56da78d611258f57953200eba9724ee756c699db49ce'
4
+ data.tar.gz: 76fd2c6b7380bb02482312120c2b04ab68cd8a3e0e08c18815c838ac0f9ff58b
5
5
  SHA512:
6
- metadata.gz: '0881e3297eae8931da681f92ef24eb3e6759dfd4a4773d92d636f66a6647428061d898d3865066cbecba17ba33d6f1452ad7cf040f92d46cc64cbf990c899fc8'
7
- data.tar.gz: d6f262f5c55a68051533f0347c7b3fd2964e9b1db5550f11d6b70f6ddf7bae9b687c1413c636d357c9483f0f09de28bd3462a1d4425e406eb5db468e4d37361c
6
+ metadata.gz: 05ea2263405fbd49445e82e14240405794d14b86caf704115584f5de46ca1ba5fc8b685c2de66b612f3b540c80148ad6257cd3352a63e56bd02f6f303058af3b
7
+ data.tar.gz: cde3bf3b0bb9c8aa21b5b877da243c01069dcea07ca9e30d4b4e342839b66d7ecf5f1fe7087dbfbf5dc412d20a991b810171dea3c340934cf3da354b9f35e9d5
@@ -24,7 +24,7 @@ module Effective
24
24
  if active_record_collection?
25
25
  collection_class.human_attribute_name(name)
26
26
  else
27
- (name.to_s.split('.').last || '')
27
+ (name.to_s.split('.').last.titleize|| '')
28
28
  end
29
29
  end
30
30
 
@@ -32,8 +32,17 @@ module Effective
32
32
  CSV.generate do |csv|
33
33
  csv << csv_header()
34
34
 
35
- collection.find_in_batches do |resources|
36
- resources = arrayize(resources, csv: true)
35
+ if active_record_collection?
36
+ collection.find_in_batches do |resources|
37
+ resources = arrayize(resources, csv: true)
38
+ format(resources, csv: true)
39
+ finalize(resources)
40
+
41
+ resources.each { |resource| csv << resource }
42
+ end
43
+ else
44
+ resources = collection
45
+
37
46
  format(resources, csv: true)
38
47
  finalize(resources)
39
48
 
@@ -10,20 +10,20 @@ module Effective
10
10
  return @_datatables_ajax_request unless @_datatables_ajax_request.nil?
11
11
  return unless view.respond_to?(:params)
12
12
 
13
- @_datatables_ajax_request = (view.params.key?(:draw) && view.params.key?(:columns))
13
+ @_datatables_ajax_request = view.params.present? && (view.params.key?(:draw) && view.params.key?(:columns))
14
14
  end
15
15
 
16
16
  def datatables_inline_request?
17
17
  return @_datatables_inline_request unless @_datatables_inline_request.nil?
18
18
  return unless view.respond_to?(:params)
19
19
 
20
- @_datatables_inline_request = (view.params[:_datatable_id].to_s.split('-')[0...-1] == to_param.split('-')[0...-1])
20
+ @_datatables_inline_request = view.params.present? && (view.params[:_datatable_id].to_s.split('-')[0...-1] == to_param.split('-')[0...-1])
21
21
  end
22
22
 
23
23
  def params
24
24
  return {} unless view.present?
25
25
  return view.rendered_params if view.respond_to?(:rendered_params)
26
- return {} unless view.respond_to?(:request)
26
+ return {} unless view.respond_to?(:request) && view.request.present?
27
27
 
28
28
  @params ||= {}.tap do |params|
29
29
  Rack::Utils.parse_query(URI(view.request.referer.presence || '/').query).each { |k, v| params[k.to_sym] = v }
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.16.1'.freeze
2
+ VERSION = '4.16.2'.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.16.1
4
+ version: 4.16.2
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: 2023-03-10 00:00:00.000000000 Z
11
+ date: 2023-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails