card-mod-search 0.11.3 → 0.11.7

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: 3f10cadf09bfd58e7a6361fbec9aaa2bc2fe24cdfc6c9df1245657ec8f6a4deb
4
- data.tar.gz: 94fba1f07b64166998755430d20129f06f225d5da5e0f82954313c018ae8a798
3
+ metadata.gz: da80215b28b3fd3a1435b178a743ee3e604368833c2d8bafc45f98de457b21de
4
+ data.tar.gz: 4ef54f7fa398567d897d83e4119645eda8aa36e1f5a9ea9c26c57384ef27e5fe
5
5
  SHA512:
6
- metadata.gz: a63d2059b8b1c277eb27637bde95cca0804ba9bc8bb9f87ce5a61a9b482b9192e0003b9f9664d4e9cf822f8166532f64c75e47e1e34a24c43abf925b7aba4fe1
7
- data.tar.gz: baf6b4f536e0320490833eee85cc7438a243914dd476907cec303de85783bd1f963af0887045721a6efb0888fd89d4fbd96b646dcf04db3927383c459da67029
6
+ metadata.gz: 97ebfda126f45fb310eddae1389e0d8901245a6045388bdae669adefce59c0509068f456826a969ab4d2edc027db8994bafdff55b9bceb32590e473f58b6f85e
7
+ data.tar.gz: 3ba15a45174a9468861195da7b7af3199b62111ef0dcae15f37d35b24edd205d6b250511a1714d88187a84b1ebdb3cdb652bc184bc44200656b776b75917acb3
@@ -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
@@ -27,9 +27,7 @@ format do
27
27
  end
28
28
 
29
29
  def extra_paging_path_args
30
- return {} unless (vars = query_params)
31
-
32
- { query: vars }
30
+ (vars = query_params) ? { query: vars } : {}
33
31
  end
34
32
  end
35
33
 
@@ -7,7 +7,7 @@ format :html do
7
7
 
8
8
  def select_filter field, default=nil, options=nil
9
9
  options ||= filter_options field
10
- options.unshift(["--", ""]) unless default
10
+ options = [["--", ""]] + options unless default
11
11
  select_filter_tag field, default, options
12
12
  end
13
13
 
@@ -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 do |item_card|
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
 
@@ -23,6 +23,7 @@ end
23
23
  format :json do
24
24
  def items_for_export
25
25
  return [] if card.content.empty? || unexportable_tag?(card.name.tag_name.key)
26
+
26
27
  card.item_cards
27
28
  end
28
29
 
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.3
4
+ version: 0.11.7
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-04-01 00:00:00.000000000 Z
13
+ date: 2021-08-01 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.3
21
+ version: 1.101.7
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.3
28
+ version: 1.101.7
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.3
35
+ version: 0.11.7
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.3
42
+ version: 0.11.7
43
43
  description: ''
44
44
  email:
45
45
  - info@decko.org
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.1.4
111
+ rubygems_version: 3.1.6
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: search