summaryrefslogtreecommitdiffstats
path: root/client/components/sidebar/sidebarFilters.js
diff options
context:
space:
mode:
authorJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:52:09 -0500
committerJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:56:51 -0500
commit3eb4d2c341b712268bd321173909e0a7b19a88c9 (patch)
tree25a8fcb088f3984e72a5bd3ded9e6a45376e0693 /client/components/sidebar/sidebarFilters.js
parenta0a482aa8efb3255a523de4524c8e09453d5571f (diff)
downloadwekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.gz
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.bz2
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.zip
Prettier & eslint project style update
Diffstat (limited to 'client/components/sidebar/sidebarFilters.js')
-rw-r--r--client/components/sidebar/sidebarFilters.js154
1 files changed, 78 insertions, 76 deletions
diff --git a/client/components/sidebar/sidebarFilters.js b/client/components/sidebar/sidebarFilters.js
index fd8229e4..88438a7a 100644
--- a/client/components/sidebar/sidebarFilters.js
+++ b/client/components/sidebar/sidebarFilters.js
@@ -1,106 +1,108 @@
BlazeComponent.extendComponent({
events() {
- return [{
- 'click .js-toggle-label-filter'(evt) {
- evt.preventDefault();
- Filter.labelIds.toggle(this.currentData()._id);
- Filter.resetExceptions();
+ return [
+ {
+ 'click .js-toggle-label-filter'(evt) {
+ evt.preventDefault();
+ Filter.labelIds.toggle(this.currentData()._id);
+ Filter.resetExceptions();
+ },
+ 'click .js-toggle-member-filter'(evt) {
+ evt.preventDefault();
+ Filter.members.toggle(this.currentData()._id);
+ Filter.resetExceptions();
+ },
+ 'click .js-toggle-custom-fields-filter'(evt) {
+ evt.preventDefault();
+ Filter.customFields.toggle(this.currentData()._id);
+ Filter.resetExceptions();
+ },
+ 'change .js-field-advanced-filter'(evt) {
+ evt.preventDefault();
+ Filter.advanced.set(
+ this.find('.js-field-advanced-filter').value.trim(),
+ );
+ Filter.resetExceptions();
+ },
+ 'click .js-clear-all'(evt) {
+ evt.preventDefault();
+ Filter.reset();
+ },
+ 'click .js-filter-to-selection'(evt) {
+ evt.preventDefault();
+ const selectedCards = Cards.find(Filter.mongoSelector()).map(c => {
+ return c._id;
+ });
+ MultiSelection.add(selectedCards);
+ },
},
- 'click .js-toggle-member-filter'(evt) {
- evt.preventDefault();
- Filter.members.toggle(this.currentData()._id);
- Filter.resetExceptions();
- },
- 'click .js-toggle-custom-fields-filter'(evt) {
- evt.preventDefault();
- Filter.customFields.toggle(this.currentData()._id);
- Filter.resetExceptions();
- },
- 'change .js-field-advanced-filter'(evt) {
- evt.preventDefault();
- Filter.advanced.set(this.find('.js-field-advanced-filter').value.trim());
- Filter.resetExceptions();
- },
- 'click .js-clear-all'(evt) {
- evt.preventDefault();
- Filter.reset();
- },
- 'click .js-filter-to-selection'(evt) {
- evt.preventDefault();
- const selectedCards = Cards.find(Filter.mongoSelector()).map((c) => {
- return c._id;
- });
- MultiSelection.add(selectedCards);
- },
- }];
+ ];
},
}).register('filterSidebar');
function mutateSelectedCards(mutationName, ...args) {
- Cards.find(MultiSelection.getMongoSelector()).forEach((card) => {
+ Cards.find(MultiSelection.getMongoSelector()).forEach(card => {
card[mutationName](...args);
});
}
BlazeComponent.extendComponent({
mapSelection(kind, _id) {
- return Cards.find(MultiSelection.getMongoSelector()).map((card) => {
+ return Cards.find(MultiSelection.getMongoSelector()).map(card => {
const methodName = kind === 'label' ? 'hasLabel' : 'isAssigned';
return card[methodName](_id);
});
},
allSelectedElementHave(kind, _id) {
- if (MultiSelection.isEmpty())
- return false;
- else
- return _.every(this.mapSelection(kind, _id));
+ if (MultiSelection.isEmpty()) return false;
+ else return _.every(this.mapSelection(kind, _id));
},
someSelectedElementHave(kind, _id) {
- if (MultiSelection.isEmpty())
- return false;
- else
- return _.some(this.mapSelection(kind, _id));
+ if (MultiSelection.isEmpty()) return false;
+ else return _.some(this.mapSelection(kind, _id));
},
events() {
- return [{
- 'click .js-toggle-label-multiselection'(evt) {
- const labelId = this.currentData()._id;
- const mappedSelection = this.mapSelection('label', labelId);
+ return [
+ {
+ 'click .js-toggle-label-multiselection'(evt) {
+ const labelId = this.currentData()._id;
+ const mappedSelection = this.mapSelection('label', labelId);
- if (_.every(mappedSelection)) {
- mutateSelectedCards('removeLabel', labelId);
- } else if (_.every(mappedSelection, (bool) => !bool)) {
- mutateSelectedCards('addLabel', labelId);
- } else {
- const popup = Popup.open('disambiguateMultiLabel');
- // XXX We need to have a better integration between the popup and the
- // UI components systems.
- popup.call(this.currentData(), evt);
- }
- },
- 'click .js-toggle-member-multiselection'(evt) {
- const memberId = this.currentData()._id;
- const mappedSelection = this.mapSelection('member', memberId);
- if (_.every(mappedSelection)) {
- mutateSelectedCards('unassignMember', memberId);
- } else if (_.every(mappedSelection, (bool) => !bool)) {
- mutateSelectedCards('assignMember', memberId);
- } else {
- const popup = Popup.open('disambiguateMultiMember');
- // XXX We need to have a better integration between the popup and the
- // UI components systems.
- popup.call(this.currentData(), evt);
- }
- },
- 'click .js-move-selection': Popup.open('moveSelection'),
- 'click .js-archive-selection'() {
- mutateSelectedCards('archive');
- EscapeActions.executeUpTo('multiselection');
+ if (_.every(mappedSelection)) {
+ mutateSelectedCards('removeLabel', labelId);
+ } else if (_.every(mappedSelection, bool => !bool)) {
+ mutateSelectedCards('addLabel', labelId);
+ } else {
+ const popup = Popup.open('disambiguateMultiLabel');
+ // XXX We need to have a better integration between the popup and the
+ // UI components systems.
+ popup.call(this.currentData(), evt);
+ }
+ },
+ 'click .js-toggle-member-multiselection'(evt) {
+ const memberId = this.currentData()._id;
+ const mappedSelection = this.mapSelection('member', memberId);
+ if (_.every(mappedSelection)) {
+ mutateSelectedCards('unassignMember', memberId);
+ } else if (_.every(mappedSelection, bool => !bool)) {
+ mutateSelectedCards('assignMember', memberId);
+ } else {
+ const popup = Popup.open('disambiguateMultiMember');
+ // XXX We need to have a better integration between the popup and the
+ // UI components systems.
+ popup.call(this.currentData(), evt);
+ }
+ },
+ 'click .js-move-selection': Popup.open('moveSelection'),
+ 'click .js-archive-selection'() {
+ mutateSelectedCards('archive');
+ EscapeActions.executeUpTo('multiselection');
+ },
},
- }];
+ ];
},
}).register('multiselectionSidebar');