effective_datatables 3.0.15 → 3.0.16
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a36c56e15a3e3c9d57862183dc41ed61dfa7be69
|
4
|
+
data.tar.gz: 38ada5d0f882aabd61510b21d2153bd0708ee437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d0cfc1d01e242b7b5afe8b74b6c27d1cafc24fcf8bec8f1de0e13295ca9ae3f005e5dd9a5cb5c2d04f8d96ba9b8fc01b34592662dc74a46317a489f1cd59d61
|
7
|
+
data.tar.gz: 3379dbd9030d211d3f21d72a7c8db65ffb5746e506a6d9497b5d6b30eda3b78408ba00c546c17a4e3679929c9a7d7efc385a69c6cffb2fcee955263795472185
|
@@ -73,7 +73,7 @@ module Effective
|
|
73
73
|
|
74
74
|
fuzzy = column[:search][:fuzzy]
|
75
75
|
term = Effective::Attribute.new(column[:as]).parse(value, name: column[:name])
|
76
|
-
term_downcased = term.downcase
|
76
|
+
term_downcased = term.to_s.downcase
|
77
77
|
macros = Effective::Resource.new('').macros
|
78
78
|
|
79
79
|
if term == 'nil'
|
@@ -104,21 +104,21 @@ module Effective
|
|
104
104
|
row[index] == term
|
105
105
|
end
|
106
106
|
when *macros, :resource
|
107
|
-
Array(row[index]
|
108
|
-
|
109
|
-
resource = resource.send(column[:name])
|
110
|
-
end
|
107
|
+
resources = Array(column[:as] == :resource ? row[index] : row[index].send(column[:name]))
|
108
|
+
terms = Array(term)
|
111
109
|
|
112
|
-
|
110
|
+
resources.any? do |resource|
|
111
|
+
terms.any? do |term|
|
112
|
+
matched = false
|
113
113
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
matched ||= term.any? { |term| resource.id == term || resource.to_param == term || resource.to_param == value }
|
118
|
-
end
|
114
|
+
if term.kind_of?(Integer) && resource.respond_to?(:to_param)
|
115
|
+
matched = (resource.id == term || resource.to_param == term)
|
116
|
+
end
|
119
117
|
|
120
|
-
|
118
|
+
matched ||= (fuzzy ? resource.to_s.downcase.include?(term.to_s.downcase) : resource.to_s == term)
|
119
|
+
end
|
121
120
|
end
|
121
|
+
|
122
122
|
else # :string, :text, :email
|
123
123
|
if fuzzy
|
124
124
|
row[index].to_s.downcase.include?(term_downcased)
|
@@ -19,7 +19,7 @@ module Effective
|
|
19
19
|
if active_record_collection?
|
20
20
|
columns.each do |name, opts|
|
21
21
|
opts[:as] ||= resource.sql_type(name)
|
22
|
-
opts[:sql_column] =
|
22
|
+
opts[:sql_column] = resource.sql_column(name) if opts[:sql_column].nil?
|
23
23
|
|
24
24
|
case opts[:as]
|
25
25
|
when *resource.macros
|
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: 3.0.
|
4
|
+
version: 3.0.16
|
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: 2017-07-
|
11
|
+
date: 2017-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|