diff options
author | Andrés Manelli <andresmanelli@gmail.com> | 2019-02-23 23:07:54 +0100 |
---|---|---|
committer | Andrés Manelli <andresmanelli@gmail.com> | 2019-02-24 00:05:00 +0100 |
commit | 60be4df76e02afdf4dd62f8e03505d55c0ed119e (patch) | |
tree | 73d22fb7d30eb738ffd876762f1a20f28ce623a2 /client | |
parent | f888cfd565b197903c24a07221f6a6a44e1b6223 (diff) | |
download | wekan-60be4df76e02afdf4dd62f8e03505d55c0ed119e.tar.gz wekan-60be4df76e02afdf4dd62f8e03505d55c0ed119e.tar.bz2 wekan-60be4df76e02afdf4dd62f8e03505d55c0ed119e.zip |
Allow swimlane creation from template
Mix lists with same name to avoid duplicates
Diffstat (limited to 'client')
-rw-r--r-- | client/components/cards/cardDetails.jade | 3 | ||||
-rw-r--r-- | client/components/cards/cardDetails.js | 3 | ||||
-rw-r--r-- | client/components/lists/listBody.jade | 5 | ||||
-rw-r--r-- | client/components/lists/listBody.js | 19 | ||||
-rw-r--r-- | client/components/swimlanes/swimlaneHeader.jade | 5 | ||||
-rw-r--r-- | client/components/swimlanes/swimlaneHeader.js | 1 | ||||
-rw-r--r-- | client/components/swimlanes/swimlanes.js | 8 |
7 files changed, 24 insertions, 20 deletions
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 4d9b2e08..25316d04 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -247,9 +247,6 @@ template(name="cardDetailsActionsPopup") unless archived li: a.js-archive {{_ 'archive-card'}} li: a.js-more {{_ 'cardMorePopup-title'}} - hr - ul.pop-over-list - li: a.js-template-card {{_ 'cardTemplatePopup-title'}} template(name="moveCardPopup") +boardsAndLists diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 1281356d..73a7a67d 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -365,9 +365,6 @@ Template.cardDetailsActionsPopup.events({ if (!err && ret) Popup.close(); }); }, - 'click .js-template-card' () { - console.log('REMOVE Creating template card'); - }, }); Template.editCardTitleForm.onRendered(function () { diff --git a/client/components/lists/listBody.jade b/client/components/lists/listBody.jade index 46f90f99..fcc28777 100644 --- a/client/components/lists/listBody.jade +++ b/client/components/lists/listBody.jade @@ -91,7 +91,7 @@ template(name="linkCardPopup") unless isSandstorm input.primary.confirm.js-done(type="button" value="{{_ 'link'}}") -template(name="searchCardPopup") +template(name="searchElementPopup") unless isTemplateSearch label {{_ 'boards'}}: .link-board-wrapper @@ -110,6 +110,9 @@ template(name="searchCardPopup") if isSwimlaneTemplateSearch a.minicard-wrapper.js-minicard +miniswimlane(this) + if isCardTemplateSearch + a.minicard-wrapper.js-minicard + +minicard(this) unless isTemplateSearch a.minicard-wrapper.js-minicard +minicard(this) diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index ad34efef..f8634c0b 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -315,8 +315,8 @@ BlazeComponent.extendComponent({ return [{ keydown: this.pressKey, 'click .js-link': Popup.open('linkCard'), - 'click .js-search': Popup.open('searchCard'), - 'click .js-search-template': Popup.open('searchCard'), + 'click .js-search': Popup.open('searchElement'), + 'click .js-card-template': Popup.open('searchElement'), }]; }, @@ -526,7 +526,7 @@ BlazeComponent.extendComponent({ onCreated() { this.isCardTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-card-template'); this.isListTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-list-template'); - this.isSwimlaneTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-swimlane-template'); + this.isSwimlaneTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-open-add-swimlane-menu'); this.isTemplateSearch = this.isCardTemplateSearch || this.isListTemplateSearch || this.isSwimlaneTemplateSearch; let board = {}; if (this.isTemplateSearch) { @@ -551,14 +551,13 @@ BlazeComponent.extendComponent({ this.boardId = Session.get('currentBoard'); // In order to get current board info subManager.subscribe('board', this.boardId); - board = Boards.findOne(this.boardId); // List where to insert card const list = $(Popup._getTopStack().openerElement).closest('.js-list'); this.listId = Blaze.getData(list[0])._id; // Swimlane where to insert card - const swimlane = $(Popup._getTopStack().openerElement).closest('.js-swimlane'); + const swimlane = $(Popup._getTopStack().openerElement).parents('.js-swimlane'); this.swimlaneId = ''; - if (board.view === 'board-view-swimlanes') + if (Meteor.user().profile.boardView === 'board-view-swimlanes') this.swimlaneId = Blaze.getData(swimlane[0])._id; else this.swimlaneId = Swimlanes.findOne({boardId: this.boardId})._id; @@ -606,7 +605,6 @@ BlazeComponent.extendComponent({ 'click .js-minicard'(evt) { // 0. Common let element = Blaze.getData(evt.currentTarget); - console.log(element); element.boardId = this.boardId; let _id = ''; if (!this.isTemplateSearch || this.isCardTemplateSearch) { @@ -630,14 +628,17 @@ BlazeComponent.extendComponent({ Filter.addException(_id); // List insertion } else if (this.isListTemplateSearch) { - element.swimlaneId = ''; element.sort = Swimlanes.findOne(this.swimlaneId).lists().count(); element.type = 'list'; element.swimlaneId = this.swimlaneId; _id = element.copy(); + } else if (this.isSwimlaneTemplateSearch) { + element.sort = Boards.findOne(this.boardId).swimlanes().count(); + element.type = 'swimlalne'; + _id = element.copy(); } Popup.close(); }, }]; }, -}).register('searchCardPopup'); +}).register('searchElementPopup'); diff --git a/client/components/swimlanes/swimlaneHeader.jade b/client/components/swimlanes/swimlaneHeader.jade index 810dd57f..de9621d5 100644 --- a/client/components/swimlanes/swimlaneHeader.jade +++ b/client/components/swimlanes/swimlaneHeader.jade @@ -40,6 +40,11 @@ template(name="swimlaneAddPopup") autocomplete="off" autofocus) .edit-controls.clearfix button.primary.confirm(type="submit") {{_ 'add'}} + unless currentBoard.isTemplatesBoard + unless currentBoard.isTemplateBoard + span.quiet + | {{_ 'or'}} + a.js-swimlane-template {{_ 'template'}} template(name="setSwimlaneColorPopup") form.edit-label diff --git a/client/components/swimlanes/swimlaneHeader.js b/client/components/swimlanes/swimlaneHeader.js index b78bdc96..e7f3cc76 100644 --- a/client/components/swimlanes/swimlaneHeader.js +++ b/client/components/swimlanes/swimlaneHeader.js @@ -65,6 +65,7 @@ BlazeComponent.extendComponent({ // with a minimum of interactions Popup.close(); }, + 'click .js-swimlane-template': Popup.open('searchElement'), }]; }, }).register('swimlaneAddPopup'); diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index bdaed81d..b4277d4f 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -154,8 +154,8 @@ BlazeComponent.extendComponent({ BlazeComponent.extendComponent({ onCreated() { - currentBoard = Boards.findOne(Session.get('currentBoard')); - this.isListTemplatesSwimlane = currentBoard.isTemplatesBoard() && this.currentData().isListTemplatesSwimlane(); + this.currentBoard = Boards.findOne(Session.get('currentBoard')); + this.isListTemplatesSwimlane = this.currentBoard.isTemplatesBoard() && this.currentData().isListTemplatesSwimlane(); this.currentSwimlane = this.currentData(); }, @@ -176,14 +176,14 @@ BlazeComponent.extendComponent({ boardId: Session.get('currentBoard'), sort: $('.list').length, type: (this.isListTemplatesSwimlane)?'template-list':'list', - swimlaneId: (this.isListTemplatesSwimlane)?this.currentSwimlane._id:'', + swimlaneId: (this.currentBoard.isTemplatesBoard())?this.currentSwimlane._id:'', }); titleInput.value = ''; titleInput.focus(); } }, - 'click .js-list-template': Popup.open('searchCard'), + 'click .js-list-template': Popup.open('searchElement'), }]; }, }).register('addListForm'); |