sidebarArchives.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. BlazeComponent.extendComponent({
  2. tabs() {
  3. return [
  4. { name: TAPi18n.__('cards'), slug: 'cards' },
  5. { name: TAPi18n.__('lists'), slug: 'lists' },
  6. ];
  7. },
  8. archivedCards() {
  9. return Cards.find({
  10. archived: true,
  11. boardId: Session.get('currentBoard'),
  12. });
  13. },
  14. archivedLists() {
  15. return Lists.find({
  16. archived: true,
  17. boardId: Session.get('currentBoard'),
  18. });
  19. },
  20. cardIsInArchivedList() {
  21. return this.currentData().list().archived;
  22. },
  23. onRendered() {
  24. // XXX We should support dragging a card from the sidebar to the board
  25. },
  26. events() {
  27. return [{
  28. 'click .js-restore-card'() {
  29. const card = this.currentData();
  30. card.restore();
  31. },
  32. 'click .js-delete-card': Popup.afterConfirm('cardDelete', function() {
  33. const cardId = this._id;
  34. Cards.remove(cardId);
  35. Popup.close();
  36. }),
  37. 'click .js-restore-list'() {
  38. const list = this.currentData();
  39. list.restore();
  40. },
  41. }];
  42. },
  43. }).register('archivesSidebar');