effective_datatables 2.4.0 → 2.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f0b5d8833f49fa08b11c76ee4f49622ff13c72d
|
4
|
+
data.tar.gz: 3b64fb8a94657715b230c1b47976c0c180afaeb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91119ca0ee5f73dfa6bcefd728cf18c9a4e4f0f5ba7522f1b242c4d44f11290d1a25139d7300f59f82e3710a1f8a34284e3a7eeca47800a493d4e91be02a0dc1
|
7
|
+
data.tar.gz: 5caf11ca75774bb2133c8a67343a0b0aadb6f55e4b72b63136ecc459916d173bfe1105b5ae7e17a8b483d83582fd92a91bf8408da50cbc058fb8e2770119e2fa
|
@@ -68,10 +68,10 @@ module Effective
|
|
68
68
|
collection.public_send(sql_op, "#{sql_column} = :term", term: term)
|
69
69
|
elsif ['null', 'nil', nil].include?(term)
|
70
70
|
collection.public_send(sql_op, "#{sql_column} = :term OR #{sql_column} IS NULL", term: '')
|
71
|
-
elsif table_column[:filter][:fuzzy]
|
72
|
-
collection.public_send(sql_op, "#{sql_column} = :term", term: term)
|
73
|
-
else
|
71
|
+
elsif table_column[:filter][:fuzzy]
|
74
72
|
collection.public_send(sql_op, "#{sql_column} #{ilike} :term", term: "%#{term}%")
|
73
|
+
else
|
74
|
+
collection.public_send(sql_op, "#{sql_column} = :term", term: term)
|
75
75
|
end
|
76
76
|
when :belongs_to_polymorphic
|
77
77
|
# our key will be something like Post_15, or Event_1
|
@@ -66,15 +66,13 @@ module Effective
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def search_column_with_defaults(collection, table_column, search_term, index)
|
69
|
-
search_term = search_term.downcase
|
69
|
+
search_term = search_term.downcase if table_column[:filter][:fuzzy]
|
70
70
|
|
71
71
|
collection.select! do |row|
|
72
|
-
|
73
|
-
|
74
|
-
if table_column[:filter][:fuzzy] != true
|
75
|
-
value == search_term
|
72
|
+
if table_column[:filter][:fuzzy]
|
73
|
+
row[index].to_s.downcase.include?(search_term)
|
76
74
|
else
|
77
|
-
|
75
|
+
row[index] == search_term
|
78
76
|
end
|
79
77
|
end || collection
|
80
78
|
end
|
@@ -164,6 +164,11 @@ module Effective
|
|
164
164
|
filter[:as] ||= :select
|
165
165
|
end
|
166
166
|
|
167
|
+
# Fuzzy by default throughout
|
168
|
+
unless filter.key?(:fuzzy)
|
169
|
+
filter[:fuzzy] = true
|
170
|
+
end
|
171
|
+
|
167
172
|
# Check if this is an aggregate column
|
168
173
|
if ['SUM(', 'COUNT(', 'MAX(', 'MIN(', 'AVG('].any? { |str| sql_column.include?(str) }
|
169
174
|
filter[:sql_operation] = :having
|