effective_datatables 4.10.0 → 4.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/effective/datatables_controller.rb +2 -0
  3. data/app/helpers/effective_datatables_controller_helper.rb +2 -0
  4. data/app/helpers/effective_datatables_helper.rb +2 -0
  5. data/app/helpers/effective_datatables_private_helper.rb +11 -9
  6. data/app/models/effective/datatable.rb +2 -0
  7. data/app/models/effective/datatable_column.rb +2 -0
  8. data/app/models/effective/datatable_column_tool.rb +2 -0
  9. data/app/models/effective/datatable_dsl_tool.rb +2 -0
  10. data/app/models/effective/datatable_value_tool.rb +2 -0
  11. data/app/models/effective/effective_datatable/attributes.rb +2 -0
  12. data/app/models/effective/effective_datatable/collection.rb +3 -1
  13. data/app/models/effective/effective_datatable/compute.rb +2 -0
  14. data/app/models/effective/effective_datatable/cookie.rb +2 -0
  15. data/app/models/effective/effective_datatable/csv.rb +2 -0
  16. data/app/models/effective/effective_datatable/dsl/bulk_actions.rb +2 -0
  17. data/app/models/effective/effective_datatable/dsl/charts.rb +2 -0
  18. data/app/models/effective/effective_datatable/dsl/datatable.rb +2 -0
  19. data/app/models/effective/effective_datatable/dsl/filters.rb +2 -0
  20. data/app/models/effective/effective_datatable/dsl.rb +5 -3
  21. data/app/models/effective/effective_datatable/format.rb +2 -0
  22. data/app/models/effective/effective_datatable/hooks.rb +2 -0
  23. data/app/models/effective/effective_datatable/params.rb +2 -0
  24. data/app/models/effective/effective_datatable/resource.rb +2 -0
  25. data/app/models/effective/effective_datatable/state.rb +3 -1
  26. data/lib/effective_datatables/version.rb +1 -1
  27. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 173cdec1d403c8203a7f3d3701104a76d7fd8fb04843c4989180b351b5096264
4
- data.tar.gz: 70da4dcc029e6f7ac2a2f0d7f896734c4036eea227dfd5ecb6354f1efa59f531
3
+ metadata.gz: 23fc1a12eb490a341d424c18f5f773081ff37c4b7de69143b0d76d016830f454
4
+ data.tar.gz: 6d3fff829f467d8dac9abbac7a9023b939d34a0a6eb978270fdcb5ce5edf3d2e
5
5
  SHA512:
6
- metadata.gz: 474ead17fcde2196a4bdf06cdfa02c9d23e1dc4345126d79bcdf4fa3aa9785a358cce6d54a062862f17ec33c618a908db703a1eaa94e847a87df42dfe738b816
7
- data.tar.gz: 55570bbe0d91f0bcdb24d818368a3a4dce9be6ffc0d7a99327121d8204df62a56b6eecc61a1bbbb6bb89b1feff5e4ea6d293497bb571ffff640331f14076d8b2
6
+ metadata.gz: 2177238d3bfac03c9020a25b4998bc31d325ad589be8fc8c2c28467a42715cf0d61af9698540db04fad665bb13bc6dc7e8c04c912666f3c4aa85debe98bdfaea
7
+ data.tar.gz: f48c993d05144a299f366dace3287d4a83d047219bcf30974a23bd3254a81f96a2e6854bafc8dbc2428d34025dff60661057781a89486169f9b25098850bae62
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'csv'
2
4
 
3
5
  module Effective
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # These are expected to be called by a developer. They are part of the datatables DSL.
2
4
  module EffectiveDatatablesControllerHelper
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # These are expected to be called by a developer. They are part of the datatables DSL.
2
4
  module EffectiveDatatablesHelper
3
5
  def render_datatable(datatable, input_js: {}, buttons: true, charts: true, download: nil, entries: true, filters: true, inline: false, namespace: nil, pagination: true, search: true, simple: false, sort: true)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # These aren't expected to be called by a developer. They are internal methods.
2
4
  module EffectiveDatatablesPrivateHelper
3
5
 
@@ -33,7 +35,7 @@ module EffectiveDatatablesPrivateHelper
33
35
  action = { action: :new, class: ['btn', column[:btn_class].presence].compact.join(' '), 'data-remote': true }
34
36
 
35
37
  if column[:actions][:new].kind_of?(Hash) # This might be active_record_array_collection?
36
- action.merge!(column[:actions][:new])
38
+ actions = action.merge(column[:actions][:new])
37
39
 
38
40
  effective_resource = (datatable.effective_resource || datatable.fallback_effective_resource)
39
41
  klass = (column[:actions][:new][:klass] || effective_resource&.klass || datatable.collection_class)
@@ -67,13 +69,13 @@ module EffectiveDatatablesPrivateHelper
67
69
  return if opts[:search] == false
68
70
 
69
71
  # Build the search
70
- @_effective_datatables_form_builder || effective_form_with(scope: :datatable_search, url: '#') { |f| @_effective_datatables_form_builder = f }
72
+ @_effective_datatables_form_builder || effective_form_with(scope: 'datatable_search', url: '#') { |f| @_effective_datatables_form_builder = f }
71
73
  form = @_effective_datatables_form_builder
72
74
 
73
75
  collection = opts[:search].delete(:collection)
74
76
  value = datatable.state[:search][name]
75
77
 
76
- options = opts[:search].merge!(
78
+ options = opts[:search].merge(
77
79
  name: nil,
78
80
  feedback: false,
79
81
  label: false,
@@ -87,20 +89,20 @@ module EffectiveDatatablesPrivateHelper
87
89
  when :string, :text, :number
88
90
  form.text_field name, options
89
91
  when :date, :datetime
90
- form.date_field name, options.reverse_merge!(
92
+ form.date_field name, options.reverse_merge(
91
93
  date_linked: false, prepend: false, input_js: { useStrict: true, keepInvalid: true }
92
94
  )
93
95
  when :time
94
- form.time_field name, options.reverse_merge!(
96
+ form.time_field name, options.reverse_merge(
95
97
  date_linked: false, prepend: false, input_js: { useStrict: false, keepInvalid: true }
96
98
  )
97
99
  when :select, :boolean
98
- options[:input_js] = (options[:input_js] || {}).reverse_merge!(placeholder: '')
100
+ options[:input_js] = (options[:input_js] || {}).reverse_merge(placeholder: '')
99
101
 
100
102
  form.select name, collection, options
101
103
  when :bulk_actions
102
104
  options[:data]['role'] = 'bulk-actions'
103
- form.check_box name, options.merge!(label: ' ')
105
+ form.check_box name, options.merge(label: ' ')
104
106
  end
105
107
  end
106
108
 
@@ -130,7 +132,7 @@ module EffectiveDatatablesPrivateHelper
130
132
  placeholder: (opts[:label] || name.to_s.titleize),
131
133
  value: value,
132
134
  wrapper: { class: 'form-group col-auto'}
133
- }.merge!(opts.except(:as, :collection, :parse, :value))
135
+ }.merge(opts.except(:as, :collection, :parse, :value))
134
136
 
135
137
  options[:name] = '' unless datatable._filters_form_required?
136
138
 
@@ -162,7 +164,7 @@ module EffectiveDatatablesPrivateHelper
162
164
  label: false,
163
165
  required: false,
164
166
  wrapper: { class: 'form-group col-auto'}
165
- }.merge!(opts.except(:checked, :value))
167
+ }.merge(opts.except(:checked, :value))
166
168
 
167
169
  form.radios :scope, collection, options
168
170
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  class Datatable
3
5
  attr_reader :attributes # Anything that we initialize our table with. That's it. Can't be changed by state.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # In practice this is just a regular hash with the aggregate, format, search, sort do syntax that saves a block
2
4
  module Effective
3
5
  class DatatableColumn
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  class DatatableColumnTool
3
5
  attr_reader :datatable
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
 
3
5
  class DatatableDslTool
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  # The collection is an Array of Arrays
3
5
  class DatatableValueTool
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Attributes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Collection
@@ -34,7 +36,7 @@ module Effective
34
36
  raise 'No collection defined. Please add a collection with collection do ... end' if collection.nil?
35
37
 
36
38
  @collection_class = (collection.respond_to?(:klass) ? collection.klass : self.class)
37
-
39
+
38
40
  @active_record_collection = (collection.ancestors.include?(ActiveRecord::Base) rescue false)
39
41
  @active_record_array_collection = collection.kind_of?(Array) && collection.present? && collection.first.kind_of?(ActiveRecord::Base)
40
42
  @array_collection = collection.kind_of?(Array) && (collection.blank? || collection.first.kind_of?(Array))
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Compute
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Cookie
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'csv'
2
4
 
3
5
  module Effective
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Dsl
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Dsl
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Dsl
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Dsl
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Dsl
@@ -11,11 +13,11 @@ module Effective
11
13
  end
12
14
 
13
15
  def collection(apply_belongs_to: true, apply_scope: true, &block)
14
- define_method('initialize_collection') {
16
+ define_method('initialize_collection') {
15
17
  self._collection_apply_belongs_to = apply_belongs_to
16
18
  self._collection_apply_scope = apply_scope
17
-
18
- self._collection = dsl_tool.instance_exec(&block)
19
+
20
+ self._collection = dsl_tool.instance_exec(&block)
19
21
  }
20
22
  end
21
23
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Format
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Hooks
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Params
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module Resource
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module EffectiveDatatable
3
5
  module State
@@ -98,7 +100,7 @@ module Effective
98
100
  load_cookie_state! if cookie.present? && cookie[:params] == cookie_state_params
99
101
  load_filter_params!
100
102
  end
101
-
103
+
102
104
  fill_empty_filters!
103
105
  end
104
106
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.10.0'.freeze
2
+ VERSION = '4.10.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.10.0
4
+ version: 4.10.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: 2021-12-08 00:00:00.000000000 Z
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails