effective_resources 2.19.9 → 2.19.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/effective_resources_helper.rb +3 -1
- data/app/models/concerns/acts_as_email_form.rb +9 -7
- data/app/models/effective/resources/relation.rb +20 -28
- data/app/views/effective/resource/_actions.html.haml +4 -2
- data/app/views/effective/resource/_actions_dropleft.html.haml +3 -1
- data/app/views/effective/resource/_actions_glyphicons.html.haml +3 -1
- data/lib/effective_resources/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: 0fc5b41757668d88d0ae83b6a52f332ad18e645658909bf80c69b3fa47dd3b98
|
4
|
+
data.tar.gz: 55830a5d7d49dfea77885a2741dd06f335f6dbbc6cf80b86beccc39b720e9535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef99fd38dede8d87305ef660a87cc95ea64b9307812d80b7dd14cd2f2b4da7dd5e8532ac2ddf9e39521cdd637ab5027a4c8534bb1a8bc5ee134576a148d16f24
|
7
|
+
data.tar.gz: 7527c0b651f37c1046299286e8165bb4a3670e879227b4be7ce83c6fb3c742eab7876f2c54138f1cd25bad281b13a69d2da5085c3b629d38f3a7d34e5fb07dd7
|
@@ -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)
|
@@ -2,5 +2,7 @@
|
|
2
2
|
- action = opts.delete(:action)
|
3
3
|
= link_to(label, (effective_resource.action_path(action, resource) || '#'), opts)
|
4
4
|
|
5
|
-
|
6
|
-
=
|
5
|
+
- if local_assigns[:format_block] && local_assigns[:datatable]
|
6
|
+
= instance_exec(resource, datatable, &format_block)
|
7
|
+
|
8
|
+
= yield(resource) if block_given?
|
@@ -5,5 +5,7 @@
|
|
5
5
|
|
6
6
|
= dropdown_link_to(label, (effective_resource.action_path(action, resource) || '#'), opts)
|
7
7
|
|
8
|
-
|
8
|
+
- if local_assigns[:format_block] && local_assigns[:datatable]
|
9
|
+
= instance_exec(resource, datatable, &format_block)
|
10
|
+
|
9
11
|
= yield(resource) if block_given?
|
@@ -4,5 +4,7 @@
|
|
4
4
|
|
5
5
|
= glyphicon_to(action, (effective_resource.action_path(action, resource) || '#'), opts)
|
6
6
|
|
7
|
-
|
7
|
+
- if local_assigns[:format_block] && local_assigns[:datatable]
|
8
|
+
= instance_exec(resource, datatable, &format_block)
|
9
|
+
|
8
10
|
= yield(resource) if block_given?
|
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.11
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|