cardDetails.js 21 KB

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