diff --git a/client/components/cards/checklists.jade b/client/components/cards/checklists.jade index d387de307..590b5e2eb 100644 --- a/client/components/cards/checklists.jade +++ b/client/components/cards/checklists.jade @@ -18,7 +18,7 @@ template(name="checklists") if canModifyCard +inlinedForm(autoclose=false classNames="js-add-checklist" cardId = cardId) - +addChecklistItemForm + +addChecklistItemForm(checklist=checklist showNewlineBecomesNewChecklistItem=false) else a.add-checklist.js-open-inlined-form(title="{{_ 'add-checklist'}}") i.fa.fa-plus @@ -56,6 +56,10 @@ template(name="addChecklistItemForm") .edit-controls.clearfix button.primary.confirm.js-submit-add-checklist-item-form(type="submit") {{_ 'save'}} a.fa.fa-times-thin.js-close-inlined-form + if showNewlineBecomesNewChecklistItem + .material-toggle-switch(title="{{_ 'newlineBecomesNewChecklistItem'}}") + input.toggle-switch(type="checkbox" id="toggleNewlineBecomesNewChecklistItem") + label.toggle-label(for="toggleNewlineBecomesNewChecklistItem") template(name="editChecklistItemForm") a.fa.fa-copy(title="{{_ 'copy-text-to-clipboard'}}") @@ -84,7 +88,7 @@ template(name="checklistItems") +checklistItemDetail(item = item checklist = checklist) if canModifyCard +inlinedForm(autoclose=false classNames="js-add-checklist-item" checklist = checklist) - +addChecklistItemForm + +addChecklistItemForm(checklist=checklist showNewlineBecomesNewChecklistItem=true) else a.add-checklist-item.js-open-inlined-form(title="{{_ 'add-checklist-item'}}") i.fa.fa-plus diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js index fcb404b95..0d5589650 100644 --- a/client/components/cards/checklists.js +++ b/client/components/cards/checklists.js @@ -105,16 +105,23 @@ BlazeComponent.extendComponent({ addChecklistItem(event) { event.preventDefault(); const textarea = this.find('textarea.js-add-checklist-item'); + const newlineBecomesNewChecklistItem = this.find('input#toggleNewlineBecomesNewChecklistItem'); const title = textarea.value.trim(); const checklist = this.currentData().checklist; if (title) { - ChecklistItems.insert({ - title, - checklistId: checklist._id, - cardId: checklist.cardId, - sort: Utils.calculateIndexData(checklist.lastItem()).base, - }); + let checklistItems = [title]; + if (newlineBecomesNewChecklistItem.checked) { + checklistItems = title.split('\n').map(_value => _value.trim()); + } + for (let checklistItem of checklistItems) { + ChecklistItems.insert({ + title: checklistItem, + checklistId: checklist._id, + cardId: checklist.cardId, + sort: Utils.calculateIndexData(checklist.lastItem()).base, + }); + } } // We keep the form opened, empty it. textarea.value = ''; diff --git a/client/components/cards/checklists.styl b/client/components/cards/checklists.styl index b9983e32d..c8ca24f06 100644 --- a/client/components/cards/checklists.styl +++ b/client/components/cards/checklists.styl @@ -143,3 +143,7 @@ textarea.js-add-checklist-item, textarea.js-edit-checklist-item .checklist-details-menu float: right padding: 6px 10px 6px 10px + +.edit-controls + label.toggle-label + margin-left: 2px diff --git a/client/components/forms/forms.styl b/client/components/forms/forms.styl index ce1a5adf1..69e470109 100644 --- a/client/components/forms/forms.styl +++ b/client/components/forms/forms.styl @@ -117,7 +117,6 @@ button display: inline-block font-weight: 700 line-height: 22px - margin: 8px 4px 0 0 padding: 7px 20px text-align: center @@ -226,20 +225,19 @@ textarea .edit-controls, .add-controls display: flex - align-items: baseline - margin-top: 0 + align-items: center + margin-top: 0px + margin-bottom: 12px button[type=submit] input[type=button] float: left height: 32px - margin-top: -2px - padding-top: 5px - padding-bottom: 5px + margin-bottom: 0px .fa-times-thin font-size: 26px - margin: 3px 4px + margin: 3px 10px // Material Design checkboxes [type="checkbox"]:not(:checked), diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 39dad5c4b..8a8533952 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -1141,5 +1141,6 @@ "copied": "Copied!", "checklistActionsPopup-title": "Checklist Actions", "moveChecklist": "Move Checklist", - "moveChecklistPopup-title": "Move Checklist" + "moveChecklistPopup-title": "Move Checklist", + "newlineBecomesNewChecklistItem": "Newline becomes new checklist item" }