effective_datatables 4.13.5 → 4.14.1

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: 1a652ec20b06f01718d88cbc9c6d78e6905c44239c577009b6df777d02432975
4
- data.tar.gz: 6f148f5dd453d595ae3bca1592b179974802c2b3c6b83d0051bd6043ce39533e
3
+ metadata.gz: 9504d0adc46bb18b44f0f39600966cbd7706c10598874a21c932ff7b00089032
4
+ data.tar.gz: 6cc0623cb402890be52af4179ad4083707778454c6846465844fc8f2cd766588
5
5
  SHA512:
6
- metadata.gz: e9c0d5927da2c915118f5b0347591b38a8e355f1d2860548523da04a3cfd6b3dac10d66181f353552bc4bcfa63ba218d2254c55a38e3ad8c89c7869dcdfaadd2
7
- data.tar.gz: 32b2a35689ca9591d7729b2ec72164c6b699d81dfbca19fd54948f866a952f364c9d5713db0617ad19deb285f1151be78b8bb8a961158d2833f3eaa8a2de76a8
6
+ metadata.gz: 85e973dfd64010d90dba19b4124e15fe08bfaa17222d28adcefdd756d9566a066494222196f5e19b2d43b8f999fa6670ac0e658272c87406845cb355dd24bd8f
7
+ data.tar.gz: 94f3f5d792fefad761279f1ba8955aa878ead86188d5d68737594da33c74b8d00d02a4f2fab708b3f31d302baa38b19c5abfcb164c5d7c9ba1a17febeb0773dd
@@ -75,10 +75,10 @@ module Effective
75
75
  end
76
76
 
77
77
  def search_column(collection, value, column, sql_column)
78
- Rails.logger.info "COLUMN TOOL: search_column #{column.to_s} #{value} #{sql_column}" if EffectiveDatatables.debug
78
+ Rails.logger.info "COLUMN TOOL: search_column #{column.to_s} value=#{value} operation=#{column[:search][:operation]} column=#{sql_column}" if EffectiveDatatables.debug
79
79
 
80
80
  Effective::Resource.new(collection)
81
- .search(column[:name], value, as: column[:as], fuzzy: column[:search][:fuzzy], sql_column: sql_column)
81
+ .search(column[:name], value, as: column[:as], operation: column[:search][:operation], column: sql_column)
82
82
  end
83
83
 
84
84
  def paginate(collection)
@@ -158,7 +158,6 @@ module Effective
158
158
 
159
159
  def load_resource_search!
160
160
  columns.each do |name, opts|
161
-
162
161
  case opts[:search]
163
162
  when false
164
163
  opts[:search] = { as: :null }; next
@@ -176,13 +175,12 @@ module Effective
176
175
 
177
176
  # Parameterize collection
178
177
  if search[:collection].kind_of?(ActiveRecord::Relation)
179
- search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.to_param] }
178
+ search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.id] }
180
179
  elsif search[:collection].kind_of?(Array) && search[:collection].first.kind_of?(ActiveRecord::Base)
181
- search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.to_param] }
180
+ search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.id] }
182
181
  end
183
182
 
184
183
  search[:as] ||= :select if search.key?(:collection)
185
- search[:fuzzy] ||= true unless search.key?(:fuzzy)
186
184
  search[:value] ||= search.delete(:selected) if search.key?(:selected)
187
185
 
188
186
  # Merge with defaults
@@ -195,6 +193,12 @@ module Effective
195
193
  search.reverse_merge!(search_resource.search_form_field(name, opts[:as]))
196
194
  end
197
195
 
196
+ # Assign default search operation
197
+ search[:operation] ||= search.delete(:op)
198
+ search[:operation] ||= :matches if search[:fuzzy]
199
+ search[:operation] ||= :eq if search[:as] == :select
200
+ search[:operation] ||= search_resource.sql_operation(name, as: opts[:as])
201
+
198
202
  # Assign default include_null
199
203
  if search[:as] == :select && !search.key?(:include_null)
200
204
  search[:include_null] = true
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.13.5'.freeze
2
+ VERSION = '4.14.1'.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.13.5
4
+ version: 4.14.1
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: 2022-12-21 00:00:00.000000000 Z
11
+ date: 2023-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails