diff options
author | Andrés Manelli <andresmanelli@gmail.com> | 2018-01-22 23:35:23 -0300 |
---|---|---|
committer | Andrés Manelli <andresmanelli@gmail.com> | 2018-01-22 23:35:23 -0300 |
commit | 7b04f14e3c33db0b1c3ecff003262e7689383a15 (patch) | |
tree | 46a80202086eb247982595effa0746439a27efe5 | |
parent | a14f4ffee297872c72edc99d7b147d18802f7d44 (diff) | |
download | wekan-7b04f14e3c33db0b1c3ecff003262e7689383a15.tar.gz wekan-7b04f14e3c33db0b1c3ecff003262e7689383a15.tar.bz2 wekan-7b04f14e3c33db0b1c3ecff003262e7689383a15.zip |
Allow toogle of lists and swimlanes views
-rw-r--r-- | client/components/boards/boardBody.jade | 7 | ||||
-rw-r--r-- | client/components/boards/boardBody.js | 12 | ||||
-rw-r--r-- | client/components/boards/boardHeader.js | 4 | ||||
-rw-r--r-- | client/components/lists/listBody.jade | 2 | ||||
-rw-r--r-- | client/components/lists/listBody.js | 7 | ||||
-rw-r--r-- | client/components/swimlanes/swimlanes.jade | 18 | ||||
-rw-r--r-- | models/lists.js | 9 |
7 files changed, 51 insertions, 8 deletions
diff --git a/client/components/boards/boardBody.jade b/client/components/boards/boardBody.jade index e00794f3..30e70b31 100644 --- a/client/components/boards/boardBody.jade +++ b/client/components/boards/boardBody.jade @@ -20,5 +20,8 @@ template(name="boardBody") class="{{#if draggingActive.get}}is-dragging-active{{/if}}") if showOverlay.get .board-overlay - each currentBoard.swimlanes - +swimlane(this) + if isViewSwimlanes + each currentBoard.swimlanes + +swimlane(this) + if isViewLists + +listsGroup diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 02174849..a068dd04 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -47,6 +47,18 @@ BlazeComponent.extendComponent({ return Utils.isMiniScreen() && Session.get('currentCard'); }, + isViewSwimlanes() { + const currentBoardId = Session.get('currentBoard'); + const board = Boards.findOne(currentBoardId); + return (board.view === 'board-view-swimlanes'); + }, + + isViewLists() { + const currentBoardId = Session.get('currentBoard'); + const board = Boards.findOne(currentBoardId); + return (board.view === 'board-view-lists'); + }, + events() { return [{ // XXX The board-overlay div should probably be moved to the parent diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index 4cc582b1..67b05446 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -82,13 +82,13 @@ BlazeComponent.extendComponent({ Boards.update(currentBoard._id, { $set: { view: 'board-view-lists', - } + }, }); } else if (currentBoard.view === 'board-view-lists') { Boards.update(currentBoard._id, { $set: { view: 'board-view-swimlanes', - } + }, }); } }, diff --git a/client/components/lists/listBody.jade b/client/components/lists/listBody.jade index abe0298b..32c6b278 100644 --- a/client/components/lists/listBody.jade +++ b/client/components/lists/listBody.jade @@ -4,7 +4,7 @@ template(name="listBody") if cards.count +inlinedForm(autoclose=false position="top") +addCardForm(listId=_id position="top") - each cards ../../_id + each (cards (idOrNull ../../_id)) a.minicard-wrapper.js-minicard(href=absoluteUrl class="{{#if cardIsSelected}}is-selected{{/if}}" class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 0911f828..2ca654b2 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -98,6 +98,13 @@ BlazeComponent.extendComponent({ MultiSelection.toggle(this.currentData()._id); }, + idOrNull(swimlaneId) { + const board = Boards.findOne(Session.get('currentBoard')); + if (board.view === 'board-view-swimlanes') + return swimlaneId; + return undefined; + }, + canSeeAddCard() { return !this.reachedWipLimit() && Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly(); }, diff --git a/client/components/swimlanes/swimlanes.jade b/client/components/swimlanes/swimlanes.jade index e3b6b6d7..77afa399 100644 --- a/client/components/swimlanes/swimlanes.jade +++ b/client/components/swimlanes/swimlanes.jade @@ -20,6 +20,24 @@ template(name="swimlane") +addListForm +addListAndSwimlaneForm +template(name="listsGroup") + .swimlane.js-lists + if isMiniScreen + if currentList + +list(currentList) + else + each currentBoard.lists + +miniList(this) + if currentUser.isBoardMember + +addListForm + else + each currentBoard.lists + +list(this) + if currentCardIsInThisList + +cardDetails(currentCard) + if currentUser.isBoardMember + +addListForm + template(name="addListAndSwimlaneForm") .list.js-list.list-composer.js-list-composer .list-header diff --git a/models/lists.js b/models/lists.js index e6bbfa00..7ed27361 100644 --- a/models/lists.js +++ b/models/lists.js @@ -76,11 +76,14 @@ Lists.allow({ Lists.helpers({ cards(swimlaneId) { - return Cards.find(Filter.mongoSelector({ + const selector = { listId: this._id, archived: false, - swimlaneId: swimlaneId, - }), { sort: ['sort'] }); + }; + if (swimlaneId) + selector.swimlaneId = swimlaneId; + return Cards.find(Filter.mongoSelector(selector, + { sort: ['sort'] })); }, allCards() { |