summaryrefslogtreecommitdiffstats
path: root/client/lib/filter.js
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-05-26 20:30:01 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-05-26 20:34:56 +0200
commit40c2411f2a1ce0bbd177f377828f9d6700112b06 (patch)
treebf1f7ab8d94fe3e0edfcde817961d6954c11af4d /client/lib/filter.js
parent1b4fcc67f4ec94ed53a2f86ad6889e551f00815e (diff)
downloadwekan-40c2411f2a1ce0bbd177f377828f9d6700112b06.tar.gz
wekan-40c2411f2a1ce0bbd177f377828f9d6700112b06.tar.bz2
wekan-40c2411f2a1ce0bbd177f377828f9d6700112b06.zip
Implement a new system to handle "escape actions"
The new EscapeActions object decide what to do when the user press the Escape key (such as closing a opened popup or inlined form). This commit also re-introduced the sidebar current view as a sidebar component local state.
Diffstat (limited to 'client/lib/filter.js')
-rw-r--r--client/lib/filter.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/client/lib/filter.js b/client/lib/filter.js
index 507a2bb7..d96fa89c 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -4,6 +4,10 @@
// goal is to filter complete documents by using the local filters for each
// fields.
+var showFilterSidebar = function() {
+ Sidebar.setView('filter');
+};
+
// Use a "set" filter for a field that is a set of documents uniquely
// identified. For instance `{ labels: ['labelA', 'labelC', 'labelD'] }`.
var SetFilter = function() {
@@ -18,29 +22,27 @@ _.extend(SetFilter.prototype, {
},
add: function(val) {
- if (this.indexOfVal(val) === -1) {
+ if (this._indexOfVal(val) === -1) {
this._selectedElements.push(val);
this._dep.changed();
+ showFilterSidebar();
}
},
remove: function(val) {
var indexOfVal = this._indexOfVal(val);
- if (this.indexOfVal(val) !== -1) {
+ if (this._indexOfVal(val) !== -1) {
this._selectedElements.splice(indexOfVal, 1);
this._dep.changed();
}
},
toogle: function(val) {
- var indexOfVal = this._indexOfVal(val);
- if (indexOfVal === -1) {
- this._selectedElements.push(val);
+ if (this._indexOfVal(val) === -1) {
+ this.add(val);
} else {
- this._selectedElements.splice(indexOfVal, 1);
+ this.remove(val);
}
-
- this._dep.changed();
},
reset: function() {