mirror of
https://github.com/wekan/wekan.git
synced 2025-12-21 09:50:13 +01:00
Fix : Filter List by Card Title #3594
This commit is contained in:
parent
31af30175b
commit
5b5b8fe427
2 changed files with 38 additions and 6 deletions
|
|
@ -6,7 +6,7 @@ BlazeComponent.extendComponent({
|
||||||
{
|
{
|
||||||
'submit .js-list-filter'(evt) {
|
'submit .js-list-filter'(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
Filter.lists.set(this.find('.js-list-filter input').value.trim());
|
Filter.title.set(this.find('.js-list-filter input').value.trim());
|
||||||
},
|
},
|
||||||
'click .js-toggle-label-filter'(evt) {
|
'click .js-toggle-label-filter'(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,39 @@ class DateFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class StringFilter {
|
||||||
|
constructor() {
|
||||||
|
this._dep = new Tracker.Dependency();
|
||||||
|
this.subField = ''; // Prevent name mangling in Filter
|
||||||
|
this._filter = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
set(str) {
|
||||||
|
this._filter = str;
|
||||||
|
this._dep.changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
this._filter = '';
|
||||||
|
this._dep.changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
_isActive() {
|
||||||
|
this._dep.depend();
|
||||||
|
return this._filter !== '';
|
||||||
|
}
|
||||||
|
|
||||||
|
_getMongoSelector() {
|
||||||
|
this._dep.depend();
|
||||||
|
return {$regex : this._filter, $options: 'i'};
|
||||||
|
}
|
||||||
|
|
||||||
|
_getEmptySelector() {
|
||||||
|
this._dep.depend();
|
||||||
|
return {$regex : this._filter, $options: 'i'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Use a "set" filter for a field that is a set of documents uniquely
|
// Use a "set" filter for a field that is a set of documents uniquely
|
||||||
// identified. For instance `{ labels: ['labelA', 'labelC', 'labelD'] }`.
|
// identified. For instance `{ labels: ['labelA', 'labelC', 'labelD'] }`.
|
||||||
// use "subField" for searching inside object Fields.
|
// use "subField" for searching inside object Fields.
|
||||||
|
|
@ -611,9 +644,9 @@ Filter = {
|
||||||
archive: new SetFilter(),
|
archive: new SetFilter(),
|
||||||
hideEmpty: new SetFilter(),
|
hideEmpty: new SetFilter(),
|
||||||
dueAt: new DateFilter(),
|
dueAt: new DateFilter(),
|
||||||
|
title: new StringFilter(),
|
||||||
customFields: new SetFilter('_id'),
|
customFields: new SetFilter('_id'),
|
||||||
advanced: new AdvancedFilter(),
|
advanced: new AdvancedFilter(),
|
||||||
lists: new AdvancedFilter(), // we need the ability to filter list by name as well
|
|
||||||
|
|
||||||
_fields: [
|
_fields: [
|
||||||
'labelIds',
|
'labelIds',
|
||||||
|
|
@ -622,6 +655,7 @@ Filter = {
|
||||||
'archive',
|
'archive',
|
||||||
'hideEmpty',
|
'hideEmpty',
|
||||||
'dueAt',
|
'dueAt',
|
||||||
|
'title',
|
||||||
'customFields',
|
'customFields',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -636,8 +670,7 @@ Filter = {
|
||||||
_.any(this._fields, fieldName => {
|
_.any(this._fields, fieldName => {
|
||||||
return this[fieldName]._isActive();
|
return this[fieldName]._isActive();
|
||||||
}) ||
|
}) ||
|
||||||
this.advanced._isActive() ||
|
this.advanced._isActive()
|
||||||
this.lists._isActive()
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -702,7 +735,6 @@ Filter = {
|
||||||
const filter = this[fieldName];
|
const filter = this[fieldName];
|
||||||
filter.reset();
|
filter.reset();
|
||||||
});
|
});
|
||||||
this.lists.reset();
|
|
||||||
this.advanced.reset();
|
this.advanced.reset();
|
||||||
this.resetExceptions();
|
this.resetExceptions();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue