summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2019-02-22 23:48:23 +0100
committerAndrés Manelli <andresmanelli@gmail.com>2019-02-24 00:05:00 +0100
commit64bf455b296a10369e8318183c2c6cd61a122869 (patch)
tree54b9612c3700cf711ef697217fd295fba7e4a9c1 /models
parent0a53ee87b94232608b5131f47dd77d2fa4bbc5ba (diff)
downloadwekan-64bf455b296a10369e8318183c2c6cd61a122869.tar.gz
wekan-64bf455b296a10369e8318183c2c6cd61a122869.tar.bz2
wekan-64bf455b296a10369e8318183c2c6cd61a122869.zip
Save template swimlanes in profile. Fix swimlane view for templates board. Avoid deleting template containers
Diffstat (limited to 'models')
-rw-r--r--models/boards.js4
-rw-r--r--models/swimlanes.js4
-rw-r--r--models/users.js50
3 files changed, 50 insertions, 8 deletions
diff --git a/models/boards.js b/models/boards.js
index a2f4c0a8..7328899e 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -569,6 +569,10 @@ Boards.helpers({
isTemplateBoard() {
return this.type === 'template-board';
},
+
+ isTemplatesBoard() {
+ return this.type === 'template-container';
+ },
});
diff --git a/models/swimlanes.js b/models/swimlanes.js
index bdc9a691..185422ce 100644
--- a/models/swimlanes.js
+++ b/models/swimlanes.js
@@ -125,6 +125,10 @@ Swimlanes.helpers({
isTemplateSwimlane() {
return this.type === 'template-swimlane';
},
+
+ isTemplateContainer() {
+ return this.type === 'template-container';
+ },
});
Swimlanes.mutations({
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}});
+ });
});
});
});