Forráskód Böngészése

Merge branch 'master' of https://github.com/wekan/wekan into issue881

amadilsons 7 éve
szülő
commit
75f15f1be2

+ 42 - 2
CHANGELOG.md

@@ -1,8 +1,48 @@
+# v0.43 2017-09-25 Wekan release
+
+This release fixes the following bugs:
+
+* [Add emojis back, because removing them broke local dev Sandstorm](https://github.com/wekan/wekan/issues/1248).
+
+Thanks to GitHub user xet7 for contributions.
+
+# v0.42 2017-09-25 Wekan release
+
+This release fixes the following bugs:
+
+* [Remove emoji support, because it breaks MAC addresses, urls, code etc](https://github.com/wekan/wekan/issues/1248).
+
+Thanks to GitHub user xet7 for contributions.
+
+# v0.41 2017-09-25 Wekan release
+
+This release fixes the following bugs:
+
+* [Can't create user and login after install. Reverting REST API: Create user despite disabling registration](https://github.com/wekan/wekan/issues/1249).
+
+Thanks to GitHub user xet7 for contributions.
+
+# v0.40 2017-09-25 Wekan release
+
+This release adds the following new features:
+
+* [Add translations (en/de/fi) for email notifications regarding checklists and checklist
+   items](https://github.com/wekan/wekan/pull/1238);
+* [Added plus button to add card on top of the list](https://github.com/wekan/wekan/pull/1244);
+* [REST API: Create user despite disabling registration](https://github.com/wekan/wekan/issues/1232).
+
+and fixes the following bugs:
+
+* [Checklist items are lost when moving items to another checklist](https://github.com/wekan/wekan/pull/1240);
+* [Keep state of checklist items when moved to another checklist](https://github.com/wekan/wekan/pull/1242).
+
+Thanks to GitHub users GhassenRjab, mario-orlicky, soohwa, umbertooo and xet7 for their contributions.
+
 # v0.39 2017-09-18 Wekan release
 
 This release adds the following new features:
 
-* [Import checklist sort attributes from Wekan and Trello](https://github.com/wekan/wekan/pull/1226)
+* [Import checklist sort attributes from Wekan and Trello](https://github.com/wekan/wekan/pull/1226).
 
 Thanks to GitHub user GhassenRjab for contributions.
 
@@ -10,7 +50,7 @@ Thanks to GitHub user GhassenRjab for contributions.
 
 This release adds the following new features:
 
-* [Reorder checklists. Move checklist item to another checklist.](https://github.com/wekan/wekan/pull/1215)
+* [Reorder checklists. Move checklist item to another checklist.](https://github.com/wekan/wekan/pull/1215);
 * [Card title is now pre-filled in copy card dialog](https://github.com/wekan/wekan/pull/1214).
 
 Thanks to GitHub user frmwrk123 for contributions.

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

@@ -66,7 +66,7 @@ template(name="editChecklistItemForm")
 
 template(name="checklistItems")
   .checklist-items.js-checklist-items
-    each item in checklist.getItems
+    each item in checklist.getItemsSorted
       +inlinedForm(classNames="js-edit-checklist-item" item = item checklist = checklist)
         +editChecklistItemForm(type = 'item' item = item checklist = checklist)
       else

+ 13 - 11
client/components/cards/checklists.js

@@ -20,24 +20,26 @@ function initSorting(items) {
       });
       items.sortable('cancel');
       const formerParent = ui.item.parents('.js-checklist-items');
-      let checklist = Blaze.getData(parent.get(0)).checklist;
+      const checklist = Blaze.getData(parent.get(0)).checklist;
       const oldChecklist = Blaze.getData(formerParent.get(0)).checklist;
       if (oldChecklist._id !== checklist._id) {
         const currentItem = Blaze.getData(ui.item.get(0)).item;
         for (let i = 0; i < orderedItems.length; i++) {
-          let itemId = orderedItems[i];
+          const itemId = orderedItems[i];
           if (itemId !== currentItem._id) continue;
-          checklist.addItem(currentItem.title);
-          checklist = Checklists.findOne({_id: checklist._id});
-          itemId = checklist._id + (checklist.newItemIndex - 1);
-          if (currentItem.finished) {
-            checklist.finishItem(itemId);
-          }
-          orderedItems[i] = itemId;
-          oldChecklist.removeItem(currentItem._id);
+          const newItem = {
+            _id: checklist.getNewItemId(),
+            title: currentItem.title,
+            sort: i,
+            isFinished: currentItem.isFinished,
+          };
+          checklist.addFullItem(newItem);
+          orderedItems[i] = currentItem._id;
+          oldChecklist.removeItem(itemId);
         }
+      } else {
+        checklist.sortItems(orderedItems);
       }
-      checklist.sortItems(orderedItems);
     },
   });
 }

+ 4 - 1
client/components/lists/list.styl

@@ -69,13 +69,16 @@
     padding-left: 10px
     color: #a6a6a6
 
-  .list-header-menu-icon
+  .list-header-menu
     position: absolute
     padding: 7px
     margin-top: 1px
     top: -@padding
     right: -@padding
 
+  .list-header-plus-icon
+    color: #a6a6a6
+
 .list-body
   flex: 1
   display: flex

+ 4 - 3
client/components/lists/listHeader.jade

@@ -13,7 +13,9 @@ template(name="listHeader")
       if currentUser.isBoardMember
         if isWatching
           i.list-header-watch-icon.fa.fa-eye
-        a.list-header-menu-icon.fa.fa-navicon.js-open-list-menu
+        div.list-header-menu
+          a.js-add-card.fa.fa-plus.list-header-plus-icon
+          a.fa.fa-navicon.js-open-list-menu
 
 template(name="editListTitleForm")
   .list-composer
@@ -28,10 +30,9 @@ template(name="listActionPopup")
   unless currentUser.isCommentOnly
     hr
     ul.pop-over-list
-      li: a.js-add-card {{_ 'add-card'}}
       if cards.count
         li: a.js-select-cards {{_ 'list-select-cards'}}
-    hr
+        hr
     ul.pop-over-list
       li: a.js-close-list {{_ 'archive-list'}}
     hr

+ 7 - 8
client/components/lists/listHeader.js

@@ -24,6 +24,13 @@ BlazeComponent.extendComponent({
   events() {
     return [{
       'click .js-open-list-menu': Popup.open('listAction'),
+      'click .js-add-card' () {
+        const listDom = document.getElementById(`js-list-${this.currentData()._id}`);
+        const listComponent = BlazeComponent.getComponentForElement(listDom);
+        listComponent.openForm({
+          position: 'top',
+        });
+      },
       submit: this.editTitle,
     }];
   },
@@ -36,14 +43,6 @@ Template.listActionPopup.helpers({
 });
 
 Template.listActionPopup.events({
-  'click .js-add-card' () {
-    const listDom = document.getElementById(`js-list-${this._id}`);
-    const listComponent = BlazeComponent.getComponentForElement(listDom);
-    listComponent.openForm({
-      position: 'top',
-    });
-    Popup.close();
-  },
   'click .js-list-subscribe' () {},
   'click .js-select-cards' () {
     const cardIds = this.allCards().map((card) => card._id);

+ 2 - 0
i18n/ar.i18n.json

@@ -2,6 +2,8 @@
     "accept": "اقبلboard",
     "act-activity-notify": "[Wekan] اشعار عن نشاط",
     "act-addAttachment": "ربط __attachment__ الى __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "علق على __comment__ : __card__",
     "act-createBoard": "احدث __board__",
     "act-createCard": "اضاف __card__ الى __list__",

+ 2 - 0
i18n/br.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Asantiñ",
     "act-activity-notify": "[Wekan] Activity Notification",
     "act-addAttachment": "attached __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "created __board__",
     "act-createCard": "added __card__ to __list__",

+ 2 - 0
i18n/ca.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Accepta",
     "act-activity-notify": "[Wekan] Notificació d'activitat",
     "act-addAttachment": "adjuntat __attachment__ a __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "comentat a __card__: __comment__",
     "act-createBoard": "creat __board__",
     "act-createCard": "afegit/da __card__ a __list__",

+ 2 - 0
i18n/cs.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Přijmout",
     "act-activity-notify": "[Wekan] Notifikace aktivit",
     "act-addAttachment": "přiložen __attachment__ do __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "komentář k __card__: __comment__",
     "act-createBoard": "přidání __board__",
     "act-createCard": "přidání __card__ do __list__",

+ 2 - 0
i18n/de.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Akzeptieren",
     "act-activity-notify": "[Wekan] Aktivitätsbenachrichtigung",
     "act-addAttachment": "hat __attachment__ an __card__ angehängt",
+    "act-addChecklist": "hat die Checklist __checklist__ zu __card__ hinzugefügt",
+    "act-addChecklistItem": "hat __checklistItem__ zur Checkliste __checklist__ in __card__ hinzugefügt",
     "act-addComment": "hat __card__ kommentiert: __comment__",
     "act-createBoard": "hat __board__ erstellt",
     "act-createCard": "hat __card__ zu __list__ hinzugefügt",

+ 2 - 0
i18n/en-GB.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Accept",
     "act-activity-notify": "[Wekan] Activity Notification",
     "act-addAttachment": "attached _ attachment _ to _ card _",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "created __board__",
     "act-createCard": "added __card__ to __list__",

+ 2 - 0
i18n/en.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Accept",
     "act-activity-notify": "[Wekan] Activity Notification",
     "act-addAttachment": "attached __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "created __board__",
     "act-createCard": "added __card__ to __list__",

+ 2 - 0
i18n/eo.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Akcepti",
     "act-activity-notify": "[Wekan] Activity Notification",
     "act-addAttachment": "attached __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "kreiis __board__",
     "act-createCard": "aldonis __card__ al __list__",

+ 4 - 2
i18n/es.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Aceptar",
     "act-activity-notify": "[Wekan] Notificación de Actividad",
     "act-addAttachment": "adjuntado __attachment__ a __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "comentado en __card__: __comment__",
     "act-createBoard": "creado __board__",
     "act-createCard": "añadido __card__ a __list__",
@@ -60,7 +62,7 @@
     "archive": "Guardar",
     "archive-all": "Guardar Todo",
     "archive-board": "Archive Board",
-    "archive-card": "Archive Card",
+    "archive-card": "Archivo Tarjeta",
     "archive-list": "Archivar Lista",
     "archive-selection": "Archive selection",
     "archiveBoardPopup-title": "Archive Board?",
@@ -111,7 +113,7 @@
     "cardLabelsPopup-title": "Etiquetas",
     "cardMembersPopup-title": "Miembros",
     "cardMorePopup-title": "Más",
-    "cards": "Cards",
+    "cards": "Tarjetas",
     "change": "Change",
     "change-avatar": "Cambiar Avatar",
     "change-password": "Cambiar la clave",

+ 2 - 0
i18n/eu.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Onartu",
     "act-activity-notify": "[Wekan] Jarduera-jakinarazpena",
     "act-addAttachment": "__attachment__ __card__ txartelera erantsita",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "__card__ txartelean iruzkina: __comment__",
     "act-createBoard": "__board__ sortuta",
     "act-createCard": "__card__ __list__ zerrrendara gehituta",

+ 2 - 0
i18n/fa.i18n.json

@@ -2,6 +2,8 @@
     "accept": "تایید",
     "act-activity-notify": "[wekan]اطلاع فعالیت",
     "act-addAttachment": "پیوست __attachment__ به __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "یادداشت بر __card__: __comment__",
     "act-createBoard": " __board__ ایجادشد",
     "act-createCard": " __card__  به __list__ اضافه شد",

+ 2 - 0
i18n/fi.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Hyväksy",
     "act-activity-notify": "[Wekan] Toimintailmoitus",
     "act-addAttachment": "liitetty __attachment__ kortille __card__",
+    "act-addChecklist": "lisätty tarkistuslista __checklist__ kortille __card__",
+    "act-addChecklistItem": "lisätty kohta __checklistItem__ tarkistuslistaan __checklist__ kortilla __card__",
     "act-addComment": "kommentoitu __card__: __comment__",
     "act-createBoard": "luotu __board__",
     "act-createCard": "lisätty __card__ listalle __list__",

+ 2 - 0
i18n/fr.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Accepter",
     "act-activity-notify": "[Wekan] Notification d'activité",
     "act-addAttachment": "a joint __attachment__ à __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "a commenté __card__ : __comment__",
     "act-createBoard": "a créé __board__",
     "act-createCard": "a ajouté __card__ à __list__",

+ 2 - 0
i18n/gl.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Aceptar",
     "act-activity-notify": "[Wekan] Activity Notification",
     "act-addAttachment": "attached __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "created __board__",
     "act-createCard": "added __card__ to __list__",

+ 2 - 0
i18n/he.i18n.json

@@ -2,6 +2,8 @@
     "accept": "אישור",
     "act-activity-notify": "[Wekan] הודעת פעילות",
     "act-addAttachment": " __attachment__ צורף לכרטיס __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "התקבלה תגובה על הכרטיס __card__:‏ __comment__",
     "act-createBoard": "הלוח __board__ נוצר",
     "act-createCard": "הכרטיס __card__ התווסף לרשימה __list__",

+ 2 - 0
i18n/hu.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Elfogad",
     "act-activity-notify": "[Wekan] Tevékenység értesítés",
     "act-addAttachment": "attached __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "created __board__",
     "act-createCard": "added __card__ to __list__",

+ 2 - 0
i18n/id.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Terima",
     "act-activity-notify": "[Wekan] Pemberitahuan Kegiatan",
     "act-addAttachment": "Lampirkan__attachment__ke__kartu__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "Dikomentari di__kartu__:__comment__",
     "act-createBoard": "Panel__dibuat__",
     "act-createCard": "Kartu__dilampirkan__ke__Daftar",

+ 2 - 0
i18n/it.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Accetta",
     "act-activity-notify": "[Wekan] Notifiche attività",
     "act-addAttachment": "ha allegato __attachment__ a __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "ha commentato su __card__: __comment__",
     "act-createBoard": "ha creato __board__",
     "act-createCard": "ha aggiunto __card__ a __list__",

+ 2 - 0
i18n/ja.i18n.json

@@ -2,6 +2,8 @@
     "accept": "受け入れ",
     "act-activity-notify": "[Wekan] アクティビティ通知",
     "act-addAttachment": "__card__ に __attachment__ を添付しました",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "__card__: __comment__ をコメントしました",
     "act-createBoard": "__board__ を作成しました",
     "act-createCard": "__list__ に __card__ を追加しました",

+ 2 - 0
i18n/ko.i18n.json

@@ -2,6 +2,8 @@
     "accept": "확인",
     "act-activity-notify": "[Wekan] 활동 알림",
     "act-addAttachment": "__attachment__를 __card__에 첨부",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "__card__에 내용 추가 : __comment__",
     "act-createBoard": "__board__ 생성",
     "act-createCard": "__list__에 __card__ 추가",

+ 2 - 0
i18n/nb.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Godta",
     "act-activity-notify": "[Wekan] Aktivitetsvarsel",
     "act-addAttachment": "la ved __attachment__ til __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "kommenterte til __card__: __comment__",
     "act-createBoard": "opprettet __board__",
     "act-createCard": "la __card__ til __list__",

+ 2 - 0
i18n/nl.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Accepteren",
     "act-activity-notify": "[Wekan] Activiteit Notificatie",
     "act-addAttachment": "__attachment__ als bijlage toegevoegd aan __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "gereageerd op __card__:__comment__",
     "act-createBoard": "aangemaakte__bord__",
     "act-createCard": "toegevoegd__kaart__aan__lijst__",

+ 2 - 0
i18n/pl.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Akceptuj",
     "act-activity-notify": "[Wekan] Activity Notification",
     "act-addAttachment": "attached __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "created __board__",
     "act-createCard": "added __card__ to __list__",

+ 2 - 0
i18n/pt-BR.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Aceitar",
     "act-activity-notify": "[Wekan] Notificação de Atividade",
     "act-addAttachment": "anexo __attachment__ de __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "comentou em __card__: __comment__",
     "act-createBoard": "criou __board__",
     "act-createCard": "__card__ adicionado à __list__",

+ 2 - 0
i18n/ro.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Accept",
     "act-activity-notify": "[Wekan] Activity Notification",
     "act-addAttachment": "attached __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "created __board__",
     "act-createCard": "added __card__ to __list__",

+ 2 - 0
i18n/ru.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Принять",
     "act-activity-notify": "[Wekan] Уведомления о активности",
     "act-addAttachment": "вложено __attachment__ в __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "прокомментировал __card__: __comment__",
     "act-createBoard": "создана __board__",
     "act-createCard": "добавлена __card__ в __list__",

+ 2 - 0
i18n/sr.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Prihvati",
     "act-activity-notify": "[Wekan] Obaveštenje o aktivnostima",
     "act-addAttachment": "attached __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "created __board__",
     "act-createCard": "added __card__ to __list__",

+ 2 - 0
i18n/sv.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Acceptera",
     "act-activity-notify": "[Wekan] Aktivitetsavisering",
     "act-addAttachment": "bifogade __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "kommenterade __card__: __comment__",
     "act-createBoard": "skapade __board__",
     "act-createCard": "lade till __card__ to __list__",

+ 2 - 0
i18n/ta.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Accept",
     "act-activity-notify": "[Wekan] Activity Notification",
     "act-addAttachment": "attached __attachment__ to __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "commented on __card__: __comment__",
     "act-createBoard": "created __board__",
     "act-createCard": "added __card__ to __list__",

+ 2 - 0
i18n/th.i18n.json

@@ -2,6 +2,8 @@
     "accept": "ยอมรับ",
     "act-activity-notify": "[Wekan] แจ้งกิจกรรม",
     "act-addAttachment": "แนบไฟล์ __attachment__ ไปยัง __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "ออกความเห็นที่ __card__: __comment__",
     "act-createBoard": "สร้าง __board__",
     "act-createCard": "เพิ่ม __card__ ไปยัง __list__",

+ 2 - 0
i18n/tr.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Kabul Et",
     "act-activity-notify": "[Wekan] Etkinlik Bildirimi",
     "act-addAttachment": "__card__ kartına __attachment__ dosyasını ekledi",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "__card__ kartına bir yorum bıraktı: __comment__",
     "act-createBoard": "__board__ panosunu oluşturdu",
     "act-createCard": "__card__ kartını ___list__ listesine ekledi.",

+ 2 - 0
i18n/uk.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Прийняти",
     "act-activity-notify": "[Wekan] Сповіщення Діяльності",
     "act-addAttachment": "__attachment__ додане до __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "комментар в __card__: __comment__",
     "act-createBoard": "__board__ створенна",
     "act-createCard": "__card__ карта додана до __list__ листа",

+ 2 - 0
i18n/vi.i18n.json

@@ -2,6 +2,8 @@
     "accept": "Chấp nhận",
     "act-activity-notify": "[Wekan] Thông Báo Hoạt Động",
     "act-addAttachment": "đã đính kèm __attachment__ vào __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "đã bình luận trong __card__: __comment__",
     "act-createBoard": "đã tạo __board__",
     "act-createCard": "đã thêm __card__ vào __list__",

+ 2 - 0
i18n/zh-CN.i18n.json

@@ -2,6 +2,8 @@
     "accept": "接受",
     "act-activity-notify": "[Wekan] 活动通知",
     "act-addAttachment": "添加附件 __attachment__ 至卡片 __card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "在 __card__ 发布评论: __comment__",
     "act-createBoard": "创建看板 __board__",
     "act-createCard": "添加卡片 __card__  至列表 __list__",

+ 2 - 0
i18n/zh-TW.i18n.json

@@ -2,6 +2,8 @@
     "accept": "接受",
     "act-activity-notify": "[Wekan] 活動通知",
     "act-addAttachment": "新增附件__attachment__至__card__",
+    "act-addChecklist": "added checklist __checklist__ to __card__",
+    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
     "act-addComment": "評論__card__: __comment__",
     "act-createBoard": "完成新增 __board__",
     "act-createCard": "將__card__加入__list__",

+ 4 - 0
models/activities.js

@@ -119,6 +119,10 @@ if (Meteor.isServer) {
       const checklist = activity.checklist();
       params.checklist = checklist.title;
     }
+    if (activity.checklistItemId) {
+      const checklistItem = activity.checklistItem();
+      params.checklistItem = checklistItem.title;
+    }
     if (board) {
       const watchingUsers = _.pluck(_.where(board.watchers, {level: 'watching'}), 'userId');
       const trackingUsers = _.pluck(_.where(board.watchers, {level: 'tracking'}), 'userId');

+ 44 - 21
models/checklists.js

@@ -44,11 +44,6 @@ Checklists.attachSchema(new SimpleSchema({
     type: Number,
     decimal: true,
   },
-  newItemIndex: {
-    type: Number,
-    decimal: true,
-    defaultValue: 0,
-  },
 }));
 
 const self = Checklists;
@@ -57,16 +52,8 @@ Checklists.helpers({
   itemCount() {
     return this.items.length;
   },
-  getItems() {
-    return this.items.sort(function (itemA, itemB) {
-      if (itemA.sort < itemB.sort) {
-        return -1;
-      }
-      if (itemA.sort > itemB.sort) {
-        return 1;
-      }
-      return 0;
-    });
+  getItemsSorted() {
+    return _.sortBy(this.items, 'sort');
   },
   finishedCount() {
     return this.items.filter((item) => {
@@ -83,6 +70,16 @@ Checklists.helpers({
     const items = self.findOne({_id : this._id}).items;
     return _.pluck(items, '_id').indexOf(itemId);
   },
+  getNewItemId() {
+    const itemCount = this.itemCount();
+    let idx = 0;
+    if (itemCount > 0) {
+      const lastId = this.items[itemCount - 1]._id;
+      const lastIdSuffix = lastId.substr(this._id.length);
+      idx = parseInt(lastIdSuffix, 10) + 1;
+    }
+    return `${this._id}${idx}`;
+  },
 });
 
 Checklists.allow({
@@ -112,14 +109,40 @@ Checklists.mutations({
   },
   //for items in checklist
   addItem(title) {
-    const itemCount = this.itemCount();
-    const _id = `${this._id}${this.newItemIndex}`;
+    const _id = this.getNewItemId();
     return {
-      $addToSet: { items: { _id, title, isFinished: false, sort: itemCount } },
-      $set: { newItemIndex: this.newItemIndex + 1},
+      $addToSet: {
+        items: {
+          _id, title,
+          isFinished: false,
+          sort: this.itemCount(),
+        },
+      },
     };
   },
+  addFullItem(item) {
+    const itemsUpdate = {};
+    this.items.forEach(function(iterItem, index) {
+      if (iterItem.sort >= item.sort) {
+        itemsUpdate[`items.${index}.sort`] = iterItem.sort + 1;
+      }
+    });
+    if (!_.isEmpty(itemsUpdate)) {
+      self.direct.update({ _id: this._id }, { $set: itemsUpdate });
+    }
+    return { $addToSet: { items: item } };
+  },
   removeItem(itemId) {
+    const item = this.getItem(itemId);
+    const itemsUpdate = {};
+    this.items.forEach(function(iterItem, index) {
+      if (iterItem.sort > item.sort) {
+        itemsUpdate[`items.${index}.sort`] = iterItem.sort - 1;
+      }
+    });
+    if (!_.isEmpty(itemsUpdate)) {
+      self.direct.update({ _id: this._id }, { $set: itemsUpdate });
+    }
     return { $pull: { items: { _id: itemId } } };
   },
   editItem(itemId, title) {
@@ -169,11 +192,11 @@ Checklists.mutations({
   },
   sortItems(itemIDs) {
     const validItems = [];
-    for (const itemID of itemIDs) {
+    itemIDs.forEach((itemID) => {
       if (this.getItem(itemID)) {
         validItems.push(this.itemIndex(itemID));
       }
-    }
+    });
     const modifiedValues = {};
     for (let i = 0; i < validItems.length; i++) {
       modifiedValues[`items.${validItems[i]}.sort`] = i;

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "wekan",
-  "version": "0.39.0",
+  "version": "0.43.0",
   "description": "The open-source Trello-like kanban",
   "private": true,
   "scripts": {

+ 2 - 2
sandstorm-pkgdef.capnp

@@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = (
     appTitle = (defaultText = "Wekan"),
     # The name of the app as it is displayed to the user.
 
-    appVersion = 26,
+    appVersion = 30,
     # Increment this for every release.
 
-    appMarketingVersion = (defaultText = "0.39.0~2017-09-18"),
+    appMarketingVersion = (defaultText = "0.43.0~2017-09-25"),
     # Human-readable presentation of the app version.
 
     minUpgradableAppVersion = 0,

+ 21 - 0
server/migrations.js

@@ -130,3 +130,24 @@ Migrations.add('add-member-isactive-field', () => {
     Boards.update(board._id, {$set: {members: newMemberSet}}, noValidate);
   });
 });
+
+Migrations.add('add-sort-checklists', () => {
+  Checklists.find().forEach((checklist, index) => {
+    if (!checklist.hasOwnProperty('sort')) {
+      Checklists.direct.update(
+        checklist._id,
+        { $set: { sort: index } },
+        noValidate
+      );
+    }
+    checklist.items.forEach(function(item, index) {
+      if (!item.hasOwnProperty('sort')) {
+        Checklists.direct.update(
+          { _id: checklist._id, 'items._id': item._id },
+          { $set: { 'items.$.sort': index } },
+          noValidate
+        );
+      }
+    });
+  });
+});