card-mod-search 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/script/autocomplete.js.coffee +2 -2
- data/config/admin.yml +6 -0
- data/data/files/mod_search_script_asset_output/file.js +1 -1
- data/set/abstract/0_search/views.rb +15 -3
- data/set/self/recent.rb +5 -0
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4e0888157c8ae7db22a9ac094ed705e61cb6df0cc971aac5910304d1feba587
|
4
|
+
data.tar.gz: f442615afe24128dcd1506df6d8d99989ebfa915f3be4785e5a456a0de05bcbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4712a996ebe145ac011e05f3528b015de3f45d2575d443c14716df8f2a09623534b057336be5122b45188d05b3fce01b4065364348371023e8a86a6a4c78a45
|
7
|
+
data.tar.gz: bdaf29e1e625c1132c3bd2d02a0e58af2d447ee709b3483c802f9ae92c4362193c9533c894d8ca298d49524f384d065d4d55e13e53fbb27afb10c77dd58d4418
|
@@ -2,8 +2,8 @@ decko.slot.ready (slot) ->
|
|
2
2
|
slot.find('._autocomplete').each (_i) ->
|
3
3
|
decko.initAutoCardPlete($(this))
|
4
4
|
|
5
|
-
slot.find('._select2autocomplete').each (_i) ->
|
6
|
-
decko.select2Autocomplete.init $(this)
|
5
|
+
# slot.find('._select2autocomplete').each (_i) ->
|
6
|
+
# decko.select2Autocomplete.init $(this)
|
7
7
|
|
8
8
|
decko.initAutoCardPlete = (input) ->
|
9
9
|
optionsCard = input.data 'options-card'
|
data/config/admin.yml
ADDED
@@ -1,4 +1,4 @@
|
|
1
1
|
// autocomplete.js.coffee
|
2
|
-
(function(){decko.slot.ready(function(e){return e.find("._autocomplete").each(function(){return decko.initAutoCardPlete($(this))})
|
2
|
+
(function(){decko.slot.ready(function(e){return e.find("._autocomplete").each(function(){return decko.initAutoCardPlete($(this))})}),decko.initAutoCardPlete=function(e){var t,n;if(t=e.data("options-card"))return n=t+".json?view=name_match",e.autocomplete({source:decko.slot.path(n)})},decko.select2Autocomplete={init:function(e,t,n){var o;return o=$.extend({},this._defaults(e),t),n&&$.extend(o.ajax,n),e.select2(o)},_defaults:function(e){return{multiple:!1,width:"100%!important",minimumInputLength:0,maximumSelectionSize:1,placeholder:e.attr("placeholder"),escapeMarkup:function(e){return e},ajax:{delay:200,cache:!0,url:decko.path(":search.json"),processResults:function(e){return{results:e}},data:function(e){return{query:{keyword:e.term},view:"complete"}}}}}}}).call(this);
|
3
3
|
// search_box.js.coffee
|
4
4
|
(function(){$(window).ready(function(){var t,o;return o=$("._search-box"),t=new decko.searchBox(o),o.data("searchBox",t),t.init()}),decko.searchBox=function(){function t(t){this.box=t,this.sourcepath=this.box.data("completepath"),this.originalpath=this.sourcepath,this.config={source:this.sourcepath,select:this.select}}return t.prototype.init=function(){return this.box.autocomplete(this.config,{html:!0})},t.prototype.select=function(t,o){var e;if(e=o.item.url)return window.location=e},t.prototype.form=function(){return this.box.closest("form")},t.prototype.keyword=function(){return this.keywordBox().val()},t.prototype.keywordBox=function(){return this.form().find("#query_keyword")},t}()}).call(this);
|
@@ -44,11 +44,11 @@ format :json do
|
|
44
44
|
|
45
45
|
# TODO: design better autocomplete API
|
46
46
|
view :name_complete, cache: :never do
|
47
|
-
complete_search limit: AUTOCOMPLETE_LIMIT
|
47
|
+
format_json_search { complete_search limit: AUTOCOMPLETE_LIMIT }
|
48
48
|
end
|
49
49
|
|
50
50
|
view :name_match, cache: :never do
|
51
|
-
complete_or_match_search limit: AUTOCOMPLETE_LIMIT
|
51
|
+
format_json_search { complete_or_match_search limit: AUTOCOMPLETE_LIMIT }
|
52
52
|
end
|
53
53
|
|
54
54
|
def complete_or_match_search limit: AUTOCOMPLETE_LIMIT, start_only: false,
|
@@ -68,9 +68,13 @@ format :json do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def match_search limit: AUTOCOMPLETE_LIMIT, not_names: [], additional_cql: {}
|
71
|
+
return [] unless term_param.present?
|
72
|
+
|
71
73
|
card.search name_cql(limit).merge(match_cql(not_names)).merge(additional_cql)
|
72
74
|
end
|
73
75
|
|
76
|
+
private
|
77
|
+
|
74
78
|
def name_cql limit
|
75
79
|
{ limit: limit, sort_by: "name", return: "name" }
|
76
80
|
end
|
@@ -84,6 +88,14 @@ format :json do
|
|
84
88
|
cql[:name] = ["not in"] + not_names if not_names.any?
|
85
89
|
cql
|
86
90
|
end
|
91
|
+
|
92
|
+
def format_json_search
|
93
|
+
results = yield
|
94
|
+
return results if item_view_options.dig(:view)&.to_sym == :name
|
95
|
+
results.map do |item_card|
|
96
|
+
nest_item item_card
|
97
|
+
end.to_json
|
98
|
+
end
|
87
99
|
end
|
88
100
|
|
89
101
|
format :data do
|
@@ -95,7 +107,7 @@ format :data do
|
|
95
107
|
end
|
96
108
|
|
97
109
|
format :csv do
|
98
|
-
view :
|
110
|
+
view :body, :body, mod: All::Csv::CsvFormat
|
99
111
|
end
|
100
112
|
|
101
113
|
format :html do
|
data/set/self/recent.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.
|
4
|
+
version: 0.17.0
|
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:
|
13
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,56 +18,56 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.107.0
|
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.
|
28
|
+
version: 1.107.0
|
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.
|
35
|
+
version: 0.17.0
|
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.
|
42
|
+
version: 0.17.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: card-mod-format
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
49
|
+
version: 0.17.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
56
|
+
version: 0.17.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: card-mod-help
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 0.17.0
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
70
|
+
version: 0.17.0
|
71
71
|
description: ''
|
72
72
|
email:
|
73
73
|
- info@decko.org
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- assets/script/autocomplete.js.coffee
|
81
81
|
- assets/script/search_box.js.coffee
|
82
82
|
- assets/style/search.scss
|
83
|
+
- config/admin.yml
|
83
84
|
- config/locales/de.yml
|
84
85
|
- config/locales/en.yml
|
85
86
|
- data/files/mod_search_script_asset_output/file.js
|
@@ -138,14 +139,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
139
|
requirements:
|
139
140
|
- - ">="
|
140
141
|
- !ruby/object:Gem::Version
|
141
|
-
version: '
|
142
|
+
version: '3.0'
|
142
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
144
|
requirements:
|
144
145
|
- - ">="
|
145
146
|
- !ruby/object:Gem::Version
|
146
147
|
version: '0'
|
147
148
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
149
|
+
rubygems_version: 3.5.10
|
149
150
|
signing_key:
|
150
151
|
specification_version: 4
|
151
152
|
summary: search
|