summaryrefslogtreecommitdiffstats
path: root/models/users.js
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2019-02-22 22:59:19 +0100
committerAndrés Manelli <andresmanelli@gmail.com>2019-02-24 00:05:00 +0100
commit0a53ee87b94232608b5131f47dd77d2fa4bbc5ba (patch)
treeac51a29923f3adfb936ea9d6ef0ed86b24e9f81a /models/users.js
parentef85b71ee41e8a7a02e48363ff83bb05fd02a38e (diff)
downloadwekan-0a53ee87b94232608b5131f47dd77d2fa4bbc5ba.tar.gz
wekan-0a53ee87b94232608b5131f47dd77d2fa4bbc5ba.tar.bz2
wekan-0a53ee87b94232608b5131f47dd77d2fa4bbc5ba.zip
Add first draft of data model and user interface. No actions.
Diffstat (limited to 'models/users.js')
-rw-r--r--models/users.js48
1 files changed, 48 insertions, 0 deletions
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);
+ });
});
});
}