effective_datatables 4.7.6 → 4.7.7

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: 9a83b549ce682f713931db6fb31f1432b9ccfca4d8e24ba43c56e0dcf8ff117f
4
- data.tar.gz: 53709d9a9d9e7dd7bf8f6b8025088976090a8a3571f264e08e03da534b28119f
3
+ metadata.gz: ee156f06d9f35299e3e4cba5f45fa4525e2d74272d3e937061b13509b972d77e
4
+ data.tar.gz: 98ee4e7f35efd7fe6132ab3cbee74cff4f8bfc302a52c2b2b6494515839f215e
5
5
  SHA512:
6
- metadata.gz: 0ebb22d41947d8e8fe4a8deebc9472f442617e4ace66e8cce6312e7f1e6de714e169b05a2146d823a568644b73a44871a82c7ab3faea72ca42fb1fb46d7c0ffb
7
- data.tar.gz: ac2d99e28b03a04f60cd583c2a0c657380d505f53490be7a9a0e39d05d7005c6a0c2cb3f6e92723a5f126a22454834453a7581f0fbb124e9a4be56ed2436c038
6
+ metadata.gz: 5233cce6528fca4f2a67852861b60c3618c4ca02d6e3f4f7317360719642e242e1d4345b7cfa29aaeb46dcdc2a05c9d00d38b363c9c2b12bcbe0435d1dac3cf3
7
+ data.tar.gz: d24aae4ceab7c2f86200b9a160920cad475017bba99289139b4f6ffd230f1a3f3c0da988fafd74055179b2f6ee517bb978ae8aa7d963e152c08c1603dfdb6e47
@@ -164,28 +164,16 @@ module Effective
164
164
 
165
165
  search = opts[:search]
166
166
 
167
- if search[:collection].kind_of?(ActiveRecord::Relation)
168
- search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.to_param] }
169
- elsif search[:collection].kind_of?(Array) && search[:collection].first.kind_of?(ActiveRecord::Base)
170
- search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.to_param] }
171
- elsif search[:collection].kind_of?(Array)
172
- search[:collection].each { |obj| obj[1] = 'nil' if obj[1] == nil }
173
- elsif search[:collection].kind_of?(Hash)
174
- search[:collection].each { |k, v| search[:collection][k] = 'nil' if v == nil }
175
- end
176
-
177
- search[:value] ||= search.delete(:selected) if search.key?(:selected)
178
-
179
167
  search[:as] ||= :select if search.key?(:collection)
168
+ search[:fuzzy] ||= true unless search.key?(:fuzzy)
169
+ search[:value] ||= search.delete(:selected) if search.key?(:selected)
180
170
 
181
- search[:fuzzy] = true unless search.key?(:fuzzy)
171
+ # Merge with defaults
172
+ search_resource = (opts[:resource] || effective_resource || fallback_effective_resource)
182
173
 
183
- if search[:as] == :select && search.key?(:collection)
184
- # No Action
185
- elsif array_collection? && opts[:resource].present?
186
- search.reverse_merge!(opts[:resource].search_form_field(name, collection.first[opts[:index]]))
174
+ if array_collection? && opts[:resource].present?
175
+ search.reverse_merge!(search_resource.search_form_field(name, collection.first[opts[:index]]))
187
176
  elsif search[:as] != :string
188
- search_resource = (opts[:resource] || effective_resource || fallback_effective_resource)
189
177
  search.reverse_merge!(search_resource.search_form_field(name, opts[:as]))
190
178
  end
191
179
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.7.6'.freeze
2
+ VERSION = '4.7.7'.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.7.6
4
+ version: 4.7.7
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: 2019-06-20 00:00:00.000000000 Z
11
+ date: 2019-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails