From 0a53ee87b94232608b5131f47dd77d2fa4bbc5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Fri, 22 Feb 2019 22:59:19 +0100 Subject: Add first draft of data model and user interface. No actions. --- models/users.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'models/users.js') diff --git a/models/users.js b/models/users.js index 0fdf21a8..7bc9e5bf 100644 --- a/models/users.js +++ b/models/users.js @@ -159,6 +159,13 @@ Users.attachSchema(new SimpleSchema({ 'board-view-cal', ], }, + 'profile.templatesBoardId': { + /** + * Reference to the templates board + */ + type: String, + defaultValue: '', + }, services: { /** * services field of the user @@ -328,6 +335,13 @@ Users.helpers({ const profile = this.profile || {}; return profile.language || 'en'; }, + + getTemplatesBoard() { + return { + id: this.profile.templatesBoardId, + slug: Boards.findOne(this.profile.templatesBoardId).slug, + }; + }, }); Users.mutations({ @@ -701,6 +715,40 @@ if (Meteor.isServer) { Lists.insert({title: TAPi18n.__(title), boardId, sort: titleIndex}, fakeUser); }); }); + + Boards.insert({ + title: TAPi18n.__('templates-board'), + permission: 'private', + type: 'template-container' + }, fakeUser, (err, boardId) => { + + // Insert the reference to our templates board + Users.update(fakeUserId.get(), {$set: {'profile.templatesBoardId': boardId}}); + + // Insert the card templates swimlane + Swimlanes.insert({ + title: TAPi18n.__('card-templates-swimlane'), + boardId, + sort: 1, + type: 'template-container', + }, fakeUser); + + // Insert the list templates swimlane + Swimlanes.insert({ + title: TAPi18n.__('list-templates-swimlane'), + boardId, + sort: 2, + type: 'template-container', + }, fakeUser); + + // Insert the board templates swimlane + Swimlanes.insert({ + title: TAPi18n.__('board-templates-swimlane'), + boardId, + sort: 3, + type: 'template-container', + }, fakeUser); + }); }); }); } -- cgit v1.2.3-1-g7c22 From 64bf455b296a10369e8318183c2c6cd61a122869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Fri, 22 Feb 2019 23:48:23 +0100 Subject: Save template swimlanes in profile. Fix swimlane view for templates board. Avoid deleting template containers --- models/users.js | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) (limited to 'models/users.js') diff --git a/models/users.js b/models/users.js index 7bc9e5bf..1493aa0d 100644 --- a/models/users.js +++ b/models/users.js @@ -166,6 +166,27 @@ Users.attachSchema(new SimpleSchema({ type: String, defaultValue: '', }, + 'profile.cardTemplatesSwimlaneId': { + /** + * Reference to the card templates swimlane Id + */ + type: String, + defaultValue: '', + }, + 'profile.listTemplatesSwimlaneId': { + /** + * Reference to the list templates swimlane Id + */ + type: String, + defaultValue: '', + }, + 'profile.boardTemplatesSwimlaneId': { + /** + * Reference to the board templates swimlane Id + */ + type: String, + defaultValue: '', + }, services: { /** * services field of the user @@ -336,11 +357,12 @@ Users.helpers({ return profile.language || 'en'; }, - getTemplatesBoard() { - return { - id: this.profile.templatesBoardId, - slug: Boards.findOne(this.profile.templatesBoardId).slug, - }; + getTemplatesBoardId() { + return this.profile.templatesBoardId; + }, + + getTemplatesBoardSlug() { + return Boards.findOne(this.profile.templatesBoardId).slug; }, }); @@ -731,7 +753,11 @@ if (Meteor.isServer) { boardId, sort: 1, type: 'template-container', - }, fakeUser); + }, fakeUser, (err, swimlaneId) => { + + // Insert the reference to out card templates swimlane + Users.update(fakeUserId.get(), {$set: {'profile.cardTemplatesSwimlaneId': swimlaneId}}); + }); // Insert the list templates swimlane Swimlanes.insert({ @@ -739,7 +765,11 @@ if (Meteor.isServer) { boardId, sort: 2, type: 'template-container', - }, fakeUser); + }, fakeUser, (err, swimlaneId) => { + + // Insert the reference to out list templates swimlane + Users.update(fakeUserId.get(), {$set: {'profile.listTemplatesSwimlaneId': swimlaneId}}); + }); // Insert the board templates swimlane Swimlanes.insert({ @@ -747,7 +777,11 @@ if (Meteor.isServer) { boardId, sort: 3, type: 'template-container', - }, fakeUser); + }, fakeUser, (err, swimlaneId) => { + + // Insert the reference to out board templates swimlane + Users.update(fakeUserId.get(), {$set: {'profile.boardTemplatesSwimlaneId': swimlaneId}}); + }); }); }); }); -- cgit v1.2.3-1-g7c22 From 1e72177991e3fe11a1837e3e294e4de5d728aa30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Sat, 23 Feb 2019 12:14:37 +0100 Subject: Avoid links on a template-board Allow creation of template boards with a linked card Avoid changing the name of the template-container swimlanes --- models/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'models/users.js') diff --git a/models/users.js b/models/users.js index 1493aa0d..87f2b860 100644 --- a/models/users.js +++ b/models/users.js @@ -739,7 +739,7 @@ if (Meteor.isServer) { }); Boards.insert({ - title: TAPi18n.__('templates-board'), + title: TAPi18n.__('templates'), permission: 'private', type: 'template-container' }, fakeUser, (err, boardId) => { -- cgit v1.2.3-1-g7c22 From eb62c9ce6ad0fa0d5de7889ec087db8cdc579339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Sun, 24 Feb 2019 00:13:35 +0100 Subject: Fix lint errors --- models/users.js | 82 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'models/users.js') diff --git a/models/users.js b/models/users.js index 87f2b860..9bc4f175 100644 --- a/models/users.js +++ b/models/users.js @@ -358,11 +358,11 @@ Users.helpers({ }, getTemplatesBoardId() { - return this.profile.templatesBoardId; + return this.profile.templatesBoardId; }, getTemplatesBoardSlug() { - return Boards.findOne(this.profile.templatesBoardId).slug; + return Boards.findOne(this.profile.templatesBoardId).slug; }, }); @@ -741,47 +741,47 @@ if (Meteor.isServer) { Boards.insert({ title: TAPi18n.__('templates'), permission: 'private', - type: 'template-container' + type: 'template-container', }, fakeUser, (err, boardId) => { - // Insert the reference to our templates board - Users.update(fakeUserId.get(), {$set: {'profile.templatesBoardId': boardId}}); - - // Insert the card templates swimlane - Swimlanes.insert({ - title: TAPi18n.__('card-templates-swimlane'), - boardId, - sort: 1, - type: 'template-container', - }, fakeUser, (err, swimlaneId) => { - - // Insert the reference to out card templates swimlane - Users.update(fakeUserId.get(), {$set: {'profile.cardTemplatesSwimlaneId': swimlaneId}}); - }); - - // Insert the list templates swimlane - Swimlanes.insert({ - title: TAPi18n.__('list-templates-swimlane'), - boardId, - sort: 2, - type: 'template-container', - }, fakeUser, (err, swimlaneId) => { - - // Insert the reference to out list templates swimlane - Users.update(fakeUserId.get(), {$set: {'profile.listTemplatesSwimlaneId': swimlaneId}}); - }); - - // Insert the board templates swimlane - Swimlanes.insert({ - title: TAPi18n.__('board-templates-swimlane'), - boardId, - sort: 3, - type: 'template-container', - }, fakeUser, (err, swimlaneId) => { - - // Insert the reference to out board templates swimlane - Users.update(fakeUserId.get(), {$set: {'profile.boardTemplatesSwimlaneId': swimlaneId}}); - }); + // Insert the reference to our templates board + Users.update(fakeUserId.get(), {$set: {'profile.templatesBoardId': boardId}}); + + // Insert the card templates swimlane + Swimlanes.insert({ + title: TAPi18n.__('card-templates-swimlane'), + boardId, + sort: 1, + type: 'template-container', + }, fakeUser, (err, swimlaneId) => { + + // Insert the reference to out card templates swimlane + Users.update(fakeUserId.get(), {$set: {'profile.cardTemplatesSwimlaneId': swimlaneId}}); + }); + + // Insert the list templates swimlane + Swimlanes.insert({ + title: TAPi18n.__('list-templates-swimlane'), + boardId, + sort: 2, + type: 'template-container', + }, fakeUser, (err, swimlaneId) => { + + // Insert the reference to out list templates swimlane + Users.update(fakeUserId.get(), {$set: {'profile.listTemplatesSwimlaneId': swimlaneId}}); + }); + + // Insert the board templates swimlane + Swimlanes.insert({ + title: TAPi18n.__('board-templates-swimlane'), + boardId, + sort: 3, + type: 'template-container', + }, fakeUser, (err, swimlaneId) => { + + // Insert the reference to out board templates swimlane + Users.update(fakeUserId.get(), {$set: {'profile.boardTemplatesSwimlaneId': swimlaneId}}); + }); }); }); }); -- cgit v1.2.3-1-g7c22 From 6ee75fbdbaef7b3d465639060e34c48f7c275c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Wed, 27 Feb 2019 19:33:54 +0100 Subject: Fix templates board not found --- models/users.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'models/users.js') diff --git a/models/users.js b/models/users.js index 7152d133..0dd9c1d6 100644 --- a/models/users.js +++ b/models/users.js @@ -711,7 +711,6 @@ if (Meteor.isServer) { CollectionHooks.getUserId = () => { return fakeUserId.get() || getUserId(); }; - /* if (!isSandstorm) { Users.after.insert((userId, doc) => { const fakeUser = { @@ -721,6 +720,7 @@ if (Meteor.isServer) { }; fakeUserId.withValue(doc._id, () => { + /* // Insert the Welcome Board Boards.insert({ title: TAPi18n.__('welcome-board'), @@ -737,6 +737,7 @@ if (Meteor.isServer) { Lists.insert({title: TAPi18n.__(title), boardId, sort: titleIndex}, fakeUser); }); }); + */ Boards.insert({ title: TAPi18n.__('templates'), @@ -786,7 +787,6 @@ if (Meteor.isServer) { }); }); } - */ Users.after.insert((userId, doc) => { -- cgit v1.2.3-1-g7c22