card-mod-search 0.11.4 → 0.11.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/card/filter_query.rb +4 -0
- data/set/abstract/05_search/views.rb +3 -5
- data/set/abstract/06_cql_search.rb +2 -0
- data/set/self/search.rb +3 -1
- data/set/type/search_type.rb +1 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab247713e806c7f460d3d47b4b3052a4aee4a2cb90b72f521cd65613a798519a
|
4
|
+
data.tar.gz: d5e7b8bfe70a3b2ea8d549c13629fa68104d1ed6fda504f6f3b5ab69858874b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31979f104835320a171003ee56e5a2dc761dc437cf777d9d7baf7baf05715746eccb60dfce4e7d903222beb67b05b829655105d8574f6145b08ea123e64d7413
|
7
|
+
data.tar.gz: 3a8b7174d25f86ec40b044b3a78e800543276788f5b1d085251682dc6c6edc02e94dfb14354f55232ace66bbb2a766831750109d43f32510fc3de64a5c44a24d
|
data/lib/card/filter_query.rb
CHANGED
@@ -16,6 +16,7 @@ class Card
|
|
16
16
|
|
17
17
|
def add_rule key, value
|
18
18
|
return unless value.present?
|
19
|
+
|
19
20
|
case @rules[key]
|
20
21
|
when Symbol
|
21
22
|
send("#{@rules[key]}_rule", key, value)
|
@@ -32,6 +33,7 @@ class Card
|
|
32
33
|
@cql = {}
|
33
34
|
@filter_cql.each do |cql_key, values|
|
34
35
|
next if values.empty?
|
36
|
+
|
35
37
|
case cql_key
|
36
38
|
when :right_plus, :left_plus, :type
|
37
39
|
merge_using_and cql_key, values
|
@@ -62,12 +64,14 @@ class Card
|
|
62
64
|
# nest values with the same key using :and
|
63
65
|
def build_nested_hash key, values
|
64
66
|
return { key => values[0] } if values.one?
|
67
|
+
|
65
68
|
val = values.pop
|
66
69
|
{ key => val, and: build_nested_hash(key, values) }
|
67
70
|
end
|
68
71
|
|
69
72
|
def name_cql name
|
70
73
|
return unless name.present?
|
74
|
+
|
71
75
|
@filter_cql[:name] = ["match", name]
|
72
76
|
end
|
73
77
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
format do
|
3
2
|
view :search_count, cache: :never do
|
4
3
|
search_with_params.to_s
|
@@ -55,6 +54,7 @@ format :json do
|
|
55
54
|
|
56
55
|
remaining_slots = limit - starts_with.size
|
57
56
|
return starts_with if remaining_slots.zero?
|
57
|
+
|
58
58
|
starts_with + match_search(not_names: starts_with, limit: remaining_slots)
|
59
59
|
end
|
60
60
|
|
@@ -145,12 +145,10 @@ format :html do
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
def search_result_list klass
|
148
|
+
def search_result_list klass, &block
|
149
149
|
with_paging do
|
150
150
|
wrap_with :div, class: klass do
|
151
|
-
search_with_params.map
|
152
|
-
yield item_card
|
153
|
-
end
|
151
|
+
search_with_params.map(&block)
|
154
152
|
end
|
155
153
|
end
|
156
154
|
end
|
@@ -14,6 +14,7 @@ end
|
|
14
14
|
def item_type
|
15
15
|
type = cql_hash[:type]
|
16
16
|
return if type.is_a?(Array) || type.is_a?(Hash)
|
17
|
+
|
17
18
|
type
|
18
19
|
end
|
19
20
|
|
@@ -44,6 +45,7 @@ def search args={}
|
|
44
45
|
# forces explicit limiting
|
45
46
|
# can be 0 or less to force no limit
|
46
47
|
raise "OH NO.. no limit" unless query.mods[:limit]
|
48
|
+
|
47
49
|
query.run
|
48
50
|
end
|
49
51
|
end
|
data/set/self/search.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
format do
|
3
2
|
view :search_error, cache: :never do
|
4
3
|
sr_class = search_with_params.class.to_s
|
@@ -34,6 +33,7 @@ end
|
|
34
33
|
format :html do
|
35
34
|
view :title, cache: :never do
|
36
35
|
return super() unless (title = keyword_search_title)
|
36
|
+
|
37
37
|
voo.title = title
|
38
38
|
end
|
39
39
|
|
@@ -62,12 +62,14 @@ format :json do
|
|
62
62
|
exact.name.valid? &&
|
63
63
|
!exact.virtual? &&
|
64
64
|
exact.ok?(:create)
|
65
|
+
|
65
66
|
[h(exact.name), URI.escape(exact.name)]
|
66
67
|
end
|
67
68
|
|
68
69
|
def new_item_of_type exact
|
69
70
|
return unless (exact.type_id == CardtypeID) &&
|
70
71
|
Card.new(type_id: exact.id).ok?(:create)
|
72
|
+
|
71
73
|
[exact.name, "new/#{exact.name.url_key}"]
|
72
74
|
end
|
73
75
|
|
data/set/type/search_type.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-05-
|
13
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.101.
|
21
|
+
version: 1.101.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.101.
|
28
|
+
version: 1.101.5
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: card-mod-collection
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.11.
|
35
|
+
version: 0.11.5
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.11.
|
42
|
+
version: 0.11.5
|
43
43
|
description: ''
|
44
44
|
email:
|
45
45
|
- info@decko.org
|