effective_resources 2.19.9 → 2.19.10
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc082069435ea9d5601f7d80eb676c1cbba2f63372659236151412c00f8feea
|
4
|
+
data.tar.gz: bed63eedbeb63602746e0e186d84d6f56c2635415ce9eff19a6e33e69aeb973a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60329f1197ae967e67df7cf12eb1e9be25d6074a8a8e8993fbfb29275e3deeeabb2fcca589f8d50c6278d7b9e54d2ebed8e29413c1f209f78501dddaa66d9f25
|
7
|
+
data.tar.gz: eadc102a68f6b214bce5664c04f0a4a5ad51c435b12f040d760a94e5667f6ed86522770c48b4456dd6638769e5385b3c934068c6ca21bd27886992d39e9c9c2c
|
@@ -78,7 +78,9 @@ module EffectiveResourcesHelper
|
|
78
78
|
|
79
79
|
# Assign actions
|
80
80
|
# We filter out any actions passed to us that aren't supported
|
81
|
-
actions = if atts.key?(:actions)
|
81
|
+
actions = if atts.key?(:actions) && atts[:actions] == false
|
82
|
+
{}
|
83
|
+
elsif atts.key?(:actions)
|
82
84
|
{}.tap do |actions|
|
83
85
|
atts[:actions].each do |commit, opts|
|
84
86
|
actions[commit] = opts if (effective_resource.actions.include?(opts[:action]) || opts[:path]).present?
|
@@ -24,13 +24,15 @@ module ActsAsEmailForm
|
|
24
24
|
attr_accessor :email_form_subject
|
25
25
|
attr_accessor :email_form_body
|
26
26
|
|
27
|
-
effective_resource
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
if respond_to?(:effective_resource)
|
28
|
+
effective_resource do
|
29
|
+
email_form_action :string, permitted: true
|
30
|
+
email_form_skip :boolean, permitted: true
|
31
|
+
|
32
|
+
email_form_from :string, permitted: true
|
33
|
+
email_form_subject :string, permitted: true
|
34
|
+
email_form_body :text, permitted: true
|
35
|
+
end
|
34
36
|
end
|
35
37
|
|
36
38
|
with_options(if: -> { email_form_action.present? && !email_form_skip? }) do
|
@@ -394,6 +394,7 @@ module Effective
|
|
394
394
|
end
|
395
395
|
|
396
396
|
return relation.none() if columns.blank?
|
397
|
+
|
397
398
|
search_columns_by_ilike_term(relation, value, columns: columns, fuzzy: fuzzy)
|
398
399
|
end
|
399
400
|
|
@@ -404,42 +405,33 @@ module Effective
|
|
404
405
|
|
405
406
|
value = value.to_s
|
406
407
|
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
terms = []
|
411
|
-
join = ''
|
412
|
-
|
413
|
-
if value.include?(' OR ')
|
414
|
-
terms = value.split(' OR ')
|
415
|
-
join = ' OR '
|
408
|
+
# Process search terms
|
409
|
+
terms = if value.include?(' OR ')
|
410
|
+
value.split(' OR ')
|
416
411
|
elsif value.include?(' AND ')
|
417
|
-
|
418
|
-
join = ' AND '
|
412
|
+
value.split(' AND ')
|
419
413
|
else
|
420
|
-
|
421
|
-
join = ' AND '
|
414
|
+
value.split(' ')
|
422
415
|
end
|
423
416
|
|
424
417
|
terms = (terms - [nil, '', ' ']).map(&:strip)
|
425
|
-
columns = Array(columns)
|
426
|
-
fuzzy = true if fuzzy.nil?
|
427
418
|
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
# Do any of these columns contain all the terms?
|
433
|
-
conditions = columns.map do |name|
|
434
|
-
column = (name.to_s.include?('.') ? name : sql_column(name))
|
435
|
-
raise("expected an sql column for #{name}") if column.blank?
|
419
|
+
# Searching these columns with this behaviour
|
420
|
+
fuzzy = true if fuzzy.nil?
|
421
|
+
joiner = value.include?(' OR ') ? :or : :and
|
436
422
|
|
437
|
-
|
438
|
-
|
439
|
-
|
423
|
+
# Each term must match some column. Depending on the joiner, each term must match some column
|
424
|
+
terms.map do |term|
|
425
|
+
Array(columns).map do |name|
|
426
|
+
column = (name.to_s.include?('.') ? name : sql_column(name))
|
440
427
|
|
441
|
-
|
442
|
-
|
428
|
+
if fuzzy
|
429
|
+
collection.where("#{column} #{ilike} ?", "%#{term}%")
|
430
|
+
else
|
431
|
+
collection.where("#{column} = ?", term)
|
432
|
+
end
|
433
|
+
end.inject(:or)
|
434
|
+
end.inject(joiner)
|
443
435
|
end
|
444
436
|
|
445
437
|
def order_by_associated_conditions(association, sort: nil, direction: :asc, limit: nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.19.
|
4
|
+
version: 2.19.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: 2024-03-
|
11
|
+
date: 2024-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|