mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 00:10:13 +01:00
Fix #1567
This commit is contained in:
parent
c12e003fd3
commit
e5995477b8
8 changed files with 44 additions and 38 deletions
|
|
@ -87,15 +87,13 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isViewSwimlanes() {
|
isViewSwimlanes() {
|
||||||
const currentBoardId = Session.get('currentBoard');
|
const currentUser = Meteor.user();
|
||||||
const board = Boards.findOne(currentBoardId);
|
return (currentUser.profile.boardView === 'board-view-swimlanes');
|
||||||
return (board.view === 'board-view-swimlanes');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isViewLists() {
|
isViewLists() {
|
||||||
const currentBoardId = Session.get('currentBoard');
|
const currentUser = Meteor.user();
|
||||||
const board = Boards.findOne(currentBoardId);
|
return (currentUser.profile.boardView === 'board-view-lists');
|
||||||
return (board.view === 'board-view-lists');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
openNewListForm() {
|
openNewListForm() {
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ template(name="boardHeaderBar")
|
||||||
a.board-header-btn.js-toggle-board-view(
|
a.board-header-btn.js-toggle-board-view(
|
||||||
title="{{_ 'board-view'}}")
|
title="{{_ 'board-view'}}")
|
||||||
i.fa.fa-th-large
|
i.fa.fa-th-large
|
||||||
span {{_ currentBoard.view}}
|
span {{_ currentUser.profile.boardView}}
|
||||||
|
|
||||||
if canModifyBoard
|
if canModifyBoard
|
||||||
a.board-header-btn.js-multiselection-activate(
|
a.board-header-btn.js-multiselection-activate(
|
||||||
|
|
|
||||||
|
|
@ -77,19 +77,11 @@ BlazeComponent.extendComponent({
|
||||||
Modal.open('archivedBoards');
|
Modal.open('archivedBoards');
|
||||||
},
|
},
|
||||||
'click .js-toggle-board-view'() {
|
'click .js-toggle-board-view'() {
|
||||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
const currentUser = Meteor.user();
|
||||||
if (currentBoard.view === 'board-view-swimlanes') {
|
if (currentUser.profile.boardView === 'board-view-swimlanes') {
|
||||||
Boards.update(currentBoard._id, {
|
currentUser.setBoardView('board-view-lists');
|
||||||
$set: {
|
} else if (currentUser.profile.boardView === 'board-view-lists') {
|
||||||
view: 'board-view-lists',
|
currentUser.setBoardView('board-view-swimlanes');
|
||||||
},
|
|
||||||
});
|
|
||||||
} else if (currentBoard.view === 'board-view-lists') {
|
|
||||||
Boards.update(currentBoard._id, {
|
|
||||||
$set: {
|
|
||||||
view: 'board-view-swimlanes',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'click .js-open-filter-view'() {
|
'click .js-open-filter-view'() {
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,11 @@ BlazeComponent.extendComponent({
|
||||||
const labelIds = formComponent.labels.get();
|
const labelIds = formComponent.labels.get();
|
||||||
|
|
||||||
const boardId = this.data().board()._id;
|
const boardId = this.data().board()._id;
|
||||||
const board = Boards.findOne(boardId);
|
|
||||||
let swimlaneId = '';
|
let swimlaneId = '';
|
||||||
if (board.view === 'board-view-swimlanes')
|
const boardView = Meteor.user().profile.boardView;
|
||||||
|
if (boardView === 'board-view-swimlanes')
|
||||||
swimlaneId = this.parentComponent().parentComponent().data()._id;
|
swimlaneId = this.parentComponent().parentComponent().data()._id;
|
||||||
else
|
else if (boardView === 'board-view-lists')
|
||||||
swimlaneId = Swimlanes.findOne({boardId})._id;
|
swimlaneId = Swimlanes.findOne({boardId})._id;
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
|
|
@ -106,8 +106,8 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
idOrNull(swimlaneId) {
|
idOrNull(swimlaneId) {
|
||||||
const board = Boards.findOne(Session.get('currentBoard'));
|
const currentUser = Meteor.user();
|
||||||
if (board.view === 'board-view-swimlanes')
|
if (currentUser.profile.boardView === 'board-view-swimlanes')
|
||||||
return swimlaneId;
|
return swimlaneId;
|
||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,10 @@ const { calculateIndex } = Utils;
|
||||||
|
|
||||||
function currentCardIsInThisList(listId, swimlaneId) {
|
function currentCardIsInThisList(listId, swimlaneId) {
|
||||||
const currentCard = Cards.findOne(Session.get('currentCard'));
|
const currentCard = Cards.findOne(Session.get('currentCard'));
|
||||||
const currentBoardId = Session.get('currentBoard');
|
const currentUser = Meteor.user();
|
||||||
const board = Boards.findOne(currentBoardId);
|
if (currentUser.profile.boardView === 'board-view-lists')
|
||||||
if (board.view === 'board-view-lists')
|
|
||||||
return currentCard && currentCard.listId === listId;
|
return currentCard && currentCard.listId === listId;
|
||||||
else if (board.view === 'board-view-swimlanes')
|
else if (currentUser.profile.boardView === 'board-view-swimlanes')
|
||||||
return currentCard && currentCard.listId === listId && currentCard.swimlaneId === swimlaneId;
|
return currentCard && currentCard.listId === listId && currentCard.swimlaneId === swimlaneId;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,6 @@ Boards.attachSchema(new SimpleSchema({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
view: {
|
|
||||||
type: String,
|
|
||||||
autoValue() { // eslint-disable-line consistent-return
|
|
||||||
if (this.isInsert) {
|
|
||||||
return 'board-view-lists';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
createdAt: {
|
createdAt: {
|
||||||
type: Date,
|
type: Date,
|
||||||
autoValue() { // eslint-disable-line consistent-return
|
autoValue() { // eslint-disable-line consistent-return
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,9 @@ Users.attachSchema(new SimpleSchema({
|
||||||
optional: true,
|
optional: true,
|
||||||
autoValue() { // eslint-disable-line consistent-return
|
autoValue() { // eslint-disable-line consistent-return
|
||||||
if (this.isInsert && !this.isSet) {
|
if (this.isInsert && !this.isSet) {
|
||||||
return {};
|
return {
|
||||||
|
boardView: 'board-view-lists',
|
||||||
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -95,6 +97,10 @@ Users.attachSchema(new SimpleSchema({
|
||||||
type: String,
|
type: String,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
'profile.boardView': {
|
||||||
|
type: String,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
services: {
|
services: {
|
||||||
type: Object,
|
type: Object,
|
||||||
optional: true,
|
optional: true,
|
||||||
|
|
@ -329,6 +335,14 @@ Users.mutations({
|
||||||
setShowCardsCountAt(limit) {
|
setShowCardsCountAt(limit) {
|
||||||
return {$set: {'profile.showCardsCountAt': limit}};
|
return {$set: {'profile.showCardsCountAt': limit}};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setBoardView(view) {
|
||||||
|
return {
|
||||||
|
$set : {
|
||||||
|
'profile.boardView': view,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
|
|
|
||||||
|
|
@ -208,3 +208,14 @@ Migrations.add('add-checklist-items', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Migrations.add('add-profile-view', () => {
|
||||||
|
Users.find().forEach((user) => {
|
||||||
|
// Set default view
|
||||||
|
Users.direct.update(
|
||||||
|
{ _id: user._id },
|
||||||
|
{ $set: { 'profile.boardView': 'board-view-lists' } },
|
||||||
|
noValidate
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue