diff --git a/client/components/main/globalSearch.jade b/client/components/main/globalSearch.jade index ec9eb2ff9..ba4ecc892 100644 --- a/client/components/main/globalSearch.jade +++ b/client/components/main/globalSearch.jade @@ -9,25 +9,49 @@ template(name="globalSearchModalTitle") | {{_ 'globalSearch-title'}} template(name="globalSearch") - if isPageReady.get - .wrapper - form.js-search-query-form - input(type="text" name="searchQuery" placeholder="{{_ 'search-example'}}" autofocus dir="auto") - else + .wrapper + form.js-search-query-form + input(type="text" name="searchQuery" placeholder="{{_ 'search-example'}}" autofocus dir="auto") + if searching.get +spinner + else if hasResults.get + .global-search-dueat-list-wrapper + h1 Results + each card in results + .global-search-card-wrapper + a.minicard-wrapper.card-title(href=card.absoluteUrl) + +minicard(card) + ul.global-search-context-list + li.global-search-context(title="{{_ 'board'}}") + +viewer + = card.getBoard.title + li.global-search-context.global-search-context-separator + = ' ' + | {{_ 'context-separator'}} + = ' ' + li.global-search-context(title="{{_ 'swimlane'}}") + +viewer + = card.getSwimlane.title + li.global-search-context + = ' ' + | {{_ 'context-separator'}} + = ' ' + li.global-search-context(title="{{_ 'list'}}") + +viewer + = card.getList.title template(name="globalSearchViewChangePopup") ul.pop-over-list li with "globalSearchViewChange-choice-me" - a.js-due-cards-view-me + a.js-global-search-view-me i.fa.fa-user.colorful | {{_ 'globalSearchViewChange-choice-me'}} if $eq Utils.globalSearchView "me" i.fa.fa-check li with "globalSearchViewChange-choice-all" - a.js-due-cards-view-all + a.js-global-search-view-all i.fa.fa-users.colorful | {{_ 'globalSearchViewChange-choice-all'}} span.sub-name diff --git a/client/components/main/globalSearch.js b/client/components/main/globalSearch.js index a7d755f74..b8ac5fdd0 100644 --- a/client/components/main/globalSearch.js +++ b/client/components/main/globalSearch.js @@ -37,6 +37,8 @@ BlazeComponent.extendComponent({ BlazeComponent.extendComponent({ onCreated() { this.isPageReady = new ReactiveVar(true); + this.searching = new ReactiveVar(false); + this.hasResults = new ReactiveVar(false); this.query = new ReactiveVar(''); // this.autorun(() => { @@ -50,16 +52,24 @@ BlazeComponent.extendComponent({ Meteor.subscribe('setting'); }, + results() { + return Cards.find(); + }, + events() { return [ { 'submit .js-search-query-form'(evt) { evt.preventDefault(); this.query.set(evt.target.searchQuery.value); - // eslint-disable-next-line no-console - console.log('query:', this.query.get()); + + this.searching.set(true); + this.hasResults.set(false); let query = this.query.get(); + // eslint-disable-next-line no-console + console.log('query:', query); + const reUser = /^@(?\w+)(\s+|$)/; const reLabel = /^#(?