effective_datatables 4.7.9 → 4.7.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/datatable_value_tool.rb +19 -18
- 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: d7466c3941269d0062b5b2f920ae7371343f341bc8f09c8672d3a57217a80d57
|
4
|
+
data.tar.gz: 3338eb6cdc80824533d228d14aa9414ff19b3947b849ba466b348a5448ba6c18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e4ef7ef9d01e2f192dfe051c09fbbe1f9fdc4fd2979ca3cfd2b86ab8bc6a5fb31708e8e1531c882db9fc3b08cdd60580440e25613f0bf6ebc41d98f29cfac29
|
7
|
+
data.tar.gz: e6a9170763f485ad3cddc04d5502b7fca657c28aa9cd04c509c91975e68b9139489f8b2e1bc0ac10ed707b621286330aab06f82c1fce1221d121b7b4241ae152
|
@@ -74,12 +74,12 @@ module Effective
|
|
74
74
|
collection
|
75
75
|
end
|
76
76
|
|
77
|
-
def search_column(collection,
|
78
|
-
Rails.logger.info "VALUE TOOL: search_column #{column.to_s} #{
|
77
|
+
def search_column(collection, original, column, index)
|
78
|
+
Rails.logger.info "VALUE TOOL: search_column #{column.to_s} #{original} #{index}" if EffectiveDatatables.debug
|
79
79
|
|
80
80
|
fuzzy = column[:search][:fuzzy]
|
81
81
|
|
82
|
-
term = Effective::Attribute.new(column[:as]).parse(
|
82
|
+
term = Effective::Attribute.new(column[:as]).parse(original, name: column[:name])
|
83
83
|
term_downcased = term.to_s.downcase
|
84
84
|
|
85
85
|
# term == 'nil' rescue false is a Rails 4.1 fix, where you can't compare a TimeWithZone to 'nil'
|
@@ -89,7 +89,8 @@ module Effective
|
|
89
89
|
|
90
90
|
# See effective_resources gem search() method # relation.rb
|
91
91
|
collection.select! do |row|
|
92
|
-
obj =
|
92
|
+
obj = row[index]
|
93
|
+
value = obj_to_value(row[index], column, row)
|
93
94
|
|
94
95
|
case column[:as]
|
95
96
|
when :boolean
|
@@ -100,7 +101,7 @@ module Effective
|
|
100
101
|
end
|
101
102
|
when :datetime, :date
|
102
103
|
end_at = (
|
103
|
-
case (
|
104
|
+
case (original.to_s.scan(/(\d+)/).flatten).length
|
104
105
|
when 1 ; term.end_of_year # Year
|
105
106
|
when 2 ; term.end_of_month # Year-Month
|
106
107
|
when 3 ; term.end_of_day # Year-Month-Day
|
@@ -110,35 +111,35 @@ module Effective
|
|
110
111
|
else term
|
111
112
|
end
|
112
113
|
)
|
113
|
-
|
114
|
+
value >= term && value <= end_at
|
114
115
|
when :time
|
115
|
-
(
|
116
|
+
(value.hour == term.hour) && (term.min == 0 ? true : (value.min == term.min))
|
116
117
|
when :decimal, :currency
|
117
|
-
if fuzzy && (term.round(0) == term) &&
|
118
|
+
if fuzzy && (term.round(0) == term) && original.to_s.include?('.') == false
|
118
119
|
if term < 0
|
119
|
-
|
120
|
+
value <= term && value > (term - 1.0)
|
120
121
|
else
|
121
|
-
|
122
|
+
value >= term && value < (term + 1.0)
|
122
123
|
end
|
123
124
|
else
|
124
|
-
|
125
|
+
value == term
|
125
126
|
end
|
126
127
|
when :duration
|
127
|
-
if fuzzy && (term % 60 == 0) &&
|
128
|
+
if fuzzy && (term % 60 == 0) && original.to_s.include?('m') == false
|
128
129
|
if term < 0
|
129
|
-
|
130
|
+
value <= term && value > (term - 60)
|
130
131
|
else
|
131
|
-
|
132
|
+
value >= term && value < (term + 60)
|
132
133
|
end
|
133
134
|
else
|
134
|
-
|
135
|
+
value == term
|
135
136
|
end
|
136
137
|
when *datatable.association_macros, :resource
|
137
138
|
Array(obj).any? do |resource|
|
138
139
|
Array(term).any? do |term|
|
139
140
|
matched = false
|
140
141
|
|
141
|
-
if term.kind_of?(Integer) && resource.respond_to?(:to_param)
|
142
|
+
if term.kind_of?(Integer) && resource.respond_to?(:id) && resource.respond_to?(:to_param)
|
142
143
|
matched = (resource.id == term || resource.to_param == term)
|
143
144
|
end
|
144
145
|
|
@@ -147,9 +148,9 @@ module Effective
|
|
147
148
|
end
|
148
149
|
else # :string, :text, :email
|
149
150
|
if fuzzy
|
150
|
-
|
151
|
+
value.to_s.downcase.include?(term_downcased)
|
151
152
|
else
|
152
|
-
|
153
|
+
value == term || (value.to_s == term.to_s)
|
153
154
|
end
|
154
155
|
end
|
155
156
|
end || collection
|
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.
|
4
|
+
version: 4.7.10
|
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-07-
|
11
|
+
date: 2019-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|