diff options
author | nztqa <nztqa@users.noreply.github.com> | 2017-07-01 23:03:54 +0900 |
---|---|---|
committer | nztqa <nztqa@users.noreply.github.com> | 2017-07-01 23:03:54 +0900 |
commit | 29f65be1e008e7106253f3c8cb8d751079696e45 (patch) | |
tree | 59975ddc868785e0ebec24fa8292fbe2f2178510 /client/components/cards/checklists.js | |
parent | cbbdf8442dbe9026176098843b6377346c5ec117 (diff) | |
download | wekan-29f65be1e008e7106253f3c8cb8d751079696e45.tar.gz wekan-29f65be1e008e7106253f3c8cb8d751079696e45.tar.bz2 wekan-29f65be1e008e7106253f3c8cb8d751079696e45.zip |
Add check to see if input is empty
Diffstat (limited to 'client/components/cards/checklists.js')
-rw-r--r-- | client/components/cards/checklists.js | 23 |
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(); |