forest_admin_datasource_customizer 1.39.0 → 1.39.2
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e2511c286b5ae8f5ca42d5c9cd39c58ce1dcf78bb868c9f6d0f2cb70e33fa113
|
|
4
|
+
data.tar.gz: ea2cb173c49bd8fb8d66a0d161ac6045e88d05b35bdf4bc302b4c985750bd863
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 289a606405533d1d7f8fb13a9ae1ef3b36887a31dab1d4e89dc2f3ffe537b2805ccac8f33e556823120dce377f5730fbd4bba520447f5d5cffc067815ea1f48a
|
|
7
|
+
data.tar.gz: 12c62a7e32817d67a896fe0b1d7be20dbf9245aac0432f24d5064d90580bd1a37a2b1b9794b793cebcb016d4b9079e5d199e9db427dc150cff8d8e617775cb02
|
data/lib/forest_admin_datasource_customizer/decorators/search/search_collection_decorator.rb
CHANGED
|
@@ -56,8 +56,43 @@ module ForestAdminDatasourceCustomizer
|
|
|
56
56
|
filter
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
# Answers against +@child_collection+, which is what the search actually reads: a field
|
|
60
|
+
# hidden by the publication or renaming layers above is still searched.
|
|
61
|
+
#
|
|
62
|
+
# The term is run through the same +build_condition+ selection +refine_filter+ applies, so a
|
|
63
|
+
# field the search cannot match — a number column for a word, a uuid column for anything
|
|
64
|
+
# else — is left out rather than reported as reached.
|
|
65
|
+
#
|
|
66
|
+
# +nil+ whenever this layer does not choose the fields — a replacer is installed, or the
|
|
67
|
+
# child collection searches natively — because then no enumeration made here is true.
|
|
68
|
+
def searched_fields(search, extended)
|
|
69
|
+
return nil unless enumerable_search?
|
|
70
|
+
return [] if insignificant_search?(search)
|
|
71
|
+
|
|
72
|
+
get_fields(extended).filter_map do |path, schema|
|
|
73
|
+
searched_field(path) if build_condition(path, schema, search)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
59
77
|
private
|
|
60
78
|
|
|
79
|
+
def enumerable_search?
|
|
80
|
+
@replacer.nil? && !@child_collection.schema[:searchable]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def insignificant_search?(search)
|
|
84
|
+
search.nil? || search.strip.empty?
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def searched_field(path)
|
|
88
|
+
{
|
|
89
|
+
path: path,
|
|
90
|
+
collections: ForestAdminDatasourceToolkit::Utils::FieldPath.leaf_collection_names(
|
|
91
|
+
@child_collection, path
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
end
|
|
95
|
+
|
|
61
96
|
def default_replacer(search, extended)
|
|
62
97
|
searchable_fields = get_fields(extended)
|
|
63
98
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_datasource_customizer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.39.
|
|
4
|
+
version: 1.39.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthieu
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-08-
|
|
12
|
+
date: 2026-08-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|