listHeader.js 986 B

12345678910111213141516171819202122232425262728293031323334353637
  1. BlazeComponent.extendComponent({
  2. editTitle(evt) {
  3. evt.preventDefault();
  4. const newTitle = this.childComponents('inlinedForm')[0].getValue().trim();
  5. const list = this.currentData();
  6. if (newTitle) {
  7. list.rename(newTitle.trim());
  8. }
  9. },
  10. events() {
  11. return [{
  12. 'click .js-open-list-menu': Popup.open('listAction'),
  13. submit: this.editTitle,
  14. }];
  15. },
  16. }).register('listHeader');
  17. Template.listActionPopup.events({
  18. 'click .js-add-card'() {
  19. const listDom = document.getElementById(`js-list-${this._id}`);
  20. const listComponent = BlazeComponent.getComponentForElement(listDom);
  21. listComponent.openForm({ position: 'top' });
  22. Popup.close();
  23. },
  24. 'click .js-list-subscribe'() {},
  25. 'click .js-select-cards'() {
  26. const cardIds = this.allCards().map((card) => card._id);
  27. MultiSelection.add(cardIds);
  28. Popup.close();
  29. },
  30. 'click .js-close-list'(evt) {
  31. evt.preventDefault();
  32. this.archive();
  33. Popup.close();
  34. },
  35. });