card-mod-search 0.11.1 → 0.11.6
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/02_search_params.rb +1 -3
- data/set/abstract/03_filter/form_helper.rb +1 -1
- data/set/abstract/05_search.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 +13 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6c5e011eb6ad9f5584529fb48b1d8c0b378234da6c7d3641df61936adb3e797
|
4
|
+
data.tar.gz: 7d9da17ca8592ee6d0ca07dc771f0d36339e4ba269f66cbe5d5dcef02ae95ca4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 201f09f82616dfe770da0bc73fc57f3f3e5dfbb079f2e14f221c56113aee83ddba6bcf22f77c82c76fa70522efeba2bb7e91637c0bf921e0aaaed08bc7503db0
|
7
|
+
data.tar.gz: 4f88e3c0e2283b7354dbf53dd81a3d55fa1cf26cf6ba7148fdfe5b8afbec5a26dbc6dba510bab370b894a57df3fbe74d6e5e72077e3ac63fd493bb309972ceb8
|
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
|
data/set/abstract/05_search.rb
CHANGED
@@ -60,6 +60,10 @@ format do
|
|
60
60
|
@count_with_params ||= search_with_rescue search_params.merge(return: :count)
|
61
61
|
end
|
62
62
|
|
63
|
+
view :filtered_count, cache: :never do
|
64
|
+
count_with_params
|
65
|
+
end
|
66
|
+
|
63
67
|
def search_with_rescue query_args
|
64
68
|
rescuing_bad_query query_args do
|
65
69
|
card.cached_search query_args
|
@@ -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.6
|
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-
|
13
|
+
date: 2021-05-21 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.6
|
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.6
|
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.6
|
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.6
|
43
43
|
description: ''
|
44
44
|
email:
|
45
45
|
- info@decko.org
|
@@ -83,10 +83,15 @@ files:
|
|
83
83
|
- set/self/search.rb
|
84
84
|
- set/type/cardtype.rb
|
85
85
|
- set/type/search_type.rb
|
86
|
-
homepage:
|
86
|
+
homepage: https://decko.org
|
87
87
|
licenses:
|
88
88
|
- GPL-3.0
|
89
89
|
metadata:
|
90
|
+
source_code_uri: https://github.com/decko-commons/decko
|
91
|
+
homepage_uri: https://decko.org
|
92
|
+
bug_tracker_uri: https://github.com/decko-commons/decko/issues
|
93
|
+
wiki_uri: https://decko.org
|
94
|
+
documentation_url: http://docs.decko.org/
|
90
95
|
card-mod: search
|
91
96
|
post_install_message:
|
92
97
|
rdoc_options: []
|
@@ -103,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
108
|
- !ruby/object:Gem::Version
|
104
109
|
version: '0'
|
105
110
|
requirements: []
|
106
|
-
rubygems_version: 3.
|
111
|
+
rubygems_version: 3.1.4
|
107
112
|
signing_key:
|
108
113
|
specification_version: 4
|
109
114
|
summary: search
|