mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
implement getDefaultSwimline for boards
This commit is contained in:
parent
aead18eb58
commit
04745f0c2f
4 changed files with 15 additions and 11 deletions
|
|
@ -16,7 +16,7 @@ BlazeComponent.extendComponent({
|
||||||
const crtBoard = Boards.findOne(card.boardId);
|
const crtBoard = Boards.findOne(card.boardId);
|
||||||
const targetBoard = crtBoard.getDefaultSubtasksBoard();
|
const targetBoard = crtBoard.getDefaultSubtasksBoard();
|
||||||
const listId = targetBoard.getDefaultSubtasksListId();
|
const listId = targetBoard.getDefaultSubtasksListId();
|
||||||
const swimlaneId = Swimlanes.findOne({boardId: targetBoard._id})._id;
|
const swimlaneId = targetBoard.getDefaultSwimline()._id;
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
const _id = Cards.insert({
|
const _id = Cards.insert({
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ BlazeComponent.extendComponent({
|
||||||
if (boardView === 'board-view-swimlanes')
|
if (boardView === 'board-view-swimlanes')
|
||||||
swimlaneId = this.parentComponent().parentComponent().data()._id;
|
swimlaneId = this.parentComponent().parentComponent().data()._id;
|
||||||
else if (boardView === 'board-view-lists')
|
else if (boardView === 'board-view-lists')
|
||||||
swimlaneId = Swimlanes.findOne({boardId})._id;
|
swimlaneId = this.data().board().getDefaultSwimline()._id;
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
const _id = Cards.insert({
|
const _id = Cards.insert({
|
||||||
|
|
|
||||||
|
|
@ -337,6 +337,18 @@ Boards.helpers({
|
||||||
getDefaultSubtasksList() {
|
getDefaultSubtasksList() {
|
||||||
return Lists.findOne(this.getDefaultSubtasksListId());
|
return Lists.findOne(this.getDefaultSubtasksListId());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDefaultSwimline() {
|
||||||
|
let result = Swimlanes.findOne({boardId: this._id});
|
||||||
|
if (result === undefined) {
|
||||||
|
Swimlanes.insert({
|
||||||
|
title: TAPi18n.__('default'),
|
||||||
|
boardId: this._id,
|
||||||
|
});
|
||||||
|
result = Swimlanes.findOne({boardId: this._id});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,15 +154,7 @@ Migrations.add('add-sort-checklists', () => {
|
||||||
|
|
||||||
Migrations.add('add-swimlanes', () => {
|
Migrations.add('add-swimlanes', () => {
|
||||||
Boards.find().forEach((board) => {
|
Boards.find().forEach((board) => {
|
||||||
const swimlane = Swimlanes.findOne({ boardId: board._id });
|
const swimlaneId = board.getDefaultSwimline()._id;
|
||||||
let swimlaneId = '';
|
|
||||||
if (swimlane)
|
|
||||||
swimlaneId = swimlane._id;
|
|
||||||
else
|
|
||||||
swimlaneId = Swimlanes.direct.insert({
|
|
||||||
boardId: board._id,
|
|
||||||
title: 'Default',
|
|
||||||
});
|
|
||||||
|
|
||||||
Cards.find({ boardId: board._id }).forEach((card) => {
|
Cards.find({ boardId: board._id }).forEach((card) => {
|
||||||
if (!card.hasOwnProperty('swimlaneId')) {
|
if (!card.hasOwnProperty('swimlaneId')) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue