mirror of
https://github.com/wekan/wekan.git
synced 2026-03-13 17:06:13 +01:00
Convert cardDetails, cardCustomFields, cardDate, cardTime, cardDescription, attachments, checklists, labels, minicard, resultCard, and subtasks to use native Meteor Template pattern.
29 lines
847 B
JavaScript
29 lines
847 B
JavaScript
const descriptionFormIsOpen = new ReactiveVar(false);
|
|
|
|
Template.descriptionForm.onDestroyed(function () {
|
|
descriptionFormIsOpen.set(false);
|
|
$('.note-popover').hide();
|
|
});
|
|
|
|
Template.descriptionForm.helpers({
|
|
descriptionFormIsOpen() {
|
|
return descriptionFormIsOpen.get();
|
|
},
|
|
});
|
|
|
|
Template.descriptionForm.events({
|
|
async 'submit .js-card-description'(event, tpl) {
|
|
event.preventDefault();
|
|
const description = tpl.currentComponent ? tpl.currentComponent().getValue() : tpl.$('textarea').val();
|
|
await this.setDescription(description);
|
|
},
|
|
// Pressing Ctrl+Enter should submit the form
|
|
'keydown form textarea'(evt, tpl) {
|
|
if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
|
|
const submitButton = tpl.find('button[type=submit]');
|
|
if (submitButton) {
|
|
submitButton.click();
|
|
}
|
|
}
|
|
},
|
|
});
|