Make tag completions be all searchable tags, not just formal tags
This commit is contained in:
parent
e4398eef54
commit
17886b24d1
|
@ -108,7 +108,9 @@
|
||||||
[all-tags
|
[all-tags
|
||||||
(for/fold ((ts (set)))
|
(for/fold ((ts (set)))
|
||||||
((pkg (in-hash-values (package-manager-state-local-packages state))))
|
((pkg (in-hash-values (package-manager-state-local-packages state))))
|
||||||
(set-union ts (list->set (or (@ pkg tags) '()))))]))
|
(set-union ts (list->set
|
||||||
|
(map symbol->string
|
||||||
|
(hash-keys (or (@ pkg search-terms) (hash)))))))]))
|
||||||
|
|
||||||
(define (replace-package old-pkg new-pkg state)
|
(define (replace-package old-pkg new-pkg state)
|
||||||
(define local-packages (package-manager-state-local-packages state))
|
(define local-packages (package-manager-state-local-packages state))
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
[("create") edit-package-page]
|
[("create") edit-package-page]
|
||||||
[("logout") logout-page]
|
[("logout") logout-page]
|
||||||
[("json" "search-completions") json-search-completions]
|
[("json" "search-completions") json-search-completions]
|
||||||
[("json" "all-tags") json-all-tags]
|
[("json" "tag-completions") json-tag-completions]
|
||||||
))
|
))
|
||||||
|
|
||||||
(define (on-continuation-expiry request)
|
(define (on-continuation-expiry request)
|
||||||
|
@ -1098,7 +1098,7 @@
|
||||||
(lambda (response-port)
|
(lambda (response-port)
|
||||||
(write-json (set->list completions) response-port))))
|
(write-json (set->list completions) response-port))))
|
||||||
|
|
||||||
(define (json-all-tags request)
|
(define (json-tag-completions request)
|
||||||
(response/output #:mime-type #"application/json"
|
(response/output #:mime-type #"application/json"
|
||||||
(lambda (response-port)
|
(lambda (response-port)
|
||||||
(write-json (set->list (all-tags)) response-port))))
|
(write-json (set->list (all-tags)) response-port))))
|
||||||
|
|
|
@ -35,9 +35,10 @@ $(document).ready(function () {
|
||||||
$("table.sortable").tablesorter();
|
$("table.sortable").tablesorter();
|
||||||
|
|
||||||
if ($("#tags").length) {
|
if ($("#tags").length) {
|
||||||
$.getJSON("/json/all-tags", function (allTags) {
|
$.getJSON("/json/tag-completions", function (tagCompletions) {
|
||||||
allTags.sort();
|
tagCompletions.sort();
|
||||||
PkgSite.multiTermComplete(PkgSite.preventTabMovingDuringSelection($("#tags")), allTags);
|
PkgSite.multiTermComplete(PkgSite.preventTabMovingDuringSelection($("#tags")),
|
||||||
|
tagCompletions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user