boardArchive.js 880 B

12345678910111213141516171819202122232425262728293031323334
  1. Template.boardListHeaderBar.events({
  2. 'click .js-open-archived-board'() {
  3. Modal.open('archivedBoards');
  4. },
  5. });
  6. BlazeComponent.extendComponent({
  7. onCreated() {
  8. this.subscribe('archivedBoards');
  9. },
  10. archivedBoards() {
  11. return Boards.find({ archived: true }, {
  12. sort: ['title'],
  13. });
  14. },
  15. events() {
  16. return [{
  17. 'click .js-restore-board'() {
  18. // TODO : Make isSandstorm variable global
  19. const isSandstorm = Meteor.settings && Meteor.settings.public &&
  20. Meteor.settings.public.sandstorm;
  21. if (isSandstorm && Session.get('currentBoard')) {
  22. const currentBoard = Boards.findOne(Session.get('currentBoard'));
  23. currentBoard.archive();
  24. }
  25. const board = this.currentData();
  26. board.restore();
  27. Utils.goBoardId(board._id);
  28. },
  29. }];
  30. },
  31. }).register('archivedBoards');