sidebarArchives.js 1.4 KB

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