card-mod-search 0.12.0 → 0.13.3

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: e582401b6d9452b749809673d86b1b0163096ede7208c3893518e5ee4f0cca14
4
- data.tar.gz: f4f1e286dd46a71ddad9fc4d64b97071e015600b93f48fab7bb85bf73fe87ea9
3
+ metadata.gz: b62c6363e1945d22f1a8ad2d7575801b6884437b9f8fed6b891220c434b3a052
4
+ data.tar.gz: 72f33ec4982f972c9f8a6384430087d5f6703092b8e77e5358193898ea3a63d3
5
5
  SHA512:
6
- metadata.gz: f99cf1528d3e2e314bc1ebd2448c15a306132ea0464928ba3ddbf31502e5d451e275ddef031d18ff8e62cae425fd8f6a6d6ef97ba1e58cd6942287b34491195a
7
- data.tar.gz: 9c2ea37fe66f430a1eba3a282a18401f105b73eb68e589cd645489ef4831e5091dbf9b45b363ae2c617d19b9c7b808c8493be112f50b4f84ab0b4cda53375933
6
+ metadata.gz: db553b0e06bd1176428ad59a4baa8fb9d5b7383a852fc10d0b3340d9689d01222f076d436317d6350cc57fe6a56685e6b8a8275ae23909da7c968b9ebb5e64d8
7
+ data.tar.gz: '009f9d91b870c53ace919b18a047cd91d939436cd4969e57bc45624900d810f2f10801183dd85d443f3f17e0259dba37553e5159fcd94ee3a701bbd8423bd601'
@@ -25,7 +25,7 @@ class Card
25
25
  @filter_cql[cql_key] << val
26
26
  end
27
27
  else
28
- send("#{key}_cql", value)
28
+ send "#{key}_cql", value
29
29
  end
30
30
  end
31
31
 
@@ -85,7 +85,7 @@ format :html do
85
85
  end
86
86
 
87
87
  def filter_label_from_name field
88
- Card.fetch_name(field) { field.to_s.titleize }
88
+ Card.fetch_name(field) { field.to_s.sub(/^\*/, "").titleize }
89
89
  end
90
90
 
91
91
  def filter_action_path
@@ -22,6 +22,7 @@ format :html do
22
22
  view :filtered_content, template: :haml, wrap: :slot
23
23
 
24
24
  view :filtered_results do
25
+ class_up "card-slot", "_filter-result-slot"
25
26
  wrap { render_core }
26
27
  end
27
28
 
@@ -13,9 +13,7 @@ end
13
13
 
14
14
  def item_type
15
15
  type = cql_hash[:type]
16
- return if type.is_a?(Array) || type.is_a?(Hash)
17
-
18
- type
16
+ type unless type.is_a?(Array) || type.is_a?(Hash)
19
17
  end
20
18
 
21
19
  # for override, eg when required subqueries are known to be missing
@@ -0,0 +1,11 @@
1
+ def cql_content
2
+ { referred_to_by: "_" }
3
+ end
4
+
5
+ def item_cards args={}
6
+ standard_item_cards args
7
+ end
8
+
9
+ def count
10
+ item_strings.size
11
+ end
@@ -0,0 +1,74 @@
1
+ format do
2
+ view :core, cache: :never do
3
+ _render search_result_view
4
+ end
5
+
6
+ def search_result_view
7
+ case search_with_params
8
+ when Exception then :search_error
9
+ when Integer then :search_count
10
+ when nest_mode == :template then :raw
11
+ else :card_list
12
+ end
13
+ end
14
+ end
15
+
16
+ format :json do
17
+ def items_for_export
18
+ return [] if card.content.empty? || unexportable_tag?(card.name.tag_name.key)
19
+
20
+ card.item_cards
21
+ end
22
+
23
+ # avoid running the search from +:content_options (huge results)
24
+ # and +:structure (errors)
25
+ # TODO: make this configurable in set mods
26
+ def unexportable_tag? tag_key
27
+ %i[content_options structure].map { |code| code.cardname.key }.include? tag_key
28
+ end
29
+ end
30
+
31
+ format :rss do
32
+ view :feed_body do
33
+ case raw_feed_items
34
+ when Exception then @xml.item(render!(:search_error))
35
+ when Integer then @xml.item(render!(:search_count))
36
+ else super()
37
+ end
38
+ end
39
+
40
+ def raw_feed_items
41
+ @raw_feed_items ||= search_with_params
42
+ end
43
+ end
44
+
45
+ format :html do
46
+ view :core do
47
+ _render search_result_view
48
+ end
49
+
50
+ view :bar do
51
+ voo.hide :one_line_content
52
+ super()
53
+ end
54
+
55
+ view :one_line_content, cache: :never do
56
+ if depth > max_depth
57
+ "..."
58
+ else
59
+ search_params[:limit] = closed_limit
60
+ _render_core hide: "paging", items: { view: :link }
61
+ # TODO: if item is queryified to be "name", then that should work.
62
+ # otherwise use link
63
+ end
64
+ end
65
+
66
+ def rss_link_tag
67
+ path_opts = { format: :rss }
68
+ Array(search_params[:vars]).compact.each { |k, v| opts["_#{k}"] = v }
69
+ tag "link", rel: "alternate",
70
+ type: "application/rss+xml",
71
+ title: "RSS",
72
+ href: path(path_opts)
73
+ end
74
+ end
data/set/self/search.rb CHANGED
@@ -63,7 +63,7 @@ format :json do
63
63
  !exact.virtual? &&
64
64
  exact.ok?(:create)
65
65
 
66
- [h(exact.name), URI.escape(exact.name)]
66
+ [h(exact.name), ERB::Util.url_encode(exact.name)]
67
67
  end
68
68
 
69
69
  def new_item_of_type exact
@@ -1,81 +1,9 @@
1
1
  include_set Type::Json
2
2
  include_set Abstract::CqlSearch
3
+ include_set Abstract::SearchViews
3
4
 
4
5
  format do
5
- view :core, cache: :never do
6
- _render search_result_view
7
- end
8
-
9
6
  def chunk_list
10
7
  :query
11
8
  end
12
-
13
- def search_result_view
14
- case search_with_params
15
- when Exception then :search_error
16
- when Integer then :search_count
17
- when nest_mode == :template then :raw
18
- else :card_list
19
- end
20
- end
21
- end
22
-
23
- format :json do
24
- def items_for_export
25
- return [] if card.content.empty? || unexportable_tag?(card.name.tag_name.key)
26
-
27
- card.item_cards
28
- end
29
-
30
- # avoid running the search from +:content_options (huge results)
31
- # and +:structure (errors)
32
- # TODO: make this configurable in set mods
33
- def unexportable_tag? tag_key
34
- %i[content_options structure].map { |code| code.cardname.key }.include? tag_key
35
- end
36
- end
37
-
38
- format :rss do
39
- view :feed_body do
40
- case raw_feed_items
41
- when Exception then @xml.item(render!(:search_error))
42
- when Integer then @xml.item(render!(:search_count))
43
- else super()
44
- end
45
- end
46
-
47
- def raw_feed_items
48
- @raw_feed_items ||= search_with_params
49
- end
50
- end
51
-
52
- format :html do
53
- view :core do
54
- _render search_result_view
55
- end
56
-
57
- view :bar do
58
- voo.hide :one_line_content
59
- super()
60
- end
61
-
62
- view :one_line_content, cache: :never do
63
- if depth > max_depth
64
- "..."
65
- else
66
- search_params[:limit] = closed_limit
67
- _render_core hide: "paging", items: { view: :link }
68
- # TODO: if item is queryified to be "name", then that should work.
69
- # otherwise use link
70
- end
71
- end
72
-
73
- def rss_link_tag
74
- path_opts = { format: :rss }
75
- Array(search_params[:vars]).compact.each { |k, v| opts["_#{k}"] = v }
76
- tag "link", rel: "alternate",
77
- type: "application/rss+xml",
78
- title: "RSS",
79
- href: path(path_opts)
80
- end
81
9
  end
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.12.0
4
+ version: 0.13.3
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-07-05 00:00:00.000000000 Z
13
+ date: 2021-09-24 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.102.0
21
+ version: 1.103.3
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.102.0
28
+ version: 1.103.3
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.12.0
35
+ version: 0.13.3
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.12.0
42
+ version: 0.13.3
43
43
  description: ''
44
44
  email:
45
45
  - info@decko.org
@@ -59,14 +59,15 @@ files:
59
59
  - set/abstract/03_filter/query_construction.rb
60
60
  - set/abstract/03_filter/quick_filters.haml
61
61
  - set/abstract/03_filter/selectable_filtered_content.haml
62
- - set/abstract/04_right_filter_form.rb
63
62
  - set/abstract/05_search.rb
64
63
  - set/abstract/05_search/checkbox_item.haml
65
64
  - set/abstract/05_search/select_item.haml
66
65
  - set/abstract/05_search/views.rb
67
66
  - set/abstract/06_cql_search.rb
67
+ - set/abstract/filter_list.rb
68
68
  - set/abstract/filterable.rb
69
69
  - set/abstract/filterable_bar.rb
70
+ - set/abstract/search_views.rb
70
71
  - set/right/children.rb
71
72
  - set/right/created.rb
72
73
  - set/right/edited.rb
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  - !ruby/object:Gem::Version
109
110
  version: '0'
110
111
  requirements: []
111
- rubygems_version: 3.2.15
112
+ rubygems_version: 3.1.6
112
113
  signing_key:
113
114
  specification_version: 4
114
115
  summary: search
@@ -1,26 +0,0 @@
1
- # To be included in a field card to get a filter for the parent.
2
- # The core view renders a filter for the left card.
3
-
4
- include_set Set::Abstract::Filter
5
-
6
- def virtual?
7
- new?
8
- end
9
-
10
- format :html do
11
- def filter_action_path
12
- path mark: card.name.left, view: filter_view
13
- end
14
-
15
- view :core, cache: :never do
16
- filter_fields slot_selector: filter_selector
17
- end
18
-
19
- def filter_view
20
- :filter_result
21
- end
22
-
23
- def filter_selector
24
- ".#{filter_view}-view"
25
- end
26
- end