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/boards.js | 10 ++++++++++ models/cards.js | 6 +++++- models/lists.js | 11 +++++++++++ models/swimlanes.js | 11 +++++++++++ models/users.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 1 deletion(-) (limited to 'models') diff --git a/models/boards.js b/models/boards.js index 71831a63..a2f4c0a8 100644 --- a/models/boards.js +++ b/models/boards.js @@ -304,6 +304,13 @@ Boards.attachSchema(new SimpleSchema({ defaultValue: false, optional: true, }, + type: { + /** + * The type of board + */ + type: String, + defaultValue: 'board', + }, })); @@ -559,6 +566,9 @@ Boards.helpers({ }); }, + isTemplateBoard() { + return this.type === 'template-board'; + }, }); diff --git a/models/cards.js b/models/cards.js index ff19a9a0..e9fc453e 100644 --- a/models/cards.js +++ b/models/cards.js @@ -246,7 +246,7 @@ Cards.attachSchema(new SimpleSchema({ * type of the card */ type: String, - defaultValue: '', + defaultValue: 'cardType-card', }, linkedId: { /** @@ -930,6 +930,10 @@ Cards.helpers({ return this.assignedBy; } }, + + isTemplateCard() { + return this.type === 'template-card'; + }, }); Cards.mutations({ diff --git a/models/lists.js b/models/lists.js index 54e7d037..e0040752 100644 --- a/models/lists.js +++ b/models/lists.js @@ -107,6 +107,13 @@ Lists.attachSchema(new SimpleSchema({ 'saddlebrown', 'paleturquoise', 'mistyrose', 'indigo', ], }, + type: { + /** + * The type of list + */ + type: String, + defaultValue: 'list', + }, })); Lists.allow({ @@ -169,6 +176,10 @@ Lists.helpers({ return this.color; return ''; }, + + isTemplateList() { + return this.type === 'template-list'; + }, }); Lists.mutations({ diff --git a/models/swimlanes.js b/models/swimlanes.js index e2c3925c..bdc9a691 100644 --- a/models/swimlanes.js +++ b/models/swimlanes.js @@ -78,6 +78,13 @@ Swimlanes.attachSchema(new SimpleSchema({ } }, }, + type: { + /** + * The type of swimlane + */ + type: String, + defaultValue: 'swimlane', + }, })); Swimlanes.allow({ @@ -114,6 +121,10 @@ Swimlanes.helpers({ return this.color; return ''; }, + + isTemplateSwimlane() { + return this.type === 'template-swimlane'; + }, }); Swimlanes.mutations({ 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