summaryrefslogtreecommitdiffstats
path: root/client/components/sidebar/sidebarArchives.js
blob: d422cb433956a30efc95c4476fa7726303fcd0b2 (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
BlazeComponent.extendComponent({
  template: function() {
    return 'archivesSidebar';
  },

  archivedCards: function() {
    return Cards.find({archived: true});
  },

  cardIsInArchivedList: function() {
    return this.currentData().list().archived;
  },

  onRendered: function() {
    //XXX We should support dragging a card from the sidebar to the board
  },

  events: function() {
    return [{
      'click .js-restore': function() {
        var cardId = this.currentData()._id;
        Cards.update(cardId, {$set: {archived: false}});
      },
      'click .js-delete': Popup.afterConfirm('cardDelete', function() {
        var cardId = this._id;
        Cards.remove(cardId);
        Popup.close();
      })
    }];
  }
}).register('archivesSidebar');