瀏覽代碼

Checklist multiline option, adding option to keep the origin order if many items are added at the checklist top

Martin Filser 1 年之前
父節點
當前提交
00e5808a4c
共有 3 個文件被更改,包括 10 次插入2 次删除
  1. 5 1
      client/components/cards/checklists.jade
  2. 4 1
      client/components/cards/checklists.js
  3. 1 0
      imports/i18n/data/en.i18n.json

+ 5 - 1
client/components/cards/checklists.jade

@@ -73,6 +73,10 @@ template(name="addChecklistItemForm")
       .material-toggle-switch(title="{{_ 'newlineBecomesNewChecklistItem'}}")
       .material-toggle-switch(title="{{_ 'newlineBecomesNewChecklistItem'}}")
         input.toggle-switch(type="checkbox" id="toggleNewlineBecomesNewChecklistItem")
         input.toggle-switch(type="checkbox" id="toggleNewlineBecomesNewChecklistItem")
         label.toggle-label(for="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")
 template(name="editChecklistItemForm")
   a.fa.fa-copy(title="{{_ 'copy-text-to-clipboard'}}")
   a.fa.fa-copy(title="{{_ 'copy-text-to-clipboard'}}")
@@ -96,7 +100,7 @@ template(name="checklistItems")
   if checklist.items.length
   if checklist.items.length
     if canModifyCard
     if canModifyCard
       +inlinedForm(autoclose=false classNames="js-add-checklist-item" checklist = checklist position="top")
       +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
       else
         a.add-checklist-item.js-open-inlined-form(title="{{_ 'add-checklist-item'}}")
         a.add-checklist-item.js-open-inlined-form(title="{{_ 'add-checklist-item'}}")
           i.fa.fa-plus
           i.fa.fa-plus

+ 4 - 1
client/components/cards/checklists.js

@@ -119,6 +119,7 @@ BlazeComponent.extendComponent({
     event.preventDefault();
     event.preventDefault();
     const textarea = this.find('textarea.js-add-checklist-item');
     const textarea = this.find('textarea.js-add-checklist-item');
     const newlineBecomesNewChecklistItem = this.find('input#toggleNewlineBecomesNewChecklistItem');
     const newlineBecomesNewChecklistItem = this.find('input#toggleNewlineBecomesNewChecklistItem');
+    const newlineBecomesNewChecklistItemOriginOrder = this.find('input#toggleNewlineBecomesNewChecklistItemOriginOrder');
     const title = textarea.value.trim();
     const title = textarea.value.trim();
     const checklist = this.currentData().checklist;
     const checklist = this.currentData().checklist;
 
 
@@ -127,7 +128,9 @@ BlazeComponent.extendComponent({
       if (newlineBecomesNewChecklistItem.checked) {
       if (newlineBecomesNewChecklistItem.checked) {
         checklistItems = title.split('\n').map(_value => _value.trim());
         checklistItems = title.split('\n').map(_value => _value.trim());
         if (this.currentData().position === 'top') {
         if (this.currentData().position === 'top') {
-          checklistItems = checklistItems.reverse();
+          if (newlineBecomesNewChecklistItemOriginOrder.checked === false) {
+            checklistItems = checklistItems.reverse();
+          }
         }
         }
       }
       }
       for (let checklistItem of checklistItems) {
       for (let checklistItem of checklistItems) {

+ 1 - 0
imports/i18n/data/en.i18n.json

@@ -1196,6 +1196,7 @@
   "moveChecklist": "Move Checklist",
   "moveChecklist": "Move Checklist",
   "moveChecklistPopup-title": "Move Checklist",
   "moveChecklistPopup-title": "Move Checklist",
   "newlineBecomesNewChecklistItem": "Newline becomes new checklist item",
   "newlineBecomesNewChecklistItem": "Newline becomes new checklist item",
+  "newlineBecomesNewChecklistItemOriginOrder": "Newline becomes new checklist item, origin order",
   "copyChecklist": "Copy Checklist",
   "copyChecklist": "Copy Checklist",
   "copyChecklistPopup-title": "Copy Checklist",
   "copyChecklistPopup-title": "Copy Checklist",
   "card-show-lists": "Card Show Lists",
   "card-show-lists": "Card Show Lists",