diff options
-rw-r--r-- | CHANGELOG.md | 8 | ||||
-rw-r--r-- | Stackerfile.yml | 2 | ||||
-rw-r--r-- | client/components/lists/listBody.jade | 4 | ||||
-rw-r--r-- | client/components/lists/listBody.js | 17 | ||||
-rw-r--r-- | i18n/en.i18n.json | 2 | ||||
-rw-r--r-- | models/boards.js | 3 | ||||
-rw-r--r-- | models/cards.js | 32 | ||||
-rw-r--r-- | models/lists.js | 13 | ||||
-rw-r--r-- | models/swimlanes.js | 8 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | sandstorm-pkgdef.capnp | 4 |
11 files changed, 68 insertions, 27 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f87199c1..933dbf73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# v2.30 2019-02-28 Wekan release + +This release adds the following new [Template features](https://github.com/wekan/wekan/issues/2209), thanks to GitHub user andresmanelli: + +- [Fix popup title. Add element title modification](https://github.com/wekan/wekan/commit/888e1ad5d3e32be53283aa32198057f669f3d706); +- [Copy template attachments](https://github.com/wekan/wekan/commit/abb71083215462d91b084c4de13af0b130638e4d); +- [Standarize copy functions. Match labels by name](https://github.com/wekan/wekan/commit/da21a2a410c9b905de89d66236748e0c8f5357ea). + # v2.29 2019-02-27 Wekan release This release adds the following new features: diff --git a/Stackerfile.yml b/Stackerfile.yml index 031953fe..372faebd 100644 --- a/Stackerfile.yml +++ b/Stackerfile.yml @@ -1,5 +1,5 @@ appId: wekan-public/apps/77b94f60-dec9-0136-304e-16ff53095928 -appVersion: "v2.29.0" +appVersion: "v2.30.0" files: userUploads: - README.md diff --git a/client/components/lists/listBody.jade b/client/components/lists/listBody.jade index 9a9c322a..876b43d6 100644 --- a/client/components/lists/listBody.jade +++ b/client/components/lists/listBody.jade @@ -90,6 +90,10 @@ template(name="linkCardPopup") input.primary.confirm.js-done(type="button" value="{{_ 'link'}}") template(name="searchElementPopup") + form + label + | {{_ 'title'}} + input.js-element-title(type="text" placeholder="{{_ 'title'}}" autofocus required) unless isTemplateSearch label {{_ 'boards'}}: .link-board-wrapper diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 04c7eede..7d767011 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -616,20 +616,21 @@ BlazeComponent.extendComponent({ }, 'click .js-minicard'(evt) { // 0. Common + const title = $('.js-element-title').val().trim(); + if (!title) + return; const element = Blaze.getData(evt.currentTarget); + element.title = title; let _id = ''; if (!this.isTemplateSearch || this.isCardTemplateSearch) { // Card insertion // 1. Common - element.boardId = this.boardId; - element.listId = this.listId; - element.swimlaneId = this.swimlaneId; element.sort = Lists.findOne(this.listId).cards().count(); // 1.A From template if (this.isTemplateSearch) { element.type = 'cardType-card'; element.linkedId = ''; - _id = element.copy(); + _id = element.copy(this.boardId, this.swimlaneId, this.listId); // 1.B Linked card } else { delete element._id; @@ -640,21 +641,19 @@ BlazeComponent.extendComponent({ Filter.addException(_id); // List insertion } else if (this.isListTemplateSearch) { - element.boardId = this.boardId; element.sort = Swimlanes.findOne(this.swimlaneId).lists().count(); element.type = 'list'; - _id = element.copy(this.swimlaneId); + _id = element.copy(this.boardId, this.swimlaneId); } else if (this.isSwimlaneTemplateSearch) { - element.boardId = this.boardId; element.sort = Boards.findOne(this.boardId).swimlanes().count(); element.type = 'swimlalne'; - _id = element.copy(); + _id = element.copy(this.boardId); } else if (this.isBoardTemplateSearch) { board = Boards.findOne(element.linkedId); board.sort = Boards.find({archived: false}).count(); board.type = 'board'; + board.title = element.title; delete board.slug; - delete board.members; _id = board.copy(); } Popup.close(); diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 94666c16..97973f6e 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -207,7 +207,7 @@ "confirm-checklist-delete-dialog": "Are you sure you want to delete checklist?", "copy-card-link-to-clipboard": "Copy card link to clipboard", "linkCardPopup-title": "Link Card", - "searchCardPopup-title": "Search Card", + "searchElementPopup-title": "Search", "copyCardPopup-title": "Copy Card", "copyChecklistToManyCardsPopup-title": "Copy Checklist Template to Many Cards", "copyChecklistToManyCardsPopup-instructions": "Destination Card Titles and Descriptions in this JSON format", diff --git a/models/boards.js b/models/boards.js index 0db2e48e..9a71ede8 100644 --- a/models/boards.js +++ b/models/boards.js @@ -326,8 +326,7 @@ Boards.helpers({ archived: false, }).forEach((swimlane) => { swimlane.type = 'swimlane'; - swimlane.boardId = _id; - swimlane.copy(oldId); + swimlane.copy(_id); }); }, /** diff --git a/models/cards.js b/models/cards.js index c733c7f8..cf64cd9b 100644 --- a/models/cards.js +++ b/models/cards.js @@ -272,13 +272,41 @@ Cards.allow({ }); Cards.helpers({ - copy() { + copy(boardId, swimlaneId, listId) { + const oldBoard = Boards.findOne(this.boardId); + const oldBoardLabels = oldBoard.labels; + // Get old label names + const oldCardLabels = _.pluck(_.filter(oldBoardLabels, (label) => { + return _.contains(this.labelIds, label._id); + }), 'name'); + + const newBoard = Boards.findOne(boardId); + const newBoardLabels = newBoard.labels; + const newCardLabels = _.pluck(_.filter(newBoardLabels, (label) => { + return _.contains(oldCardLabels, label.name); + }), '_id'); + const oldId = this._id; + const oldCard = Cards.findOne(oldId); + delete this._id; + delete this.labelIds; + this.labelIds= newCardLabels; + this.boardId = boardId; + this.swimlaneId = swimlaneId; + this.listId = listId; const _id = Cards.insert(this); + // Copy attachments + oldCard.attachments().forEach((att) => { + att.cardId = _id; + delete att._id; + return Attachments.insert(att); + }); + // copy checklists Checklists.find({cardId: oldId}).forEach((ch) => { + // REMOVE verify copy with arguments ch.copy(_id); }); @@ -286,11 +314,13 @@ Cards.helpers({ Cards.find({parentId: oldId}).forEach((subtask) => { subtask.parentId = _id; subtask._id = null; + // REMOVE verify copy with arguments instead of insert? Cards.insert(subtask); }); // copy card comments CardComments.find({cardId: oldId}).forEach((cmt) => { + // REMOVE verify copy with arguments cmt.copy(_id); }); diff --git a/models/lists.js b/models/lists.js index d76c961c..a8e597ee 100644 --- a/models/lists.js +++ b/models/lists.js @@ -137,12 +137,15 @@ Lists.allow({ }); Lists.helpers({ - copy(swimlaneId) { + copy(boardId, swimlaneId) { const oldId = this._id; const oldSwimlaneId = this.swimlaneId || null; + this.boardId = boardId; + this.swimlaneId = swimlaneId; + let _id = null; existingListWithSameName = Lists.findOne({ - boardId: this.boardId, + boardId, title: this.title, archived: false, }); @@ -160,11 +163,7 @@ Lists.helpers({ listId: oldId, archived: false, }).forEach((card) => { - card.type = 'cardType-card'; - card.listId = _id; - card.boardId = this.boardId; - card.swimlaneId = swimlaneId; - card.copy(); + card.copy(boardId, swimlaneId, _id); }); }, diff --git a/models/swimlanes.js b/models/swimlanes.js index a3427fc6..1b18ba5d 100644 --- a/models/swimlanes.js +++ b/models/swimlanes.js @@ -101,8 +101,10 @@ Swimlanes.allow({ }); Swimlanes.helpers({ - copy(oldBoardId) { + copy(boardId) { const oldId = this._id; + const oldBoardId = this.boardId; + this.boardId = boardId; delete this._id; const _id = Swimlanes.insert(this); @@ -118,8 +120,8 @@ Swimlanes.helpers({ Lists.find(query).forEach((list) => { list.type = 'list'; list.swimlaneId = oldId; - list.boardId = this.boardId; - list.copy(_id); + list.boardId = boardId; + list.copy(boardId, _id); }); }, diff --git a/package.json b/package.json index a17f36c2..b537c694 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wekan", - "version": "v2.29.0", + "version": "v2.30.0", "description": "Open-Source kanban", "private": true, "scripts": { diff --git a/sandstorm-pkgdef.capnp b/sandstorm-pkgdef.capnp index 0d7064c5..cd84a21d 100644 --- a/sandstorm-pkgdef.capnp +++ b/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 = 231, + appVersion = 232, # Increment this for every release. - appMarketingVersion = (defaultText = "2.29.0~2019-02-27"), + appMarketingVersion = (defaultText = "2.30.0~2019-02-28"), # Human-readable presentation of the app version. minUpgradableAppVersion = 0, |