cardDetails.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. const subManager = new SubsManager();
  2. const { calculateIndexData } = Utils;
  3. BlazeComponent.extendComponent({
  4. mixins() {
  5. return [Mixins.InfiniteScrolling, Mixins.PerfectScrollbar];
  6. },
  7. calculateNextPeak() {
  8. const cardElement = this.find('.js-card-details');
  9. if (cardElement) {
  10. const altitude = cardElement.scrollHeight;
  11. this.callFirstWith(this, 'setNextPeak', altitude);
  12. }
  13. },
  14. reachNextPeak() {
  15. const activitiesComponent = this.childComponents('activities')[0];
  16. activitiesComponent.loadNextPage();
  17. },
  18. onCreated() {
  19. this.currentBoard = Boards.findOne(Session.get('currentBoard'));
  20. this.isLoaded = new ReactiveVar(false);
  21. const boardBody = this.parentComponent().parentComponent();
  22. //in Miniview parent is Board, not BoardBody.
  23. if (boardBody !== null) {
  24. boardBody.showOverlay.set(true);
  25. boardBody.mouseHasEnterCardDetails = false;
  26. }
  27. this.calculateNextPeak();
  28. Meteor.subscribe('unsaved-edits');
  29. },
  30. isWatching() {
  31. const card = this.currentData();
  32. return card.findWatcher(Meteor.userId());
  33. },
  34. hiddenSystemMessages() {
  35. return Meteor.user().hasHiddenSystemMessages();
  36. },
  37. canModifyCard() {
  38. return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
  39. },
  40. scrollParentContainer() {
  41. const cardPanelWidth = 510;
  42. const bodyBoardComponent = this.parentComponent().parentComponent();
  43. //On Mobile View Parent is Board, Not Board Body. I cant see how this funciton should work then.
  44. if (bodyBoardComponent === null) return;
  45. const $cardView = this.$(this.firstNode());
  46. const $cardContainer = bodyBoardComponent.$('.js-swimlanes');
  47. const cardContainerScroll = $cardContainer.scrollLeft();
  48. const cardContainerWidth = $cardContainer.width();
  49. const cardViewStart = $cardView.offset().left;
  50. const cardViewEnd = cardViewStart + cardPanelWidth;
  51. let offset = false;
  52. if (cardViewStart < 0) {
  53. offset = cardViewStart;
  54. } else if (cardViewEnd > cardContainerWidth) {
  55. offset = cardViewEnd - cardContainerWidth;
  56. }
  57. if (offset) {
  58. bodyBoardComponent.scrollLeft(cardContainerScroll + offset);
  59. }
  60. },
  61. presentParentTask() {
  62. let result = this.currentBoard.presentParentTask;
  63. if ((result === null) || (result === undefined)) {
  64. result = 'no-parent';
  65. }
  66. return result;
  67. },
  68. linkForCard() {
  69. const card = this.currentData();
  70. let result = '#';
  71. if (card) {
  72. const board = Boards.findOne(card.boardId);
  73. if (board) {
  74. result = FlowRouter.url('card', {
  75. boardId: card.boardId,
  76. slug: board.slug,
  77. cardId: card._id,
  78. });
  79. }
  80. }
  81. return result;
  82. },
  83. onRendered() {
  84. if (!Utils.isMiniScreen()) this.scrollParentContainer();
  85. const $checklistsDom = this.$('.card-checklist-items');
  86. $checklistsDom.sortable({
  87. tolerance: 'pointer',
  88. helper: 'clone',
  89. handle: '.checklist-title',
  90. items: '.js-checklist',
  91. placeholder: 'checklist placeholder',
  92. distance: 7,
  93. start(evt, ui) {
  94. ui.placeholder.height(ui.helper.height());
  95. EscapeActions.executeUpTo('popup-close');
  96. },
  97. stop(evt, ui) {
  98. let prevChecklist = ui.item.prev('.js-checklist').get(0);
  99. if (prevChecklist) {
  100. prevChecklist = Blaze.getData(prevChecklist).checklist;
  101. }
  102. let nextChecklist = ui.item.next('.js-checklist').get(0);
  103. if (nextChecklist) {
  104. nextChecklist = Blaze.getData(nextChecklist).checklist;
  105. }
  106. const sortIndex = calculateIndexData(prevChecklist, nextChecklist, 1);
  107. $checklistsDom.sortable('cancel');
  108. const checklist = Blaze.getData(ui.item.get(0)).checklist;
  109. Checklists.update(checklist._id, {
  110. $set: {
  111. sort: sortIndex.base,
  112. },
  113. });
  114. },
  115. });
  116. const $subtasksDom = this.$('.card-subtasks-items');
  117. $subtasksDom.sortable({
  118. tolerance: 'pointer',
  119. helper: 'clone',
  120. handle: '.subtask-title',
  121. items: '.js-subtasks',
  122. placeholder: 'subtasks placeholder',
  123. distance: 7,
  124. start(evt, ui) {
  125. ui.placeholder.height(ui.helper.height());
  126. EscapeActions.executeUpTo('popup-close');
  127. },
  128. stop(evt, ui) {
  129. let prevChecklist = ui.item.prev('.js-subtasks').get(0);
  130. if (prevChecklist) {
  131. prevChecklist = Blaze.getData(prevChecklist).subtask;
  132. }
  133. let nextChecklist = ui.item.next('.js-subtasks').get(0);
  134. if (nextChecklist) {
  135. nextChecklist = Blaze.getData(nextChecklist).subtask;
  136. }
  137. const sortIndex = calculateIndexData(prevChecklist, nextChecklist, 1);
  138. $subtasksDom.sortable('cancel');
  139. const subtask = Blaze.getData(ui.item.get(0)).subtask;
  140. Subtasks.update(subtask._id, {
  141. $set: {
  142. subtaskSort: sortIndex.base,
  143. },
  144. });
  145. },
  146. });
  147. function userIsMember() {
  148. return Meteor.user() && Meteor.user().isBoardMember();
  149. }
  150. // Disable sorting if the current user is not a board member
  151. this.autorun(() => {
  152. if ($checklistsDom.data('sortable')) {
  153. $checklistsDom.sortable('option', 'disabled', !userIsMember());
  154. }
  155. if ($subtasksDom.data('sortable')) {
  156. $subtasksDom.sortable('option', 'disabled', !userIsMember());
  157. }
  158. });
  159. },
  160. onDestroyed() {
  161. const parentComponent = this.parentComponent().parentComponent();
  162. //on mobile view parent is Board, not board body.
  163. if (parentComponent === null) return;
  164. parentComponent.showOverlay.set(false);
  165. },
  166. events() {
  167. const events = {
  168. [`${CSSEvents.transitionend} .js-card-details`]() {
  169. this.isLoaded.set(true);
  170. },
  171. [`${CSSEvents.animationend} .js-card-details`]() {
  172. this.isLoaded.set(true);
  173. },
  174. };
  175. return [{
  176. ...events,
  177. 'click .js-close-card-details' () {
  178. Utils.goBoardId(this.data().boardId);
  179. },
  180. 'click .js-open-card-details-menu': Popup.open('cardDetailsActions'),
  181. 'submit .js-card-description' (evt) {
  182. evt.preventDefault();
  183. const description = this.currentComponent().getValue();
  184. this.data().setDescription(description);
  185. },
  186. 'submit .js-card-details-title' (evt) {
  187. evt.preventDefault();
  188. const title = this.currentComponent().getValue().trim();
  189. if (title) {
  190. this.data().setTitle(title);
  191. }
  192. },
  193. 'submit .js-card-details-assigner'(evt) {
  194. evt.preventDefault();
  195. const assigner = this.currentComponent().getValue().trim();
  196. if (assigner) {
  197. this.data().setAssignedBy(assigner);
  198. }
  199. },
  200. 'submit .js-card-details-requester'(evt) {
  201. evt.preventDefault();
  202. const requester = this.currentComponent().getValue().trim();
  203. if (requester) {
  204. this.data().setRequestedBy(requester);
  205. }
  206. },
  207. 'click .js-member': Popup.open('cardMember'),
  208. 'click .js-add-members': Popup.open('cardMembers'),
  209. 'click .js-add-labels': Popup.open('cardLabels'),
  210. 'click .js-received-date': Popup.open('editCardReceivedDate'),
  211. 'click .js-start-date': Popup.open('editCardStartDate'),
  212. 'click .js-due-date': Popup.open('editCardDueDate'),
  213. 'click .js-end-date': Popup.open('editCardEndDate'),
  214. 'mouseenter .js-card-details' () {
  215. const parentComponent = this.parentComponent().parentComponent();
  216. //on mobile view parent is Board, not BoardBody.
  217. if (parentComponent === null) return;
  218. parentComponent.showOverlay.set(true);
  219. parentComponent.mouseHasEnterCardDetails = true;
  220. },
  221. 'click #toggleButton'() {
  222. Meteor.call('toggleSystemMessages');
  223. },
  224. }];
  225. },
  226. }).register('cardDetails');
  227. // We extends the normal InlinedForm component to support UnsavedEdits draft
  228. // feature.
  229. (class extends InlinedForm {
  230. _getUnsavedEditKey() {
  231. return {
  232. fieldName: 'cardDescription',
  233. // XXX Recovering the currentCard identifier form a session variable is
  234. // fragile because this variable may change for instance if the route
  235. // change. We should use some component props instead.
  236. docId: Session.get('currentCard'),
  237. };
  238. }
  239. close(isReset = false) {
  240. if (this.isOpen.get() && !isReset) {
  241. const draft = this.getValue().trim();
  242. if (draft !== Cards.findOne(Session.get('currentCard')).description) {
  243. UnsavedEdits.set(this._getUnsavedEditKey(), this.getValue());
  244. }
  245. }
  246. super.close();
  247. }
  248. reset() {
  249. UnsavedEdits.reset(this._getUnsavedEditKey());
  250. this.close(true);
  251. }
  252. events() {
  253. const parentEvents = InlinedForm.prototype.events()[0];
  254. return [{
  255. ...parentEvents,
  256. 'click .js-close-inlined-form': this.reset,
  257. }];
  258. }
  259. }).register('inlinedCardDescription');
  260. Template.cardDetailsActionsPopup.helpers({
  261. isWatching() {
  262. return this.findWatcher(Meteor.userId());
  263. },
  264. canModifyCard() {
  265. return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
  266. },
  267. });
  268. Template.cardDetailsActionsPopup.events({
  269. 'click .js-members': Popup.open('cardMembers'),
  270. 'click .js-labels': Popup.open('cardLabels'),
  271. 'click .js-attachments': Popup.open('cardAttachments'),
  272. 'click .js-custom-fields': Popup.open('cardCustomFields'),
  273. 'click .js-received-date': Popup.open('editCardReceivedDate'),
  274. 'click .js-start-date': Popup.open('editCardStartDate'),
  275. 'click .js-due-date': Popup.open('editCardDueDate'),
  276. 'click .js-end-date': Popup.open('editCardEndDate'),
  277. 'click .js-spent-time': Popup.open('editCardSpentTime'),
  278. 'click .js-move-card': Popup.open('moveCard'),
  279. 'click .js-copy-card': Popup.open('copyCard'),
  280. 'click .js-copy-checklist-cards': Popup.open('copyChecklistToManyCards'),
  281. 'click .js-move-card-to-top' (evt) {
  282. evt.preventDefault();
  283. const minOrder = _.min(this.list().cards(this.swimlaneId).map((c) => c.sort));
  284. this.move(this.swimlaneId, this.listId, minOrder - 1);
  285. },
  286. 'click .js-move-card-to-bottom' (evt) {
  287. evt.preventDefault();
  288. const maxOrder = _.max(this.list().cards(this.swimlaneId).map((c) => c.sort));
  289. this.move(this.swimlaneId, this.listId, maxOrder + 1);
  290. },
  291. 'click .js-archive' (evt) {
  292. evt.preventDefault();
  293. this.archive();
  294. Popup.close();
  295. },
  296. 'click .js-more': Popup.open('cardMore'),
  297. 'click .js-toggle-watch-card' () {
  298. const currentCard = this;
  299. const level = currentCard.findWatcher(Meteor.userId()) ? null : 'watching';
  300. Meteor.call('watch', 'card', currentCard._id, level, (err, ret) => {
  301. if (!err && ret) Popup.close();
  302. });
  303. },
  304. });
  305. Template.editCardTitleForm.onRendered(function () {
  306. autosize(this.$('.js-edit-card-title'));
  307. });
  308. Template.editCardTitleForm.events({
  309. 'keydown .js-edit-card-title' (evt) {
  310. // If enter key was pressed, submit the data
  311. // Unless the shift key is also being pressed
  312. if (evt.keyCode === 13 && !evt.shiftKey) {
  313. $('.js-submit-edit-card-title-form').click();
  314. }
  315. },
  316. });
  317. Template.editCardRequesterForm.onRendered(function() {
  318. autosize(this.$('.js-edit-card-requester'));
  319. });
  320. Template.editCardRequesterForm.events({
  321. 'keydown .js-edit-card-requester'(evt) {
  322. // If enter key was pressed, submit the data
  323. if (evt.keyCode === 13) {
  324. $('.js-submit-edit-card-requester-form').click();
  325. }
  326. },
  327. });
  328. Template.editCardAssignerForm.onRendered(function() {
  329. autosize(this.$('.js-edit-card-assigner'));
  330. });
  331. Template.editCardAssignerForm.events({
  332. 'keydown .js-edit-card-assigner'(evt) {
  333. // If enter key was pressed, submit the data
  334. if (evt.keyCode === 13) {
  335. $('.js-submit-edit-card-assigner-form').click();
  336. }
  337. },
  338. });
  339. Template.moveCardPopup.events({
  340. 'click .js-done' () {
  341. // XXX We should *not* get the currentCard from the global state, but
  342. // instead from a “component” state.
  343. const card = Cards.findOne(Session.get('currentCard'));
  344. const lSelect = $('.js-select-lists')[0];
  345. const newListId = lSelect.options[lSelect.selectedIndex].value;
  346. const slSelect = $('.js-select-swimlanes')[0];
  347. card.swimlaneId = slSelect.options[slSelect.selectedIndex].value;
  348. card.move(card.swimlaneId, newListId, 0);
  349. Popup.close();
  350. },
  351. });
  352. BlazeComponent.extendComponent({
  353. onCreated() {
  354. subManager.subscribe('board', Session.get('currentBoard'));
  355. this.selectedBoardId = new ReactiveVar(Session.get('currentBoard'));
  356. },
  357. boards() {
  358. const boards = Boards.find({
  359. archived: false,
  360. 'members.userId': Meteor.userId(),
  361. }, {
  362. sort: ['title'],
  363. });
  364. return boards;
  365. },
  366. swimlanes() {
  367. const board = Boards.findOne(this.selectedBoardId.get());
  368. return board.swimlanes();
  369. },
  370. aBoardLists() {
  371. const board = Boards.findOne(this.selectedBoardId.get());
  372. return board.lists();
  373. },
  374. events() {
  375. return [{
  376. 'change .js-select-boards'(evt) {
  377. this.selectedBoardId.set($(evt.currentTarget).val());
  378. subManager.subscribe('board', this.selectedBoardId.get());
  379. },
  380. }];
  381. },
  382. }).register('boardsAndLists');
  383. function cloneCheckList(_id, checklist) {
  384. 'use strict';
  385. const checklistId = checklist._id;
  386. checklist.cardId = _id;
  387. checklist._id = null;
  388. const newChecklistId = Checklists.insert(checklist);
  389. ChecklistItems.find({checklistId}).forEach(function(item) {
  390. item._id = null;
  391. item.checklistId = newChecklistId;
  392. item.cardId = _id;
  393. ChecklistItems.insert(item);
  394. });
  395. }
  396. Template.copyCardPopup.events({
  397. 'click .js-done'() {
  398. const card = Cards.findOne(Session.get('currentCard'));
  399. const oldId = card._id;
  400. card._id = null;
  401. const lSelect = $('.js-select-lists')[0];
  402. card.listId = lSelect.options[lSelect.selectedIndex].value;
  403. const slSelect = $('.js-select-swimlanes')[0];
  404. card.swimlaneId = slSelect.options[slSelect.selectedIndex].value;
  405. const bSelect = $('.js-select-boards')[0];
  406. card.boardId = bSelect.options[bSelect.selectedIndex].value;
  407. const textarea = $('#copy-card-title');
  408. const title = textarea.val().trim();
  409. // insert new card to the bottom of new list
  410. card.sort = Lists.findOne(card.listId).cards().count();
  411. if (title) {
  412. card.title = title;
  413. card.coverId = '';
  414. const _id = Cards.insert(card);
  415. // In case the filter is active we need to add the newly inserted card in
  416. // the list of exceptions -- cards that are not filtered. Otherwise the
  417. // card will disappear instantly.
  418. // See https://github.com/wekan/wekan/issues/80
  419. Filter.addException(_id);
  420. // copy checklists
  421. let cursor = Checklists.find({cardId: oldId});
  422. cursor.forEach(function() {
  423. cloneCheckList(_id, arguments[0]);
  424. });
  425. // copy subtasks
  426. cursor = Cards.find({parentId: oldId});
  427. cursor.forEach(function() {
  428. 'use strict';
  429. const subtask = arguments[0];
  430. subtask.parentId = _id;
  431. subtask._id = null;
  432. /* const newSubtaskId = */ Cards.insert(subtask);
  433. });
  434. // copy card comments
  435. cursor = CardComments.find({cardId: oldId});
  436. cursor.forEach(function () {
  437. 'use strict';
  438. const comment = arguments[0];
  439. comment.cardId = _id;
  440. comment._id = null;
  441. CardComments.insert(comment);
  442. });
  443. Popup.close();
  444. }
  445. },
  446. });
  447. Template.copyChecklistToManyCardsPopup.events({
  448. 'click .js-done' () {
  449. const card = Cards.findOne(Session.get('currentCard'));
  450. const oldId = card._id;
  451. card._id = null;
  452. const lSelect = $('.js-select-lists')[0];
  453. card.listId = lSelect.options[lSelect.selectedIndex].value;
  454. const slSelect = $('.js-select-swimlanes')[0];
  455. card.swimlaneId = slSelect.options[slSelect.selectedIndex].value;
  456. const bSelect = $('.js-select-boards')[0];
  457. card.boardId = bSelect.options[bSelect.selectedIndex].value;
  458. const textarea = $('#copy-card-title');
  459. const titleEntry = textarea.val().trim();
  460. // insert new card to the bottom of new list
  461. card.sort = Lists.findOne(card.listId).cards().count();
  462. if (titleEntry) {
  463. const titleList = JSON.parse(titleEntry);
  464. for (let i = 0; i < titleList.length; i++){
  465. const obj = titleList[i];
  466. card.title = obj.title;
  467. card.description = obj.description;
  468. card.coverId = '';
  469. const _id = Cards.insert(card);
  470. // In case the filter is active we need to add the newly inserted card in
  471. // the list of exceptions -- cards that are not filtered. Otherwise the
  472. // card will disappear instantly.
  473. // See https://github.com/wekan/wekan/issues/80
  474. Filter.addException(_id);
  475. // copy checklists
  476. let cursor = Checklists.find({cardId: oldId});
  477. cursor.forEach(function() {
  478. cloneCheckList(_id, arguments[0]);
  479. });
  480. // copy subtasks
  481. cursor = Cards.find({parentId: oldId});
  482. cursor.forEach(function() {
  483. 'use strict';
  484. const subtask = arguments[0];
  485. subtask.parentId = _id;
  486. subtask._id = null;
  487. /* const newSubtaskId = */ Cards.insert(subtask);
  488. });
  489. // copy card comments
  490. cursor = CardComments.find({cardId: oldId});
  491. cursor.forEach(function () {
  492. 'use strict';
  493. const comment = arguments[0];
  494. comment.cardId = _id;
  495. comment._id = null;
  496. CardComments.insert(comment);
  497. });
  498. }
  499. Popup.close();
  500. }
  501. },
  502. });
  503. BlazeComponent.extendComponent({
  504. onCreated() {
  505. this.currentCard = this.currentData();
  506. this.parentCard = this.currentCard.parentCard();
  507. if (this.parentCard) {
  508. this.parentBoard = this.parentCard.board();
  509. } else {
  510. this.parentBoard = null;
  511. }
  512. },
  513. boards() {
  514. const boards = Boards.find({
  515. archived: false,
  516. 'members.userId': Meteor.userId(),
  517. }, {
  518. sort: ['title'],
  519. });
  520. return boards;
  521. },
  522. cards() {
  523. if (this.parentBoard) {
  524. return this.parentBoard.cards();
  525. } else {
  526. return [];
  527. }
  528. },
  529. isParentBoard() {
  530. const board = this.currentData();
  531. if (this.parentBoard) {
  532. return board._id === this.parentBoard;
  533. }
  534. return false;
  535. },
  536. isParentCard() {
  537. const card = this.currentData();
  538. if (this.parentCard) {
  539. return card._id === this.parentCard;
  540. }
  541. return false;
  542. },
  543. setParentCardId(cardId) {
  544. if (cardId === 'null') {
  545. cardId = null;
  546. this.parentCard = null;
  547. } else {
  548. this.parentCard = Cards.findOne(cardId);
  549. }
  550. this.currentCard.setParentId(cardId);
  551. },
  552. events() {
  553. return [{
  554. 'click .js-copy-card-link-to-clipboard' () {
  555. // Clipboard code from:
  556. // https://stackoverflow.com/questions/6300213/copy-selected-text-to-the-clipboard-without-using-flash-must-be-cross-browser
  557. const StringToCopyElement = document.getElementById('cardURL');
  558. StringToCopyElement.select();
  559. if (document.execCommand('copy')) {
  560. StringToCopyElement.blur();
  561. } else {
  562. document.getElementById('cardURL').selectionStart = 0;
  563. document.getElementById('cardURL').selectionEnd = 999;
  564. document.execCommand('copy');
  565. if (window.getSelection) {
  566. if (window.getSelection().empty) { // Chrome
  567. window.getSelection().empty();
  568. } else if (window.getSelection().removeAllRanges) { // Firefox
  569. window.getSelection().removeAllRanges();
  570. }
  571. } else if (document.selection) { // IE?
  572. document.selection.empty();
  573. }
  574. }
  575. },
  576. 'click .js-delete': Popup.afterConfirm('cardDelete', function () {
  577. Popup.close();
  578. Cards.remove(this._id);
  579. Utils.goBoardId(this.boardId);
  580. }),
  581. 'change .js-field-parent-board'(evt) {
  582. const selection = $(evt.currentTarget).val();
  583. const list = $('.js-field-parent-card');
  584. list.empty();
  585. if (selection === 'none') {
  586. this.parentBoard = null;
  587. list.prop('disabled', true);
  588. } else {
  589. this.parentBoard = Boards.findOne(selection);
  590. this.parentBoard.cards().forEach(function(card) {
  591. list.append(
  592. $('<option></option>').val(card._id).html(card.title)
  593. );
  594. });
  595. list.prop('disabled', false);
  596. }
  597. list.append(
  598. `<option value='none' selected='selected'>${TAPi18n.__('custom-field-dropdown-none')}</option>`
  599. );
  600. this.setParentCardId('null');
  601. },
  602. 'change .js-field-parent-card'(evt) {
  603. const selection = $(evt.currentTarget).val();
  604. this.setParentCardId(selection);
  605. },
  606. }];
  607. },
  608. }).register('cardMorePopup');
  609. // Close the card details pane by pressing escape
  610. EscapeActions.register('detailsPane',
  611. () => {
  612. Utils.goBoardId(Session.get('currentBoard'));
  613. },
  614. () => {
  615. return !Session.equals('currentCard', null);
  616. }, {
  617. noClickEscapeOn: '.js-card-details,.board-sidebar,#header',
  618. }
  619. );