From 8c3322f9a93c321e8a2cc5cfcd4b1d6316a5fb7c Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Mon, 8 Jun 2020 17:28:53 +0300 Subject: Change default view to Swimlanes. Thanks to xet7 ! --- client/components/boards/boardHeader.jade | 2 +- client/components/swimlanes/swimlanes.js | 11 +++++++++-- models/users.js | 8 ++++---- server/migrations.js | 26 +++++++++++++------------- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index 4c0edac4..a8bdc8c5 100644 --- a/client/components/boards/boardHeader.jade +++ b/client/components/boards/boardHeader.jade @@ -105,7 +105,7 @@ template(name="boardHeaderBar") i.fa.fa-th-large if $eq boardView 'board-view-cal' i.fa.fa-calendar - span {{#if boardView}}{{_ boardView}}{{else}}{{_ 'board-view-lists'}}{{/if}} + span {{#if boardView}}{{_ boardView}}{{else}}{{_ 'board-view-swimlanes'}}{{/if}} if canModifyBoard a.board-header-btn.js-multiselection-activate( diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index 753fa88b..bfb07530 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -23,8 +23,15 @@ function currentCardIsInThisList(listId, swimlaneId) { currentCard.listId === listId && currentCard.swimlaneId === swimlaneId ); - // Default view: board-view-lists - else return currentCard && currentCard.listId === listId; + // OLD: Default view: board-view-lists + ////else return currentCard && currentCard.listId === listId; + // NEW: Default view: board-view-swimlanes +else return ( + currentCard && + currentCard.listId === listId && + currentCard.swimlaneId === swimlaneId +); + // https://github.com/wekan/wekan/issues/1623 // https://github.com/ChronikEwok/wekan/commit/cad9b20451bb6149bfb527a99b5001873b06c3de // TODO: In public board, if you would like to switch between List/Swimlane view, you could diff --git a/models/users.js b/models/users.js index 976e5068..679d4815 100644 --- a/models/users.js +++ b/models/users.js @@ -95,7 +95,7 @@ Users.attachSchema( autoValue() { if (this.isInsert && !this.isSet) { return { - boardView: 'board-view-lists', + boardView: 'board-view-swimlanes', }; } }, @@ -218,8 +218,8 @@ Users.attachSchema( type: String, optional: true, allowedValues: [ - 'board-view-lists', 'board-view-swimlanes', + 'board-view-lists', 'board-view-cal', ], }, @@ -903,7 +903,7 @@ if (Meteor.isServer) { user.profile = { initials, fullname: user.services.oidc.fullname, - boardView: 'board-view-lists', + boardView: 'board-view-swimlanes', }; user.authenticationMethod = 'oauth2'; @@ -961,7 +961,7 @@ if (Meteor.isServer) { ); } else { user.profile = { icode: options.profile.invitationcode }; - user.profile.boardView = 'board-view-lists'; + user.profile.boardView = 'board-view-swimlanes'; // Deletes the invitation code after the user was created successfully. setTimeout( diff --git a/server/migrations.js b/server/migrations.js index 5655bd1d..85d10c8e 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -246,19 +246,6 @@ Migrations.add('add-checklist-items', () => { }); }); -Migrations.add('add-profile-view', () => { - Users.find().forEach(user => { - if (!user.hasOwnProperty('profile.boardView')) { - // Set default view - Users.direct.update( - { _id: user._id }, - { $set: { 'profile.boardView': 'board-view-lists' } }, - noValidate, - ); - } - }); -}); - Migrations.add('add-card-types', () => { Cards.find().forEach(card => { Cards.direct.update( @@ -1044,3 +1031,16 @@ Migrations.add('add-sort-field-to-boards', () => { } }); }); + +Migrations.add('add-default-profile-view', () => { + Users.find().forEach(user => { + if (!user.hasOwnProperty('profile.boardView')) { + // Set default view + Users.direct.update( + { _id: user._id }, + { $set: { 'profile.boardView': 'board-view-swimlanes' } }, + noValidate, + ); + } + }); +}); -- cgit v1.2.3-1-g7c22