summaryrefslogtreecommitdiffstats
path: root/client/components/cards/minicard.js
blob: 81d8c0d414f5eeda54817187a1e51ed0579442e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Template.cards.events({
//   'click .member': Popup.open('cardMember')
// });

BlazeComponent.extendComponent({
  template: function() {
    return 'minicard';
  },

  isSelected: function() {
    return Session.equals('currentCard', this.currentData()._id);
  },

  toggleMultiSelection: function(evt) {
    evt.stopPropagation();
    evt.preventDefault();
    MultiSelection.toogle(this.currentData()._id);
  },

  clickOnMiniCard: function(evt) {
    if (MultiSelection.isActive() || evt.shiftKey) {
      evt.stopImmediatePropagation();
      evt.preventDefault();
      var methodName = evt.shiftKey ? 'toogleRange' : 'toogle';
      MultiSelection[methodName](this.currentData()._id);
    }
  },

  events: function() {
    return [{
      submit: this.addCard,
      'click .js-toggle-multi-selection': this.toggleMultiSelection,
      'click .js-minicard': this.clickOnMiniCard,
      'click .open-minicard-composer': this.scrollToBottom
    }];
  }
}).register('minicard');