effective_datatables 4.10.0 → 4.10.1
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/controllers/effective/datatables_controller.rb +2 -0
- data/app/helpers/effective_datatables_controller_helper.rb +2 -0
- data/app/helpers/effective_datatables_helper.rb +2 -0
- data/app/helpers/effective_datatables_private_helper.rb +11 -9
- data/app/models/effective/datatable.rb +2 -0
- data/app/models/effective/datatable_column.rb +2 -0
- data/app/models/effective/datatable_column_tool.rb +2 -0
- data/app/models/effective/datatable_dsl_tool.rb +2 -0
- data/app/models/effective/datatable_value_tool.rb +2 -0
- data/app/models/effective/effective_datatable/attributes.rb +2 -0
- data/app/models/effective/effective_datatable/collection.rb +3 -1
- data/app/models/effective/effective_datatable/compute.rb +2 -0
- data/app/models/effective/effective_datatable/cookie.rb +2 -0
- data/app/models/effective/effective_datatable/csv.rb +2 -0
- data/app/models/effective/effective_datatable/dsl/bulk_actions.rb +2 -0
- data/app/models/effective/effective_datatable/dsl/charts.rb +2 -0
- data/app/models/effective/effective_datatable/dsl/datatable.rb +2 -0
- data/app/models/effective/effective_datatable/dsl/filters.rb +2 -0
- data/app/models/effective/effective_datatable/dsl.rb +5 -3
- data/app/models/effective/effective_datatable/format.rb +2 -0
- data/app/models/effective/effective_datatable/hooks.rb +2 -0
- data/app/models/effective/effective_datatable/params.rb +2 -0
- data/app/models/effective/effective_datatable/resource.rb +2 -0
- data/app/models/effective/effective_datatable/state.rb +3 -1
- 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: 23fc1a12eb490a341d424c18f5f773081ff37c4b7de69143b0d76d016830f454
|
4
|
+
data.tar.gz: 6d3fff829f467d8dac9abbac7a9023b939d34a0a6eb978270fdcb5ce5edf3d2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2177238d3bfac03c9020a25b4998bc31d325ad589be8fc8c2c28467a42715cf0d61af9698540db04fad665bb13bc6dc7e8c04c912666f3c4aa85debe98bdfaea
|
7
|
+
data.tar.gz: f48c993d05144a299f366dace3287d4a83d047219bcf30974a23bd3254a81f96a2e6854bafc8dbc2428d34025dff60661057781a89486169f9b25098850bae62
|
@@ -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
|
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:
|
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
|
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
|
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
|
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
|
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
|
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 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 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
|
|
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.
|
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-
|
11
|
+
date: 2021-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|