diff options
author | Lauri Ojansivu <x@xet7.org> | 2017-07-02 00:51:38 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2017-07-02 00:51:38 +0300 |
commit | 4159aa09299dc4af4de97a44f5f585081da6e65d (patch) | |
tree | 816334b175e960f538e70320a2b85cd0128f4465 /client | |
parent | cbbdf8442dbe9026176098843b6377346c5ec117 (diff) | |
parent | 0e5a6a9e9ecf783494258632e0a27268bb18ce45 (diff) | |
download | wekan-4159aa09299dc4af4de97a44f5f585081da6e65d.tar.gz wekan-4159aa09299dc4af4de97a44f5f585081da6e65d.tar.bz2 wekan-4159aa09299dc4af4de97a44f5f585081da6e65d.zip |
Merge branch 'nztqa-fix-checklistitem-empty' into devel
Fix: Possible to add empty item to checklist.
Thanks to nztqa ! Closes #1103
Diffstat (limited to 'client')
-rw-r--r-- | client/components/cards/checklists.jade | 2 | ||||
-rw-r--r-- | client/components/cards/checklists.js | 23 |
2 files changed, 16 insertions, 9 deletions
diff --git a/client/components/cards/checklists.jade b/client/components/cards/checklists.jade index c59b6307..d04a9b60 100644 --- a/client/components/cards/checklists.jade +++ b/client/components/cards/checklists.jade @@ -4,7 +4,7 @@ template(name="checklists") each checklist in currentCard.checklists +checklistDetail(checklist = checklist) if canModifyCard - +inlinedForm(classNames="js-add-checklist" cardId = cardId) + +inlinedForm(autoclose=false classNames="js-add-checklist" cardId = cardId) +addChecklistItemForm else a.js-open-inlined-form 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(); |