card-mod-search 0.14.2 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -0
- data/assets/script/autocomplete.js.coffee +36 -0
- data/assets/script/search_box.js.coffee +24 -0
- data/assets/style/search.scss +69 -0
- data/data/files/mod_search_script_asset_output/file.js +4 -0
- data/data/real.yml +112 -0
- data/data/test.yml +18 -0
- data/lib/card/mod/search.rb +4 -0
- data/locales/en.yml +4 -0
- data/set/abstract/0_search/checkbox_item.haml +6 -0
- data/set/abstract/{02_search_params.rb → 0_search/search_params.rb} +2 -4
- data/set/abstract/{05_search → 0_search}/views.rb +32 -46
- data/set/abstract/{05_search.rb → 0_search.rb} +3 -9
- data/set/abstract/{06_cql_search.rb → cql_search.rb} +3 -6
- data/set/abstract/search_views.rb +1 -2
- data/set/abstract/virtual_search.rb +3 -0
- data/set/all/autocomplete/autocomplete_input.haml +3 -0
- data/set/all/autocomplete/autocomplete_item.haml +5 -0
- data/set/all/autocomplete.rb +48 -0
- data/set/right/by_create.rb +7 -0
- data/set/right/by_name.rb +7 -0
- data/set/right/by_update.rb +7 -0
- data/set/right/children.rb +8 -0
- data/set/right/count.rb +9 -0
- data/set/right/created.rb +8 -0
- data/set/right/creator.rb +7 -0
- data/set/right/edited.rb +8 -0
- data/set/right/editors.rb +8 -0
- data/set/right/last_edited.rb +7 -0
- data/set/right/linked_to_by.rb +8 -0
- data/set/right/links_to.rb +7 -1
- data/set/right/mates.rb +9 -1
- data/set/right/nested_by.rb +9 -1
- data/set/right/nests.rb +8 -0
- data/set/right/referred_to_by.rb +8 -0
- data/set/right/refers_to.rb +8 -0
- data/set/self/recent.rb +38 -4
- data/set/self/search/results_for_keyword.haml +5 -0
- data/set/self/search/search_box.haml +2 -0
- data/set/self/search.rb +88 -40
- data/set/type/cardtype.rb +11 -1
- metadata +62 -28
- data/lib/card/filter_query.rb +0 -78
- data/set/abstract/00_filter_helper.rb +0 -46
- data/set/abstract/03_filter/_filter_input.haml +0 -8
- data/set/abstract/03_filter/filter_form.haml +0 -56
- data/set/abstract/03_filter/filter_form.rb +0 -101
- data/set/abstract/03_filter/filtered_content.haml +0 -5
- data/set/abstract/03_filter/form_helper.rb +0 -105
- data/set/abstract/03_filter/query_construction.rb +0 -38
- data/set/abstract/03_filter/quick_filters.haml +0 -11
- data/set/abstract/03_filter/selectable_filtered_content.haml +0 -2
- data/set/abstract/03_filter.rb +0 -30
- data/set/abstract/05_search/checkbox_item.haml +0 -5
- data/set/abstract/05_search/select_item.haml +0 -15
- data/set/abstract/filter_list.rb +0 -11
- data/set/abstract/filterable.rb +0 -13
- data/set/abstract/filterable_bar.rb +0 -11
- data/set/right/follow.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65e8166a82d2feff946e6181a24c00da4cb6bf0d7ce8a16a11c2b7b22db118d3
|
4
|
+
data.tar.gz: bd16364e72bfad3e63a38b0682dc9d3de2c500453b612b14030f12b72117f045
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa9207b80f1c7027f273e95adfe53f81ff790584d86e1c062f4588e39f63e8039a425a1f1aea06b46af30a32062fd25bc5279cb0639f9fe2129b4f7917de114d
|
7
|
+
data.tar.gz: 2881e5b1bdcf6a85411e9dad390a06f61c03ffe110503daed66b98eaf9a9e67a50551471ce77c6214f74d0bddf0aa562221b09e7ebe5cf7ddb74e4eca8705404
|
data/README.md
ADDED
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
decko.slot.ready (slot) ->
|
2
|
+
slot.find('._autocomplete').each (_i) ->
|
3
|
+
decko.initAutoCardPlete($(this))
|
4
|
+
|
5
|
+
slot.find('._select2autocomplete').each (_i) ->
|
6
|
+
decko.select2Autocomplete.init $(this)
|
7
|
+
|
8
|
+
decko.initAutoCardPlete = (input) ->
|
9
|
+
optionsCard = input.data 'options-card'
|
10
|
+
return unless !!optionsCard
|
11
|
+
path = optionsCard + '.json?view=name_match'
|
12
|
+
input.autocomplete { source: decko.slot.path(path) }
|
13
|
+
|
14
|
+
decko.select2Autocomplete =
|
15
|
+
init: (el, options, ajaxOptions) ->
|
16
|
+
opts = $.extend {}, @_defaults(el), options
|
17
|
+
$.extend opts.ajax, ajaxOptions if ajaxOptions
|
18
|
+
el.select2 opts
|
19
|
+
|
20
|
+
_defaults: (el)->
|
21
|
+
multiple: false
|
22
|
+
width: "100%!important"
|
23
|
+
minimumInputLength: 0
|
24
|
+
maximumSelectionSize: 1
|
25
|
+
|
26
|
+
placeholder: el.attr("placeholder")
|
27
|
+
escapeMarkup: (markup) -> markup
|
28
|
+
|
29
|
+
ajax:
|
30
|
+
delay: 200
|
31
|
+
cache: true
|
32
|
+
url: decko.path ':search.json'
|
33
|
+
processResults: (data) -> results: data
|
34
|
+
data: (params) ->
|
35
|
+
query: { keyword: params.term }
|
36
|
+
view: "complete"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
$(window).ready ->
|
3
|
+
el = $('._search-box')
|
4
|
+
box = new decko.searchBox el
|
5
|
+
el.data "searchBox", box
|
6
|
+
box.init()
|
7
|
+
|
8
|
+
class decko.searchBox
|
9
|
+
constructor: (el) ->
|
10
|
+
@box = el
|
11
|
+
@sourcepath = @box.data "completepath"
|
12
|
+
@originalpath = @sourcepath
|
13
|
+
@config =
|
14
|
+
source: @sourcepath
|
15
|
+
select: @select
|
16
|
+
|
17
|
+
init: -> @box.autocomplete @config, html: true
|
18
|
+
|
19
|
+
select: (_event, ui) ->
|
20
|
+
url = ui.item.url
|
21
|
+
window.location = url if url
|
22
|
+
|
23
|
+
form: -> @box.closest "form"
|
24
|
+
keyword: -> @form().find("#query_keyword").val()
|
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
.d0-search-box {
|
3
|
+
width: 100%;
|
4
|
+
}
|
5
|
+
|
6
|
+
.search-keyword {
|
7
|
+
font-style: italic;
|
8
|
+
}
|
9
|
+
|
10
|
+
.search-count {
|
11
|
+
float: right;
|
12
|
+
color: $gray-600;
|
13
|
+
}
|
14
|
+
|
15
|
+
.closed-content .search-no-results:after {
|
16
|
+
content:'';
|
17
|
+
}
|
18
|
+
|
19
|
+
/* english content in css. ugh */
|
20
|
+
.search-no-results:after {
|
21
|
+
content:'0 results';
|
22
|
+
}
|
23
|
+
|
24
|
+
.search-box-nav {
|
25
|
+
flex: 1 0 50%;
|
26
|
+
.search-box-form {
|
27
|
+
width: 100%;
|
28
|
+
}
|
29
|
+
.select2-results > .select2-results__options {
|
30
|
+
max-height: none !important;
|
31
|
+
}
|
32
|
+
.select2-search__field {
|
33
|
+
width: 100% !important;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
.search-box-item-label {
|
38
|
+
float: left;
|
39
|
+
position: relative;
|
40
|
+
font-size: 10px;
|
41
|
+
width: 50px;
|
42
|
+
padding: 3px 0 3px 5px;
|
43
|
+
}
|
44
|
+
.search-box-item-value mark {
|
45
|
+
padding: 0.2em 0;
|
46
|
+
}
|
47
|
+
|
48
|
+
.ui-autocomplete {
|
49
|
+
z-index: 2000 !important; // to move it in front of modals (= 1050)
|
50
|
+
.ui-menu-item-wrapper {
|
51
|
+
display: block;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
.autocomplete-item {
|
56
|
+
display: flex;
|
57
|
+
margin: 0.4em 0;
|
58
|
+
.autocomplete-icon {
|
59
|
+
width: 30px;
|
60
|
+
margin-right: 1em;
|
61
|
+
text-align: center;
|
62
|
+
img, svg {
|
63
|
+
max-width: 100% !important;
|
64
|
+
max-height: 100% !important;
|
65
|
+
min-width: auto !important;
|
66
|
+
min-height: auto !important;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// autocomplete.js.coffee
|
2
|
+
(function(){decko.slot.ready(function(e){return e.find("._autocomplete").each(function(){return decko.initAutoCardPlete($(this))}),e.find("._select2autocomplete").each(function(){return decko.select2Autocomplete.init($(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
|
+
// search_box.js.coffee
|
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.config={source:this.box.data("completepath"),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.url},t.prototype.goto=function(){},t.prototype.search=function(){},t}()}).call(this);
|
data/data/real.yml
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
---
|
2
|
+
- :name: Search
|
3
|
+
:type: :cardtype
|
4
|
+
:codename: search_type
|
5
|
+
:fields:
|
6
|
+
:description: |-
|
7
|
+
<p>
|
8
|
+
Searches return a list of cards using
|
9
|
+
[[http://decko.org/CQL|CQL, the Card Query Language]].
|
10
|
+
See the [[http://decko.org/CQL_syntax|syntax documentation]].
|
11
|
+
</p>
|
12
|
+
|
13
|
+
- :name: "*search"
|
14
|
+
:type: :search_type
|
15
|
+
:codename: search
|
16
|
+
:content: '{"match":"$keyword", "sort":"relevance"}'
|
17
|
+
- :name: "*recent"
|
18
|
+
:type: :search_type
|
19
|
+
:codename: recent
|
20
|
+
:fields:
|
21
|
+
:self:
|
22
|
+
:fields:
|
23
|
+
:read: Anyone
|
24
|
+
- :name: "*count"
|
25
|
+
:codename: count
|
26
|
+
|
27
|
+
- :name: by name
|
28
|
+
:codename: by_name
|
29
|
+
- :name: by create
|
30
|
+
:codename: by_create
|
31
|
+
- :name: by update
|
32
|
+
:codename: by_update
|
33
|
+
|
34
|
+
- :name: "*last edited"
|
35
|
+
:codename: last_edited
|
36
|
+
- :name: "*creator"
|
37
|
+
:codename: creator
|
38
|
+
- :name: "*created"
|
39
|
+
:codename: created
|
40
|
+
:fields:
|
41
|
+
:right:
|
42
|
+
:fields:
|
43
|
+
:help: Cards created by <em>{{_left|name}}</em>.
|
44
|
+
- :name: "*edited"
|
45
|
+
:codename: edited
|
46
|
+
:fields:
|
47
|
+
:right:
|
48
|
+
:fields:
|
49
|
+
:help: Cards edited by <em>{{_left|name}}</em>.
|
50
|
+
- :name: "*editors"
|
51
|
+
:codename: editors
|
52
|
+
:fields:
|
53
|
+
:right:
|
54
|
+
:fields:
|
55
|
+
:help: Users who have edited <em>{{_left|name}}</em>.
|
56
|
+
|
57
|
+
- :name: "*children"
|
58
|
+
:codename: children
|
59
|
+
:fields:
|
60
|
+
:right:
|
61
|
+
:fields:
|
62
|
+
:help: |-
|
63
|
+
<p>
|
64
|
+
Cards formed by "mating" <em>{{_left|name}}</em> with another card.
|
65
|
+
eg\: "{{_left|name}}<strong>+</strong>mate".
|
66
|
+
</p>
|
67
|
+
- :name: "*mates"
|
68
|
+
:codename: mates
|
69
|
+
:fields:
|
70
|
+
:right:
|
71
|
+
:fields:
|
72
|
+
:help: |-
|
73
|
+
<p>
|
74
|
+
If there is a card named "X+<em>{{_left|name}}</em>",
|
75
|
+
then X is a mate of <em>{{_left|name}}</em>.
|
76
|
+
</p>
|
77
|
+
- :name: "*nested by"
|
78
|
+
:codename: nested_by
|
79
|
+
:fields:
|
80
|
+
:right:
|
81
|
+
:fields:
|
82
|
+
:help: "<p>Cards that refer to <em>{{_left|name}}</em>.</p>"
|
83
|
+
- :name: "*linked to by"
|
84
|
+
:codename: linked_to_by
|
85
|
+
:fields:
|
86
|
+
:right:
|
87
|
+
:fields:
|
88
|
+
:help: "<p>Cards that link to <em>{{_left|name}}</em>.</p>"
|
89
|
+
- :name: "*nests"
|
90
|
+
:codename: nests
|
91
|
+
:fields:
|
92
|
+
:right:
|
93
|
+
:fields:
|
94
|
+
:help: "<p>Cards nested within <em>{{_left|name}}</em></p>"
|
95
|
+
- :name: "*links to"
|
96
|
+
:codename: links_to
|
97
|
+
:fields:
|
98
|
+
:right:
|
99
|
+
:fields:
|
100
|
+
:help: "<p>Cards that <em>{{_left|name}}</em> links to.</p>"
|
101
|
+
- :name: "*referred to by"
|
102
|
+
:codename: referred_to_by
|
103
|
+
:fields:
|
104
|
+
:right:
|
105
|
+
:fields:
|
106
|
+
:help: "<p>Cards referred to by <em>{{_left|name}}</em>.</p>"
|
107
|
+
- :name: "*refers to"
|
108
|
+
:codename: refers_to
|
109
|
+
:fields:
|
110
|
+
:right:
|
111
|
+
:fields:
|
112
|
+
:help: "<p>Cards that <em>{{_left|name}}</em> refers to.</p>"
|
data/data/test.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
- :name: '42'
|
3
|
+
:content: |
|
4
|
+
Far out in the uncharted backwaters of the unfashionable end of
|
5
|
+
the western spiral arm of the Galaxy lies a small unregarded
|
6
|
+
yellow sun.
|
7
|
+
|
8
|
+
Orbiting this at a distance of roughly ninety-two million miles
|
9
|
+
is an utterly insignificant little blue green planet whose ape-
|
10
|
+
descended life forms are so amazingly primitive that they still
|
11
|
+
think digital watches are a pretty neat idea.
|
12
|
+
|
13
|
+
This planet has - or rather had - a problem, which was this: most
|
14
|
+
of the people living on it were unhappy for pretty much of the time.
|
15
|
+
Many solutions were suggested for this problem, but most of these
|
16
|
+
were largely concerned with the movements of small green pieces
|
17
|
+
of paper, which is odd because on the whole it wasn't the small
|
18
|
+
green pieces of paper that were unhappy.
|
data/locales/en.yml
ADDED
@@ -5,7 +5,7 @@ format do
|
|
5
5
|
|
6
6
|
# used for override
|
7
7
|
def default_search_params
|
8
|
-
if (qparams = query_params)
|
8
|
+
if (qparams = query_params)&.present?
|
9
9
|
paging_params.merge vars: qparams
|
10
10
|
else
|
11
11
|
paging_params
|
@@ -17,9 +17,7 @@ format do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def query_params
|
20
|
-
|
21
|
-
|
22
|
-
Env.hash vars
|
20
|
+
(vars = params[:query]) ? Env.hash(vars) : {}
|
23
21
|
end
|
24
22
|
|
25
23
|
def default_limit
|
@@ -4,8 +4,7 @@ format do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
view :search_error, cache: :never do
|
7
|
-
|
8
|
-
%(#{sr_class} :: #{search_with_params.message} :: #{card.content})
|
7
|
+
%(#{search_with_params.class} :: #{search_with_params.message} :: #{card.content})
|
9
8
|
end
|
10
9
|
|
11
10
|
view :card_list, cache: :never do
|
@@ -25,15 +24,19 @@ format do
|
|
25
24
|
def with_results
|
26
25
|
search_with_params.empty? ? render_no_search_results : yield
|
27
26
|
end
|
28
|
-
end
|
29
|
-
|
30
|
-
format :json do
|
31
|
-
AUTOCOMPLETE_LIMIT = 8 # number of name suggestions for autocomplete text fields
|
32
27
|
|
33
28
|
def item_cards
|
34
29
|
search_with_params
|
35
30
|
end
|
36
31
|
|
32
|
+
def term_param
|
33
|
+
params[:term]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
format :json do
|
38
|
+
AUTOCOMPLETE_LIMIT = 8 # number of name suggestions for autocomplete text fields
|
39
|
+
|
37
40
|
# NOCACHE because paging_urls is uncacheable hash and thus not safe to merge
|
38
41
|
view :molecule, cache: :never do
|
39
42
|
molecule.merge render_paging_urls
|
@@ -48,30 +51,32 @@ format :json do
|
|
48
51
|
complete_or_match_search limit: AUTOCOMPLETE_LIMIT
|
49
52
|
end
|
50
53
|
|
51
|
-
def complete_or_match_search limit: AUTOCOMPLETE_LIMIT, start_only: false
|
52
|
-
|
54
|
+
def complete_or_match_search limit: AUTOCOMPLETE_LIMIT, start_only: false,
|
55
|
+
additional_cql: {}
|
56
|
+
starts_with = complete_search limit: limit, additional_cql: additional_cql
|
53
57
|
return starts_with if start_only
|
54
58
|
|
55
59
|
remaining_slots = limit - starts_with.size
|
56
60
|
return starts_with if remaining_slots.zero?
|
57
61
|
|
58
|
-
starts_with + match_search(not_names: starts_with, limit: remaining_slots
|
62
|
+
starts_with + match_search(not_names: starts_with, limit: remaining_slots,
|
63
|
+
additional_cql: additional_cql)
|
59
64
|
end
|
60
65
|
|
61
|
-
def complete_search limit: AUTOCOMPLETE_LIMIT
|
62
|
-
card.search name_cql(limit).merge(complete_cql)
|
66
|
+
def complete_search limit: AUTOCOMPLETE_LIMIT, additional_cql: {}
|
67
|
+
card.search name_cql(limit).merge(complete_cql).merge(additional_cql)
|
63
68
|
end
|
64
69
|
|
65
|
-
def match_search limit: AUTOCOMPLETE_LIMIT, not_names: []
|
66
|
-
card.search name_cql(limit).merge(match_cql(not_names))
|
70
|
+
def match_search limit: AUTOCOMPLETE_LIMIT, not_names: [], additional_cql: {}
|
71
|
+
card.search name_cql(limit).merge(match_cql(not_names)).merge(additional_cql)
|
67
72
|
end
|
68
73
|
|
69
74
|
def name_cql limit
|
70
|
-
{ limit: limit,
|
75
|
+
{ limit: limit, sort_by: "name", return: "name" }
|
71
76
|
end
|
72
77
|
|
73
78
|
def complete_cql
|
74
|
-
{ complete: term_param }
|
79
|
+
term_param.present? ? { complete: term_param } : {}
|
75
80
|
end
|
76
81
|
|
77
82
|
def match_cql not_names
|
@@ -79,10 +84,6 @@ format :json do
|
|
79
84
|
cql[:name] = ["not in"] + not_names if not_names.any?
|
80
85
|
cql
|
81
86
|
end
|
82
|
-
|
83
|
-
def term_param
|
84
|
-
params[:term]
|
85
|
-
end
|
86
87
|
end
|
87
88
|
|
88
89
|
format :data do
|
@@ -95,39 +96,28 @@ end
|
|
95
96
|
|
96
97
|
format :csv do
|
97
98
|
view :core, :core, mod: All::Csv::CsvFormat
|
98
|
-
|
99
|
-
view :card_list do
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
99
|
+
#
|
100
|
+
# view :card_list do
|
101
|
+
# items = super()
|
102
|
+
# if depth.zero?
|
103
|
+
# title_row + items
|
104
|
+
# else
|
105
|
+
# items
|
106
|
+
# end
|
107
|
+
# end
|
107
108
|
end
|
108
109
|
|
109
110
|
format :html do
|
110
111
|
view :card_list, cache: :never do
|
111
112
|
with_results do
|
112
|
-
|
113
|
-
|
114
|
-
end
|
113
|
+
klasses = "card-list card-list-#{item_view_options[:view]} search-result-list"
|
114
|
+
search_result_list(klasses) { |item_card| card_list_item item_card }
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
view :select_item, cache: :never do
|
119
|
-
wrap do
|
120
|
-
haml :select_item
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
before :select_item do
|
125
|
-
class_up "card-slot", "_filter-result-slot"
|
126
|
-
end
|
127
|
-
|
128
118
|
view :checkbox_list, cache: :never do
|
129
119
|
with_results do
|
130
|
-
search_result_list "_search-checkbox-list
|
120
|
+
search_result_list "_search-checkbox-list pe-2" do |item_card|
|
131
121
|
checkbox_item item_card
|
132
122
|
end
|
133
123
|
end
|
@@ -158,8 +148,4 @@ format :html do
|
|
158
148
|
haml :checkbox_item, unique_id: unique_id, item_card: item_card
|
159
149
|
end
|
160
150
|
end
|
161
|
-
|
162
|
-
def closed_limit
|
163
|
-
[search_params[:limit].to_i, Card.config.closed_search_limit].min
|
164
|
-
end
|
165
151
|
end
|
@@ -1,6 +1,4 @@
|
|
1
1
|
include_set Abstract::Paging
|
2
|
-
include_set Abstract::SearchParams
|
3
|
-
include_set Abstract::Filter
|
4
2
|
|
5
3
|
def search _args={}
|
6
4
|
raise Error, "search not overridden"
|
@@ -38,9 +36,9 @@ def count args={}
|
|
38
36
|
end
|
39
37
|
|
40
38
|
# for override
|
41
|
-
def
|
42
|
-
|
43
|
-
end
|
39
|
+
# def item_type_id
|
40
|
+
# nil
|
41
|
+
# end
|
44
42
|
|
45
43
|
def each_item_name_with_options _content=nil
|
46
44
|
options = {}
|
@@ -60,10 +58,6 @@ format do
|
|
60
58
|
@count_with_params ||= search_with_rescue search_params.merge(return: :count)
|
61
59
|
end
|
62
60
|
|
63
|
-
view :filtered_count, cache: :never do
|
64
|
-
count_with_params
|
65
|
-
end
|
66
|
-
|
67
61
|
def search_with_rescue query_args
|
68
62
|
rescuing_bad_query query_args do
|
69
63
|
card.cached_search query_args
|
@@ -11,9 +11,10 @@ def cql_content
|
|
11
11
|
query.symbolize_keys
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def item_type_id
|
15
15
|
type = cql_hash[:type]
|
16
|
-
type
|
16
|
+
type = type&.card_id unless type.is_a? Hash
|
17
|
+
type if type.is_a? Integer
|
17
18
|
end
|
18
19
|
|
19
20
|
# for override, eg when required subqueries are known to be missing
|
@@ -71,10 +72,6 @@ def standardized_query_args args
|
|
71
72
|
end
|
72
73
|
|
73
74
|
format do
|
74
|
-
def search_params
|
75
|
-
super.merge filter_and_sort_cql
|
76
|
-
end
|
77
|
-
|
78
75
|
def default_limit
|
79
76
|
card_content_limit || super
|
80
77
|
end
|
@@ -41,8 +41,7 @@ format :html do
|
|
41
41
|
if depth > max_depth
|
42
42
|
"..."
|
43
43
|
else
|
44
|
-
|
45
|
-
_render_core hide: "paging", items: { view: :link }
|
44
|
+
render_core hide: "paging", items: { view: :link }
|
46
45
|
# TODO: if item is queryified to be "name", then that should work.
|
47
46
|
# otherwise use link
|
48
47
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
def add_autocomplete_ok?
|
2
|
+
new_card? && name.valid? && !virtual? && ok?(:create)
|
3
|
+
end
|
4
|
+
|
5
|
+
format :html do
|
6
|
+
view :goto_autocomplete_item do
|
7
|
+
autocomplete_item :goto, goto_autocomplete_icon, autocomplete_label
|
8
|
+
end
|
9
|
+
|
10
|
+
view :add_autocomplete_item, unknown: true do
|
11
|
+
autocomplete_item :add, icon_tag(:add), autocomplete_label
|
12
|
+
end
|
13
|
+
|
14
|
+
def autocomplete_field item, options_card_name, extra_classes=""
|
15
|
+
haml :autocomplete_input,
|
16
|
+
item: item, options_card: options_card_name,
|
17
|
+
extra_classes: extra_classes
|
18
|
+
end
|
19
|
+
|
20
|
+
def name_autocomplete_field item, extra_classes=""
|
21
|
+
# select_tag "autocomplete_#{card.key}", "", class: "_select2autocomplete"
|
22
|
+
text_field_tag "pointer_item", item,
|
23
|
+
class: "pointer-item-text form-control _autocomplete #{extra_classes}",
|
24
|
+
"data-options-card": %i[all by_name].to_name
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_autocomplete_item_path
|
28
|
+
path
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def autocomplete_item type, icon, label
|
34
|
+
haml :autocomplete_item, type: type, icon: icon, label: label
|
35
|
+
end
|
36
|
+
|
37
|
+
def goto_autocomplete_icon
|
38
|
+
if card.fetch :image
|
39
|
+
field_nest :image, view: :core, size: :small
|
40
|
+
else
|
41
|
+
icon_tag :arrow_forward
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def autocomplete_label
|
46
|
+
card.name
|
47
|
+
end
|
48
|
+
end
|
data/set/right/children.rb
CHANGED
data/set/right/count.rb
ADDED
data/set/right/created.rb
CHANGED