effective_datatables 4.20.3 → 4.20.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: b290520f84f92726953ea0aef6cfa1e5c8d6acdafbc1701f6fb542357d077010
4
- data.tar.gz: 9f7a715b57a9edf9dc31b806bdc85287e505a3e7766957599f555073ea43e71e
3
+ metadata.gz: de9e67c1d5ddd3f19c322ea61f2bb1b50f9792e1ca6666607af4a14f11dc615d
4
+ data.tar.gz: ae1f07be260e375e21d4cf4520a1d55fb4c51787ea09f4f56acfc49168137f45
5
5
  SHA512:
6
- metadata.gz: d8a92d42e7b7f79761f5ad4efec357071bf5f844797883139e248177a059f9b108d62080f7d45db5e3ffbbcbf7aee4383621462bcd6e14f75ffffcffcf0ff145
7
- data.tar.gz: e2315412cb5e63b24d5d554dfddfa69e99895ba7c30ee015d829eadfd6908e36d976cb6cb5e4151afbc7adf75ce7b54653e43e8d5c7a109796cf51364912ae87
6
+ metadata.gz: 711ca1ee0f32fd3b91bcac59f294ac8d3822d364a7318ee89d68ed6a8d0de7147dab2934365abcc3e49ba1ea85142ba50f515207601e651677fc74f1cfdf5281
7
+ data.tar.gz: fd4a8536658314a46199c03aec85898365b992472b78e7e8592b468a25f6cc16ed914b2385f131b0e5f927963b5990a469b0a93e8e62697ec80c151e611ca7ba
@@ -158,6 +158,8 @@ module Effective
158
158
 
159
159
  def load_resource_search!
160
160
  columns.each do |name, opts|
161
+ # Normalize the given opts[:search] into a Hash
162
+ # Take special note of the opts[:search] as we need to collapse it when an ActiveRecord::Relation
161
163
  case opts[:search]
162
164
  when false
163
165
  opts[:search] = { as: :null }; next
@@ -171,6 +173,7 @@ module Effective
171
173
  raise "column #{name} unexpected search value"
172
174
  end
173
175
 
176
+ # Now lets deal with the opts[:search] hash itself
174
177
  search = opts[:search]
175
178
 
176
179
  # Parameterize collection
@@ -189,11 +192,17 @@ module Effective
189
192
  search_resource = [opts[:resource], effective_resource, fallback_effective_resource].compact
190
193
  search_resource = search_resource.find { |res| res.klass.present? } || search_resource.first
191
194
 
192
- if array_collection? && opts[:resource].present?
193
- search.reverse_merge!(search_resource.search_form_field(name, collection.first[opts[:index]]))
195
+ # Assign search collections from effective_resources
196
+ if search[:as] == :string
197
+ # Nothing to do. We're just a string search.
194
198
  elsif search[:as] == :select && search[:collection].kind_of?(Array)
195
- # Nothing to do
196
- elsif search[:as] != :string
199
+ # Nothing to do. We already loaded the custom parameterized collection above.
200
+ elsif array_collection? && opts[:resource].present?
201
+ # Assigns { as: :select, collection: [...] }
202
+ search.reverse_merge!(search_resource.search_form_field(name, collection.first[opts[:index]]))
203
+ else
204
+ # Load the defaults from effective_resources
205
+ # Assigns { as: :string } or { as: :select, collection: [...] }
197
206
  search.reverse_merge!(search_resource.search_form_field(name, opts[:as]))
198
207
  end
199
208
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.20.3'.freeze
2
+ VERSION = '4.20.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.20.3
4
+ version: 4.20.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: 2023-11-08 00:00:00.000000000 Z
11
+ date: 2023-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails