diff options
Diffstat (limited to 'client/components/lists/body.js')
-rw-r--r-- | client/components/lists/body.js | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/client/components/lists/body.js b/client/components/lists/body.js index f2d780af..a91f0ca9 100644 --- a/client/components/lists/body.js +++ b/client/components/lists/body.js @@ -61,10 +61,39 @@ BlazeComponent.extendComponent({ }); }, + clickOnMiniCard: function(evt) { + if (MultiSelection.isActive() || evt.shiftKey) { + evt.stopImmediatePropagation(); + evt.preventDefault(); + var methodName = evt.shiftKey ? 'toogleRange' : 'toogle'; + MultiSelection[methodName](this.currentData()._id); + + // If the card is already selected, we want to de-select it. + // XXX We should probably modify the minicard href attribute instead of + // overwriting the event in case the card is already selected. + } else if (Session.equals('currentCard', this.currentData()._id)) { + evt.stopImmediatePropagation(); + evt.preventDefault(); + Utils.goBoardId(Session.get('currentBoard')); + } + }, + + cardIsSelected: function() { + return Session.equals('currentCard', this.currentData()._id); + }, + + toggleMultiSelection: function(evt) { + evt.stopPropagation(); + evt.preventDefault(); + MultiSelection.toogle(this.currentData()._id); + }, + events: function() { return [{ - submit: this.addCard, - 'click .open-minicard-composer': this.scrollToBottom + 'click .js-minicard': this.clickOnMiniCard, + 'click .js-toggle-multi-selection': this.toggleMultiSelection, + 'click .open-minicard-composer': this.scrollToBottom, + submit: this.addCard }]; } }).register('listBody'); |