From c3fe70e09433346f25ad3701dca7f07ad441624f Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Mon, 5 Feb 2018 10:49:37 -0500 Subject: added copyManyCard --- client/components/cards/cardDetails.js | 1 + 1 file changed, 1 insertion(+) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 94a938f0..3ae6327b 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -170,6 +170,7 @@ Template.cardDetailsActionsPopup.events({ 'click .js-spent-time': Popup.open('editCardSpentTime'), 'click .js-move-card': Popup.open('moveCard'), 'click .js-copy-card': Popup.open('copyCard'), + 'click .js-copy-many-card': Popup.open('copyManyCard'), 'click .js-move-card-to-top' (evt) { evt.preventDefault(); const minOrder = _.min(this.list().cards().map((c) => c.sort)); -- cgit v1.2.3-1-g7c22 From bb9d5cb69466a78ecbcd832f596602f028ab644c Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Mon, 5 Feb 2018 10:58:36 -0500 Subject: Revert "added copyManyCard" This reverts commit c3fe70e09433346f25ad3701dca7f07ad441624f. --- client/components/cards/cardDetails.js | 1 - 1 file changed, 1 deletion(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 3ae6327b..94a938f0 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -170,7 +170,6 @@ Template.cardDetailsActionsPopup.events({ 'click .js-spent-time': Popup.open('editCardSpentTime'), 'click .js-move-card': Popup.open('moveCard'), 'click .js-copy-card': Popup.open('copyCard'), - 'click .js-copy-many-card': Popup.open('copyManyCard'), 'click .js-move-card-to-top' (evt) { evt.preventDefault(); const minOrder = _.min(this.list().cards().map((c) => c.sort)); -- cgit v1.2.3-1-g7c22 From 3c1cd85f6f961ec19832901a059b072b44d89dc4 Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Mon, 5 Feb 2018 11:02:01 -0500 Subject: added copyManyCard --- client/components/cards/cardDetails.js | 1 + 1 file changed, 1 insertion(+) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 94a938f0..3ae6327b 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -170,6 +170,7 @@ Template.cardDetailsActionsPopup.events({ 'click .js-spent-time': Popup.open('editCardSpentTime'), 'click .js-move-card': Popup.open('moveCard'), 'click .js-copy-card': Popup.open('copyCard'), + 'click .js-copy-many-card': Popup.open('copyManyCard'), 'click .js-move-card-to-top' (evt) { evt.preventDefault(); const minOrder = _.min(this.list().cards().map((c) => c.sort)); -- cgit v1.2.3-1-g7c22 From 60c6f4f5af38712641f90fa139511106f985b078 Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Mon, 5 Feb 2018 11:11:41 -0500 Subject: added Popup --- client/components/cards/cardDetails.js | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 3ae6327b..a2168b29 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -297,6 +297,55 @@ Template.copyCardPopup.events({ }, }); + +Template.copyManyCardPopup.events({ + 'click .js-select-list' (evt) { + const card = Cards.findOne(Session.get('currentCard')); + const oldId = card._id; + card._id = null; + card.listId = this._id; + const list = Lists.findOne(card.listId); + card.boardId = list.boardId; + const textarea = $(evt.currentTarget).parents('.content').find('textarea'); + const title = textarea.val().trim(); + // insert new card to the bottom of new list + card.sort = Lists.findOne(this._id).cards().count(); + + if (title) { + card.title = title; + card.coverId = ''; + const _id = Cards.insert(card); + // In case the filter is active we need to add the newly inserted card in + // the list of exceptions -- cards that are not filtered. Otherwise the + // card will disappear instantly. + // See https://github.com/wekan/wekan/issues/80 + Filter.addException(_id); + + // copy checklists + let cursor = Checklists.find({cardId: oldId}); + cursor.forEach(function() { + 'use strict'; + const checklist = arguments[0]; + checklist.cardId = _id; + checklist._id = null; + Checklists.insert(checklist); + }); + + // copy card comments + cursor = CardComments.find({cardId: oldId}); + cursor.forEach(function () { + 'use strict'; + const comment = arguments[0]; + comment.cardId = _id; + comment._id = null; + CardComments.insert(comment); + }); + Popup.close(); + } + }, +}); + + Template.cardMorePopup.events({ 'click .js-copy-card-link-to-clipboard' () { // Clipboard code from: -- cgit v1.2.3-1-g7c22 From 326b4c53505596497372061f5f67057f0eaf8eca Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Mon, 5 Feb 2018 13:27:47 -0500 Subject: added copyManyCard --- client/components/cards/cardDetails.jade | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 0a7a8cd6..a41c01ce 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -135,6 +135,7 @@ template(name="cardDetailsActionsPopup") ul.pop-over-list li: a.js-move-card {{_ 'moveCardPopup-title'}} li: a.js-copy-card {{_ 'copyCardPopup-title'}} + li: a.js-copy-many-card {{_ 'copyManyCardPopup-title'}} unless archived li: a.js-archive {{_ 'archive-card'}} li: a.js-more {{_ 'cardMorePopup-title'}} @@ -154,6 +155,19 @@ template(name="copyCardPopup") else +boardsAndLists + +template(name="copyManyCardPopup") + label(for='copy-many-card-title') {{_ 'title'}}: + textarea#copy-card-title.minicard-composer-textarea.js-card-title(autofocus) + = title + if isSandstorm + +boardLists + else + +boardsAndLists + +template(name="boardsAndLists") + + template(name="boardsAndLists") select.js-select-boards each boards -- cgit v1.2.3-1-g7c22 From 9705118ca28a0f89043ad86f6a5c9abd1813e594 Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Mon, 5 Feb 2018 14:47:37 -0500 Subject: add titleList.split to copyManyCard --- client/components/cards/cardDetails.js | 51 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 23 deletions(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index a2168b29..83cb9fc3 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -307,41 +307,46 @@ Template.copyManyCardPopup.events({ const list = Lists.findOne(card.listId); card.boardId = list.boardId; const textarea = $(evt.currentTarget).parents('.content').find('textarea'); - const title = textarea.val().trim(); + const titleEntry = textarea.val().trim(); // insert new card to the bottom of new list card.sort = Lists.findOne(this._id).cards().count(); - if (title) { - card.title = title; - card.coverId = ''; - const _id = Cards.insert(card); - // In case the filter is active we need to add the newly inserted card in + if (titleEntry) { + var title, titleList; + + for (let title of titleList.split(",") { + + card.title = title; + card.coverId = ''; + const _id = Cards.insert(card); +// In case the filter is active we need to add the newly inserted card in // the list of exceptions -- cards that are not filtered. Otherwise the // card will disappear instantly. // See https://github.com/wekan/wekan/issues/80 - Filter.addException(_id); + Filter.addException(_id); // copy checklists - let cursor = Checklists.find({cardId: oldId}); - cursor.forEach(function() { - 'use strict'; - const checklist = arguments[0]; - checklist.cardId = _id; - checklist._id = null; - Checklists.insert(checklist); - }); + let cursor = Checklists.find({cardId: oldId}); + cursor.forEach(function() { + 'use strict'; + const checklist = arguments[0]; + checklist.cardId = _id; + checklist._id = null; + Checklists.insert(checklist); + }); // copy card comments - cursor = CardComments.find({cardId: oldId}); - cursor.forEach(function () { - 'use strict'; - const comment = arguments[0]; - comment.cardId = _id; - comment._id = null; - CardComments.insert(comment); - }); + cursor = CardComments.find({cardId: oldId}); + cursor.forEach(function () { + 'use strict'; + const comment = arguments[0]; + comment.cardId = _id; + comment._id = null; + CardComments.insert(comment); + }); Popup.close(); } + } }, }); -- cgit v1.2.3-1-g7c22 From 842c8b83d2b5cb32c54d773f343ac6e82c59ce55 Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Mon, 5 Feb 2018 15:03:21 -0500 Subject: missing ) --- client/components/cards/cardDetails.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 83cb9fc3..e73632cb 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -314,7 +314,7 @@ Template.copyManyCardPopup.events({ if (titleEntry) { var title, titleList; - for (let title of titleList.split(",") { + for (let title of titleList.split(",")) { card.title = title; card.coverId = ''; -- cgit v1.2.3-1-g7c22 From 257ed56db3eefda225a1d2a20ce60458393a4cce Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Thu, 8 Feb 2018 08:13:31 -0500 Subject: finish adding[4~ copyMany --- client/components/cards/cardDetails.jade | 3 --- client/components/cards/cardDetails.js | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index a41c01ce..27de1a6e 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -165,9 +165,6 @@ template(name="copyManyCardPopup") else +boardsAndLists -template(name="boardsAndLists") - - template(name="boardsAndLists") select.js-select-boards each boards diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index e73632cb..e75e7c02 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -313,10 +313,20 @@ Template.copyManyCardPopup.events({ if (titleEntry) { var title, titleList; + console.log(titleEntry); + console.log(titleEntry.length); + var titleList = JSON.parse(titleEntry); + console.log(titleList); + console.log(titleList[0]); + console.log(titleList[0].title); + - for (let title of titleList.split(",")) { + for (var i = 0; i < titleList.length; i++){ + var obj = titleList[i]; + console.log(obj.title); - card.title = title; + card.title = obj.title; + card.description = obj.description; card.coverId = ''; const _id = Cards.insert(card); // In case the filter is active we need to add the newly inserted card in @@ -344,9 +354,9 @@ Template.copyManyCardPopup.events({ comment._id = null; CardComments.insert(comment); }); + } Popup.close(); } - } }, }); -- cgit v1.2.3-1-g7c22 From c5019e620a5371b73affd9d635ceef9d183d6b45 Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Thu, 8 Feb 2018 08:14:33 -0500 Subject: remove console.log statements --- client/components/cards/cardDetails.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index e75e7c02..a487022e 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -312,18 +312,12 @@ Template.copyManyCardPopup.events({ card.sort = Lists.findOne(this._id).cards().count(); if (titleEntry) { - var title, titleList; - console.log(titleEntry); - console.log(titleEntry.length); + var titleList; var titleList = JSON.parse(titleEntry); - console.log(titleList); - console.log(titleList[0]); - console.log(titleList[0].title); for (var i = 0; i < titleList.length; i++){ var obj = titleList[i]; - console.log(obj.title); card.title = obj.title; card.description = obj.description; -- cgit v1.2.3-1-g7c22 From ecd77c87049a5b3e7e9b3edc8867944c14aa4319 Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Thu, 8 Feb 2018 10:13:54 -0500 Subject: fixed spacing & indentation - changed var to const --- client/components/cards/cardDetails.js | 68 ++++++++++++++++------------------ 1 file changed, 32 insertions(+), 36 deletions(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index a487022e..35081679 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -312,43 +312,39 @@ Template.copyManyCardPopup.events({ card.sort = Lists.findOne(this._id).cards().count(); if (titleEntry) { - var titleList; - var titleList = JSON.parse(titleEntry); - - + const titleList = JSON.parse(titleEntry); for (var i = 0; i < titleList.length; i++){ - var obj = titleList[i]; - - card.title = obj.title; - card.description = obj.description; - card.coverId = ''; - const _id = Cards.insert(card); -// In case the filter is active we need to add the newly inserted card in - // the list of exceptions -- cards that are not filtered. Otherwise the - // card will disappear instantly. - // See https://github.com/wekan/wekan/issues/80 - Filter.addException(_id); - - // copy checklists - let cursor = Checklists.find({cardId: oldId}); - cursor.forEach(function() { - 'use strict'; - const checklist = arguments[0]; - checklist.cardId = _id; - checklist._id = null; - Checklists.insert(checklist); - }); - - // copy card comments - cursor = CardComments.find({cardId: oldId}); - cursor.forEach(function () { - 'use strict'; - const comment = arguments[0]; - comment.cardId = _id; - comment._id = null; - CardComments.insert(comment); - }); - } + let obj = titleList[i]; + card.title = obj.title; + card.description = obj.description; + card.coverId = ''; + const _id = Cards.insert(card); + // In case the filter is active we need to add the newly inserted card in + // the list of exceptions -- cards that are not filtered. Otherwise the + // card will disappear instantly. + // See https://github.com/wekan/wekan/issues/80 + Filter.addException(_id); + + // copy checklists + let cursor = Checklists.find({cardId: oldId}); + cursor.forEach(function() { + 'use strict'; + const checklist = arguments[0]; + checklist.cardId = _id; + checklist._id = null; + Checklists.insert(checklist); + }); + + // copy card comments + cursor = CardComments.find({cardId: oldId}); + cursor.forEach(function () { + 'use strict'; + const comment = arguments[0]; + comment.cardId = _id; + comment._id = null; + CardComments.insert(comment); + }); + } Popup.close(); } }, -- cgit v1.2.3-1-g7c22 From 0a5af2b719fc2a559a92b2173681df697d3f9158 Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Thu, 8 Feb 2018 10:32:09 -0500 Subject: more spacing/tabs fixes --- client/components/cards/cardDetails.js | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 35081679..f117a264 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -313,36 +313,36 @@ Template.copyManyCardPopup.events({ if (titleEntry) { const titleList = JSON.parse(titleEntry); - for (var i = 0; i < titleList.length; i++){ - let obj = titleList[i]; + for (let i = 0; i < titleList.length; i++){ + const obj = titleList[i]; card.title = obj.title; - card.description = obj.description; - card.coverId = ''; - const _id = Cards.insert(card); + card.description = obj.description; + card.coverId = ''; + const _id = Cards.insert(card); // In case the filter is active we need to add the newly inserted card in // the list of exceptions -- cards that are not filtered. Otherwise the // card will disappear instantly. // See https://github.com/wekan/wekan/issues/80 - Filter.addException(_id); + Filter.addException(_id); // copy checklists - let cursor = Checklists.find({cardId: oldId}); - cursor.forEach(function() { - 'use strict'; - const checklist = arguments[0]; - checklist.cardId = _id; - checklist._id = null; - Checklists.insert(checklist); + let cursor = Checklists.find({cardId: oldId}); + cursor.forEach(function() { + 'use strict'; + const checklist = arguments[0]; + checklist.cardId = _id; + checklist._id = null; + Checklists.insert(checklist); }); // copy card comments - cursor = CardComments.find({cardId: oldId}); - cursor.forEach(function () { - 'use strict'; - const comment = arguments[0]; - comment.cardId = _id; - comment._id = null; - CardComments.insert(comment); + cursor = CardComments.find({cardId: oldId}); + cursor.forEach(function () { + 'use strict'; + const comment = arguments[0]; + comment.cardId = _id; + comment._id = null; + CardComments.insert(comment); }); } Popup.close(); -- cgit v1.2.3-1-g7c22 From 11b8e12ede3c29e39246df5e4dd5ca3abe88ec2c Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Thu, 8 Feb 2018 13:11:20 -0500 Subject: spaces/tabs okay - no 'git add i18n/en-GB.i18n.json' --- client/components/cards/cardDetails.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 9e08e248..1ea23a69 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -333,7 +333,7 @@ Template.copyManyCardPopup.events({ checklist.cardId = _id; checklist._id = null; Checklists.insert(checklist); - }); + }); // copy card comments cursor = CardComments.find({cardId: oldId}); @@ -343,7 +343,7 @@ Template.copyManyCardPopup.events({ comment.cardId = _id; comment._id = null; CardComments.insert(comment); - }); + }); } Popup.close(); } -- cgit v1.2.3-1-g7c22 From 756fbd0f4cf6a14d1ac811723f0a90a42c7e21a1 Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Wed, 14 Feb 2018 15:18:54 -0500 Subject: i18n fixes --- client/components/cards/cardDetails.jade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 27de1a6e..3e410123 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -157,9 +157,9 @@ template(name="copyCardPopup") template(name="copyManyCardPopup") - label(for='copy-many-card-title') {{_ 'title'}}: + label(for='copy-many-card-title') {{_ 'copyManyCardPopup-instructions'}}: textarea#copy-card-title.minicard-composer-textarea.js-card-title(autofocus) - = title + {{_ 'copyManyCardPopup-format'}} if isSandstorm +boardLists else -- cgit v1.2.3-1-g7c22 From 25e0c38ad8fac2cccf3d7c29b689f23fdafa786c Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Thu, 15 Feb 2018 11:55:15 -0500 Subject: change copyMany to copyChecklistToManyCards for instructions and title --- client/components/cards/cardDetails.jade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 3e410123..51f7f3f7 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -157,9 +157,9 @@ template(name="copyCardPopup") template(name="copyManyCardPopup") - label(for='copy-many-card-title') {{_ 'copyManyCardPopup-instructions'}}: + label(for='copy-many-card-title') {{_ 'copyChecklistToManyCardsPopup-instructions'}}: textarea#copy-card-title.minicard-composer-textarea.js-card-title(autofocus) - {{_ 'copyManyCardPopup-format'}} + | {{_ 'copyChecklistToManyCardsPopup-format'}} if isSandstorm +boardLists else -- cgit v1.2.3-1-g7c22 From cfaeb43f1f8e55ab1d6373ba06551ca281258ac4 Mon Sep 17 00:00:00 2001 From: Erik Turk Date: Thu, 15 Feb 2018 15:26:19 -0500 Subject: changed variable names --- client/components/cards/cardDetails.jade | 6 +++--- client/components/cards/cardDetails.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'client/components') diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 51f7f3f7..81f571d6 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -135,7 +135,7 @@ template(name="cardDetailsActionsPopup") ul.pop-over-list li: a.js-move-card {{_ 'moveCardPopup-title'}} li: a.js-copy-card {{_ 'copyCardPopup-title'}} - li: a.js-copy-many-card {{_ 'copyManyCardPopup-title'}} + li: a.js-copy-checklist-cards {{_ 'copyChecklistToManyCardsPopup-title'}} unless archived li: a.js-archive {{_ 'archive-card'}} li: a.js-more {{_ 'cardMorePopup-title'}} @@ -156,8 +156,8 @@ template(name="copyCardPopup") +boardsAndLists -template(name="copyManyCardPopup") - label(for='copy-many-card-title') {{_ 'copyChecklistToManyCardsPopup-instructions'}}: +template(name="copyChecklistToManyCardsPopup") + label(for='copy-checklist-cards-title') {{_ 'copyChecklistToManyCardsPopup-instructions'}}: textarea#copy-card-title.minicard-composer-textarea.js-card-title(autofocus) | {{_ 'copyChecklistToManyCardsPopup-format'}} if isSandstorm diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 1ea23a69..d72f46d4 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -170,7 +170,7 @@ Template.cardDetailsActionsPopup.events({ 'click .js-spent-time': Popup.open('editCardSpentTime'), 'click .js-move-card': Popup.open('moveCard'), 'click .js-copy-card': Popup.open('copyCard'), - 'click .js-copy-many-card': Popup.open('copyManyCard'), + 'click .js-copy-checklist-cards': Popup.open('copyChecklistToManyCards'), 'click .js-move-card-to-top' (evt) { evt.preventDefault(); const minOrder = _.min(this.list().cards(this.swimlaneId).map((c) => c.sort)); @@ -298,7 +298,7 @@ Template.copyCardPopup.events({ }); -Template.copyManyCardPopup.events({ +Template.copyChecklistToManyCardsPopup.events({ 'click .js-select-list' (evt) { const card = Cards.findOne(Session.get('currentCard')); const oldId = card._id; -- cgit v1.2.3-1-g7c22