Add link to search header for storing search

This commit is contained in:
John R. Supplee 2021-01-17 21:04:05 +02:00
parent 409b8559d7
commit 7e8475e64d
4 changed files with 13 additions and 4 deletions

View file

@ -27,6 +27,7 @@ template(name="globalSearch")
else
h1
= resultsHeading.get
a.fa.fa-link(title="{{_ 'link-to-search' }}" href="{{ getSearchHref }}")
each card in results
+resultCard(card)
else

View file

@ -41,6 +41,7 @@ BlazeComponent.extendComponent({
this.hasQueryErrors = new ReactiveVar(false);
this.query = new ReactiveVar('');
this.resultsHeading = new ReactiveVar('');
this.searchLink = new ReactiveVar(null);
this.queryParams = null;
this.parsingErrors = [];
this.resultsCount = 0;
@ -258,6 +259,11 @@ BlazeComponent.extendComponent({
});
},
getSearchHref() {
const baseUrl = window.location.href.replace(/([?#].*$|\s*$)/, '');
return `${baseUrl}?q=${encodeURIComponent(this.query.get())}`;
},
searchInstructions() {
tags = {
operator_board: TAPi18n.__('operator-board'),

View file

@ -160,9 +160,10 @@ FlowRouter.route('/global-search', {
Utils.manageMatomo();
DocHead.setTitle(TAPi18n.__('globalSearch-title'));
// eslint-disable-next-line no-console
console.log('URL Params:', FlowRouter.getQueryParam('q'));
Session.set('globalQuery', decodeURI(FlowRouter.getQueryParam('q')));
Session.set(
'globalQuery',
decodeURIComponent(FlowRouter.getQueryParam('q')),
);
BlazeLayout.render('defaultLayout', {
headerBar: 'globalSearchHeaderBar',
content: 'globalSearch',

View file

@ -908,5 +908,6 @@
"globalSearch-instructions-notes-2": "Similar operators are *OR*ed together. Cards that match any of the conditions will be returned.\n`__operator_list__:Available __operator_list__:Blocked` would return cards contained in any list named *Blocked* or *Available*.",
"globalSearch-instructions-notes-3": "Differing operators are *AND*ed together. Only cards that match all of the differing operators are returned.\n`__operator_list__:Available __operator_label__:red` returns only cards in the list *Available* with a *red* label.",
"globalSearch-instructions-notes-4": "Text searches are case insensitive.",
"globalSearch-instructions-notes-5": "Currently archived cards are not searched."
"globalSearch-instructions-notes-5": "Currently archived cards are not searched.",
"link-to-search": "Link to this search"
}