diff options
author | IgnatzHome <ignatz@maschath.de> | 2018-05-20 14:53:00 +0200 |
---|---|---|
committer | IgnatzHome <ignatz@maschath.de> | 2018-05-20 14:53:00 +0200 |
commit | dd7c9997a937fde0c598188884db6690e77bfb11 (patch) | |
tree | b5c74ac10dabe4eaf5544b7f2a8a4a6440615fa9 /client | |
parent | 256ca129f0301765ce1b2522c9e4aef68eda9e8c (diff) | |
download | wekan-dd7c9997a937fde0c598188884db6690e77bfb11.tar.gz wekan-dd7c9997a937fde0c598188884db6690e77bfb11.tar.bz2 wekan-dd7c9997a937fde0c598188884db6690e77bfb11.zip |
Removing Debug Lines, correcting behavior, caching las valide filter, and adding description
Diffstat (limited to 'client')
-rw-r--r-- | client/components/sidebar/sidebarFilters.jade | 2 | ||||
-rw-r--r-- | client/components/sidebar/sidebarFilters.js | 2 | ||||
-rw-r--r-- | client/lib/filter.js | 13 |
3 files changed, 8 insertions, 9 deletions
diff --git a/client/components/sidebar/sidebarFilters.jade b/client/components/sidebar/sidebarFilters.jade index 00d8c87b..c0696391 100644 --- a/client/components/sidebar/sidebarFilters.jade +++ b/client/components/sidebar/sidebarFilters.jade @@ -56,7 +56,9 @@ template(name="filterSidebar") if Filter.customFields.isSelected _id i.fa.fa-check hr + span {{_ 'advanced-filter-label}} input.js-field-advanced-filter(type="text") + span {{_ 'advanced-filter-description'}} if Filter.isActive hr a.sidebar-btn.js-clear-all diff --git a/client/components/sidebar/sidebarFilters.js b/client/components/sidebar/sidebarFilters.js index 6fb3f500..fd8229e4 100644 --- a/client/components/sidebar/sidebarFilters.js +++ b/client/components/sidebar/sidebarFilters.js @@ -16,7 +16,7 @@ BlazeComponent.extendComponent({ Filter.customFields.toggle(this.currentData()._id); Filter.resetExceptions(); }, - 'input .js-field-advanced-filter'(evt) { + 'change .js-field-advanced-filter'(evt) { evt.preventDefault(); Filter.advanced.set(this.find('.js-field-advanced-filter').value.trim()); Filter.resetExceptions(); diff --git a/client/lib/filter.js b/client/lib/filter.js index 18d95ebd..c5f8fe7e 100644 --- a/client/lib/filter.js +++ b/client/lib/filter.js @@ -86,6 +86,7 @@ class AdvancedFilter { constructor() { this._dep = new Tracker.Dependency(); this._filter = ''; + this._lastValide={}; } set(str) @@ -96,6 +97,7 @@ class AdvancedFilter { reset() { this._filter = ''; + this._lastValide={}; this._dep.changed(); } @@ -147,26 +149,23 @@ class AdvancedFilter { _fieldNameToId(field) { - console.log(`searching: ${field}`); const found = CustomFields.findOne({'name':field}); - console.log(found); return found._id; } _arrayToSelector(commands) { - console.log('Parts: ', JSON.stringify(commands)); try { //let changed = false; this._processSubCommands(commands); } - catch (e){return { $in: [] };} + catch (e){return this._lastValide;} + this._lastValide = {$or: commands}; return {$or: commands}; } _processSubCommands(commands) { - console.log('SubCommands: ', JSON.stringify(commands)); const subcommands = []; let level = 0; let start = -1; @@ -205,16 +204,13 @@ class AdvancedFilter { if (start !== -1) { this._processSubCommands(subcommands); - console.log ('subcommands: ', subcommands.length); if (subcommands.length === 1) commands.splice(start, 0, subcommands[0]); else commands.splice(start, 0, subcommands); } this._processConditions(commands); - console.log('Conditions: ', JSON.stringify(commands)); this._processLogicalOperators(commands); - console.log('Operator: ', JSON.stringify(commands)); } _processConditions(commands) @@ -458,6 +454,7 @@ Filter = { const filter = this[fieldName]; filter.reset(); }); + this.advanced.reset(); this.resetExceptions(); }, |