summaryrefslogtreecommitdiffstats
path: root/client/components/sidebar/sidebarArchives.js
blob: dd989ca37eab6d24d2ab2fdc531fc173d791e8c7 (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
38
39
40
41
42
43
44
45
46
BlazeComponent.extendComponent({
  template: function() {
    return 'archivesSidebar';
  },

  tabs: function() {
    return [
      { name: 'Cards', slug: 'cards' },
      { name: 'Lists', slug: 'lists' }
    ]
  },

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

  archivedLists: function() {
    return Lists.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-card': function() {
        var cardId = this.currentData()._id;
        Cards.update(cardId, {$set: {archived: false}});
      },
      'click .js-delete-card': Popup.afterConfirm('cardDelete', function() {
        var cardId = this._id;
        Cards.remove(cardId);
        Popup.close();
      }),
      'click .js-restore-list': function() {
        var listId = this.currentData()._id;
        Lists.update(listId, {$set: {archived: false}});
      }
    }];
  }
}).register('archivesSidebar');