summaryrefslogtreecommitdiffstats
path: root/client/components/cards/checklists.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/cards/checklists.js')
-rw-r--r--client/components/cards/checklists.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js
index 93bf0c19..24a78035 100644
--- a/client/components/cards/checklists.js
+++ b/client/components/cards/checklists.js
@@ -4,13 +4,18 @@ BlazeComponent.extendComponent({
const textarea = this.find('textarea.js-add-checklist-item');
const title = textarea.value.trim();
const cardId = this.currentData().cardId;
- Checklists.insert({
- cardId,
- title,
- });
- setTimeout(() => {
- this.$('.add-checklist-item').last().click();
- }, 100);
+
+ if (title) {
+ Checklists.insert({
+ cardId,
+ title,
+ });
+ setTimeout(() => {
+ this.$('.add-checklist-item').last().click();
+ }, 100);
+ }
+ textarea.value = '';
+ textarea.focus();
},
addChecklistItem(event) {
@@ -18,8 +23,10 @@ BlazeComponent.extendComponent({
const textarea = this.find('textarea.js-add-checklist-item');
const title = textarea.value.trim();
const checklist = this.currentData().checklist;
- checklist.addItem(title);
+ if (title) {
+ checklist.addItem(title);
+ }
// We keep the form opened, empty it.
textarea.value = '';
textarea.focus();