menu.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Template.listActionPopup.events({
  2. 'click .js-add-card': function() {
  3. var listDom = document.getElementById('js-list-' + this._id);
  4. var listComponent = BlazeComponent.getComponentForElement(listDom);
  5. listComponent.openForm({ position: 'top' });
  6. Popup.close();
  7. },
  8. 'click .js-list-subscribe': function() {},
  9. 'click .js-move-cards': Popup.open('listMoveCards'),
  10. 'click .js-archive-cards': Popup.afterConfirm('listArchiveCards', function() {
  11. Cards.find({listId: this._id}).forEach(function(card) {
  12. Cards.update(card._id, {
  13. $set: {
  14. archived: true
  15. }
  16. });
  17. });
  18. Popup.close();
  19. }),
  20. 'click .js-close-list': function(evt) {
  21. evt.preventDefault();
  22. Lists.update(this._id, {
  23. $set: {
  24. archived: true
  25. }
  26. });
  27. Popup.close();
  28. }
  29. });
  30. Template.listMoveCardsPopup.events({
  31. 'click .js-select-list': function() {
  32. var fromList = Template.parentData(2).data._id;
  33. var toList = this._id;
  34. Cards.find({listId: fromList}).forEach(function(card) {
  35. Cards.update(card._id, {
  36. $set: {
  37. listId: toList
  38. }
  39. });
  40. });
  41. Popup.close();
  42. }
  43. });