sidebarArchives.js 1.1 KB

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