From 00e5808a4ce266ae565352a721a9c1d754e58165 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Mon, 27 May 2024 21:37:09 +0200 Subject: [PATCH] Checklist multiline option, adding option to keep the origin order if many items are added at the checklist top --- client/components/cards/checklists.jade | 6 +++++- client/components/cards/checklists.js | 5 ++++- imports/i18n/data/en.i18n.json | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/components/cards/checklists.jade b/client/components/cards/checklists.jade index 74d2f0d01..32109001c 100644 --- a/client/components/cards/checklists.jade +++ b/client/components/cards/checklists.jade @@ -73,6 +73,10 @@ template(name="addChecklistItemForm") .material-toggle-switch(title="{{_ 'newlineBecomesNewChecklistItem'}}") input.toggle-switch(type="checkbox" id="toggleNewlineBecomesNewChecklistItem") label.toggle-label(for="toggleNewlineBecomesNewChecklistItem") + if $eq position 'top' + .material-toggle-switch(title="{{_ 'newlineBecomesNewChecklistItemOriginOrder'}}") + input.toggle-switch(type="checkbox" id="toggleNewlineBecomesNewChecklistItemOriginOrder") + label.toggle-label(for="toggleNewlineBecomesNewChecklistItemOriginOrder") template(name="editChecklistItemForm") a.fa.fa-copy(title="{{_ 'copy-text-to-clipboard'}}") @@ -96,7 +100,7 @@ template(name="checklistItems") if checklist.items.length if canModifyCard +inlinedForm(autoclose=false classNames="js-add-checklist-item" checklist = checklist position="top") - +addChecklistItemForm(checklist=checklist showNewlineBecomesNewChecklistItem=true) + +addChecklistItemForm(checklist=checklist showNewlineBecomesNewChecklistItem=true position="top") 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 f6f543571..1d39b5fa5 100644 --- a/client/components/cards/checklists.js +++ b/client/components/cards/checklists.js @@ -119,6 +119,7 @@ BlazeComponent.extendComponent({ event.preventDefault(); const textarea = this.find('textarea.js-add-checklist-item'); const newlineBecomesNewChecklistItem = this.find('input#toggleNewlineBecomesNewChecklistItem'); + const newlineBecomesNewChecklistItemOriginOrder = this.find('input#toggleNewlineBecomesNewChecklistItemOriginOrder'); const title = textarea.value.trim(); const checklist = this.currentData().checklist; @@ -127,7 +128,9 @@ BlazeComponent.extendComponent({ if (newlineBecomesNewChecklistItem.checked) { checklistItems = title.split('\n').map(_value => _value.trim()); if (this.currentData().position === 'top') { - checklistItems = checklistItems.reverse(); + if (newlineBecomesNewChecklistItemOriginOrder.checked === false) { + checklistItems = checklistItems.reverse(); + } } } for (let checklistItem of checklistItems) { diff --git a/imports/i18n/data/en.i18n.json b/imports/i18n/data/en.i18n.json index 1fb8d8dc3..df6ef1ea3 100644 --- a/imports/i18n/data/en.i18n.json +++ b/imports/i18n/data/en.i18n.json @@ -1196,6 +1196,7 @@ "moveChecklist": "Move Checklist", "moveChecklistPopup-title": "Move Checklist", "newlineBecomesNewChecklistItem": "Newline becomes new checklist item", + "newlineBecomesNewChecklistItemOriginOrder": "Newline becomes new checklist item, origin order", "copyChecklist": "Copy Checklist", "copyChecklistPopup-title": "Copy Checklist", "card-show-lists": "Card Show Lists",