From 5a023e431504f7573723db6e0d2262ecb1fc61c5 Mon Sep 17 00:00:00 2001 From: Nicu Tofan Date: Sat, 23 Jun 2018 23:22:38 +0300 Subject: Can add cards as subtasks --- models/boards.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'models/boards.js') diff --git a/models/boards.js b/models/boards.js index 911d82a1..6836a320 100644 --- a/models/boards.js +++ b/models/boards.js @@ -151,6 +151,16 @@ Boards.attachSchema(new SimpleSchema({ type: String, optional: true, }, + subtasksDefaultBoardId: { + type: String, + optional: true, + defaultValue: null, + }, + subtasksDefaultListId: { + type: String, + optional: true, + defaultValue: null, + }, })); @@ -284,8 +294,52 @@ Boards.helpers({ return Cards.find(query, projection); }, + // A board alwasy has another board where it deposits subtasks of thasks + // that belong to itself. + getDefaultSubtasksBoardId() { + if (this.subtasksDefaultBoardId === null) { + this.subtasksDefaultBoardId = Boards.insert({ + title: `^${this.title}^`, + permission: this.permission, + members: this.members, + color: this.color, + description: TAPi18n.__('default-subtasks-board', {board: this.title}), + }); + + Swimlanes.insert({ + title: TAPi18n.__('default'), + boardId: this.subtasksDefaultBoardId, + }); + Boards.update(this._id, {$set: { + subtasksDefaultBoardId: this.subtasksDefaultBoardId, + }}); + } + return this.subtasksDefaultBoardId; + }, + + getDefaultSubtasksBoard() { + return Boards.findOne(this.getDefaultSubtasksBoardId()); + }, + + getDefaultSubtasksListId() { + if (this.subtasksDefaultListId === null) { + this.subtasksDefaultListId = Lists.insert({ + title: TAPi18n.__('new'), + boardId: this._id, + }); + Boards.update(this._id, {$set: { + subtasksDefaultListId: this.subtasksDefaultListId, + }}); + } + return this.subtasksDefaultListId; + }, + + getDefaultSubtasksList() { + return Lists.findOne(this.getDefaultSubtasksListId()); + }, }); + Boards.mutations({ archive() { return { $set: { archived: true } }; -- cgit v1.2.3-1-g7c22 From 50f170b75d9d149bd333091fb5f7ba150c245b15 Mon Sep 17 00:00:00 2001 From: Nicu Tofan Date: Sun, 24 Jun 2018 10:59:48 +0300 Subject: A better name for incoming subtasks --- models/boards.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'models/boards.js') diff --git a/models/boards.js b/models/boards.js index 6836a320..6f0f7293 100644 --- a/models/boards.js +++ b/models/boards.js @@ -324,7 +324,7 @@ Boards.helpers({ getDefaultSubtasksListId() { if (this.subtasksDefaultListId === null) { this.subtasksDefaultListId = Lists.insert({ - title: TAPi18n.__('new'), + title: TAPi18n.__('queue'), boardId: this._id, }); Boards.update(this._id, {$set: { -- cgit v1.2.3-1-g7c22 From 04745f0c2fe83f044032713e1864c5ac00d38ac9 Mon Sep 17 00:00:00 2001 From: Nicu Tofan Date: Mon, 25 Jun 2018 22:01:02 +0300 Subject: implement getDefaultSwimline for boards --- models/boards.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'models/boards.js') diff --git a/models/boards.js b/models/boards.js index 6f0f7293..a8b7191e 100644 --- a/models/boards.js +++ b/models/boards.js @@ -337,6 +337,18 @@ Boards.helpers({ getDefaultSubtasksList() { 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; + }, }); -- cgit v1.2.3-1-g7c22 From c9f70cf382707141561732a46dbd3e3e2f159e6e Mon Sep 17 00:00:00 2001 From: Nicu Tofan Date: Mon, 25 Jun 2018 22:52:50 +0300 Subject: Check for null and undefined in board defaults --- models/boards.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'models/boards.js') diff --git a/models/boards.js b/models/boards.js index a8b7191e..fce674ae 100644 --- a/models/boards.js +++ b/models/boards.js @@ -297,7 +297,7 @@ Boards.helpers({ // A board alwasy has another board where it deposits subtasks of thasks // that belong to itself. getDefaultSubtasksBoardId() { - if (this.subtasksDefaultBoardId === null) { + if ((this.subtasksDefaultBoardId === null) || (this.subtasksDefaultBoardId === undefined)) { this.subtasksDefaultBoardId = Boards.insert({ title: `^${this.title}^`, permission: this.permission, @@ -322,7 +322,7 @@ Boards.helpers({ }, getDefaultSubtasksListId() { - if (this.subtasksDefaultListId === null) { + if ((this.subtasksDefaultListId === null) || (this.subtasksDefaultListId === undefined)) { this.subtasksDefaultListId = Lists.insert({ title: TAPi18n.__('queue'), boardId: this._id, -- cgit v1.2.3-1-g7c22 From 94a52080cff14f7587c0ee837c1fca131cd6aff0 Mon Sep 17 00:00:00 2001 From: Nicu Tofan Date: Mon, 25 Jun 2018 23:12:20 +0300 Subject: Board level settings for subtasks --- models/boards.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'models/boards.js') diff --git a/models/boards.js b/models/boards.js index fce674ae..b5b0b0fc 100644 --- a/models/boards.js +++ b/models/boards.js @@ -161,6 +161,10 @@ Boards.attachSchema(new SimpleSchema({ optional: true, defaultValue: null, }, + allowsSubtasks: { + type: Boolean, + defaultValue: true, + }, })); @@ -473,6 +477,18 @@ Boards.mutations({ }, }; }, + + setAllowsSubtasks(allowsSubtasks) { + return { $set: { allowsSubtasks } }; + }, + + setSubtasksDefaultBoardId(subtasksDefaultBoardId) { + return { $set: { subtasksDefaultBoardId } }; + }, + + setSubtasksDefaultListId(subtasksDefaultListId) { + return { $set: { subtasksDefaultListId } }; + }, }); if (Meteor.isServer) { -- cgit v1.2.3-1-g7c22 From c0ffd6c20f2a04bd1436ea2f0953f1c3c8afe145 Mon Sep 17 00:00:00 2001 From: Nicu Tofan Date: Tue, 26 Jun 2018 02:13:31 +0300 Subject: Show parent in card (no links, yet) --- models/boards.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'models/boards.js') diff --git a/models/boards.js b/models/boards.js index b5b0b0fc..2d80a56a 100644 --- a/models/boards.js +++ b/models/boards.js @@ -165,6 +165,18 @@ Boards.attachSchema(new SimpleSchema({ type: Boolean, defaultValue: true, }, + presentParentTask: { + type: String, + allowedValues: [ + 'prefix-with-full-path', + 'prefix-with-parent', + 'subtext-with-full-path', + 'subtext-with-parent', + 'no-parent', + ], + optional: true, + defaultValue: 'no-parent', + }, })); @@ -489,6 +501,10 @@ Boards.mutations({ setSubtasksDefaultListId(subtasksDefaultListId) { return { $set: { subtasksDefaultListId } }; }, + + setPresentParentTask(presentParentTask) { + return { $set: { presentParentTask } }; + }, }); if (Meteor.isServer) { -- cgit v1.2.3-1-g7c22 From b7d508e8c4cf858559e144053d119ceaebfa9697 Mon Sep 17 00:00:00 2001 From: Nicu Tofan Date: Tue, 26 Jun 2018 17:39:31 +0300 Subject: Added ability to change card's parent. --- models/boards.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'models/boards.js') diff --git a/models/boards.js b/models/boards.js index 2d80a56a..c83050c0 100644 --- a/models/boards.js +++ b/models/boards.js @@ -220,6 +220,10 @@ Boards.helpers({ return Swimlanes.find({ boardId: this._id, archived: false }, { sort: { sort: 1 } }); }, + cards() { + return Cards.find({ boardId: this._id, archived: false }, { sort: { sort: 1 } }); + }, + hasOvertimeCards(){ const card = Cards.findOne({isOvertime: true, boardId: this._id, archived: false} ); return card !== undefined; -- cgit v1.2.3-1-g7c22