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

  tabs() {
    return [
      { name: TAPi18n.__('cards'), slug: 'cards' },
      { name: TAPi18n.__('lists'), slug: 'lists' },
    ];
  },

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

  archivedLists() {
    return Lists.find({ archived: true });
  },

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

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

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