mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Global search display total hits
* modify User model to store some session data for searches * Display total hits in search results
This commit is contained in:
parent
c11c3f9a88
commit
3214800741
5 changed files with 49 additions and 7 deletions
|
|
@ -21,8 +21,10 @@ template(name="globalSearch")
|
|||
| {{_ 'no-results' }}
|
||||
else if $eq resultsCount.get 1
|
||||
| {{_ 'one-result' }}
|
||||
else
|
||||
else if $eq resultsCount.get totalHits.get
|
||||
| {{_ 'n-results' resultsCount.get }}
|
||||
else
|
||||
| {{_ 'n-of-n-results' resultsCount.get totalHits.get }}
|
||||
if queryErrors.get
|
||||
div
|
||||
each msg in errorMessages
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ BlazeComponent.extendComponent({
|
|||
this.query = new ReactiveVar('');
|
||||
this.queryParams = null;
|
||||
this.resultsCount = new ReactiveVar(0);
|
||||
this.totalHits = new ReactiveVar(0);
|
||||
this.queryErrors = new ReactiveVar(null);
|
||||
Meteor.subscribe('setting');
|
||||
},
|
||||
|
|
@ -50,7 +51,9 @@ BlazeComponent.extendComponent({
|
|||
if (this.queryParams) {
|
||||
const results = Cards.globalSearch(this.queryParams);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('count:', results.count);
|
||||
// console.log('errors:', results.errors);
|
||||
this.totalHits.set(Meteor.user().sessionData.totalHits);
|
||||
this.resultsCount.set(results.cards.count());
|
||||
this.queryErrors.set(results.errors);
|
||||
return results.cards;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue