summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/boards.js12
-rw-r--r--models/cards.js38
-rw-r--r--models/checklists.js20
-rw-r--r--models/lists.js50
-rw-r--r--models/swimlanes.js48
-rw-r--r--models/users.js82
6 files changed, 125 insertions, 125 deletions
diff --git a/models/boards.js b/models/boards.js
index d81ded15..0d3213bc 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -471,7 +471,7 @@ Boards.helpers({
query.type = 'template-swimlane';
query.archived = false;
} else {
- query.type = {$nin: ['template-swimlane']};
+ query.type = {$nin: ['template-swimlane']};
}
const projection = { limit: 10, sort: { createdAt: -1 } };
@@ -495,7 +495,7 @@ Boards.helpers({
query.type = 'template-list';
query.archived = false;
} else {
- query.type = {$nin: ['template-list']};
+ query.type = {$nin: ['template-list']};
}
const projection = { limit: 10, sort: { createdAt: -1 } };
@@ -522,7 +522,7 @@ Boards.helpers({
query.type = 'template-card';
query.archived = false;
} else {
- query.type = {$nin: ['template-card']};
+ query.type = {$nin: ['template-card']};
}
const projection = { limit: 10, sort: { createdAt: -1 } };
@@ -975,7 +975,7 @@ if (Meteor.isServer) {
* @param {string} userId the ID of the user to retrieve the data
* @return_type [{_id: string,
title: string}]
- */
+ */
JsonRoutes.add('GET', '/api/users/:userId/boards', function (req, res) {
try {
Authentication.checkLoggedIn(req.userId);
@@ -1012,7 +1012,7 @@ if (Meteor.isServer) {
*
* @return_type [{_id: string,
title: string}]
- */
+ */
JsonRoutes.add('GET', '/api/boards', function (req, res) {
try {
Authentication.checkUserId(req.userId);
@@ -1083,7 +1083,7 @@ if (Meteor.isServer) {
*
* @return_type {_id: string,
defaultSwimlaneId: string}
- */
+ */
JsonRoutes.add('POST', '/api/boards', function (req, res) {
try {
Authentication.checkUserId(req.userId);
diff --git a/models/cards.js b/models/cards.js
index c7b4a366..e91f0af5 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -273,28 +273,28 @@ Cards.allow({
Cards.helpers({
copy() {
- const oldId = this._id;
- this._id = null;
- const _id = Cards.insert(this);
+ const oldId = this._id;
+ this._id = null;
+ const _id = Cards.insert(this);
- // copy checklists
- Checklists.find({cardId: oldId}).forEach((ch) => {
- ch.copy(_id);
- });
+ // copy checklists
+ Checklists.find({cardId: oldId}).forEach((ch) => {
+ ch.copy(_id);
+ });
- // copy subtasks
- Cards.find({parentId: oldId}).forEach((subtask) => {
- subtask.parentId = _id;
- subtask._id = null;
- Cards.insert(subtask);
- });
+ // copy subtasks
+ Cards.find({parentId: oldId}).forEach((subtask) => {
+ subtask.parentId = _id;
+ subtask._id = null;
+ Cards.insert(subtask);
+ });
- // copy card comments
- CardComments.find({cardId: oldId}).forEach((cmt) => {
- cmt.copy(_id);
- });
+ // copy card comments
+ CardComments.find({cardId: oldId}).forEach((cmt) => {
+ cmt.copy(_id);
+ });
- return _id;
+ return _id;
},
list() {
@@ -1259,7 +1259,7 @@ Cards.mutations({
function cardMove(userId, doc, fieldNames, oldListId, oldSwimlaneId) {
if ((_.contains(fieldNames, 'listId') && doc.listId !== oldListId) ||
- (_.contains(fieldNames, 'swimlaneId') && doc.swimlaneId !== oldSwimlaneId)){
+ (_.contains(fieldNames, 'swimlaneId') && doc.swimlaneId !== oldSwimlaneId)){
Activities.insert({
userId,
oldListId,
diff --git a/models/checklists.js b/models/checklists.js
index 99e9f25e..9e763f1a 100644
--- a/models/checklists.js
+++ b/models/checklists.js
@@ -49,16 +49,16 @@ Checklists.attachSchema(new SimpleSchema({
Checklists.helpers({
copy(newCardId) {
- const oldChecklistId = this._id;
- this._id = null;
- this.cardId = newCardId;
- const newChecklistId = Checklists.insert(this);
- ChecklistItems.find({checklistId: oldChecklistId}).forEach((item) => {
- item._id = null;
- item.checklistId = newChecklistId;
- item.cardId = newCardId;
- ChecklistItems.insert(item);
- });
+ const oldChecklistId = this._id;
+ this._id = null;
+ this.cardId = newCardId;
+ const newChecklistId = Checklists.insert(this);
+ ChecklistItems.find({checklistId: oldChecklistId}).forEach((item) => {
+ item._id = null;
+ item.checklistId = newChecklistId;
+ item.cardId = newCardId;
+ ChecklistItems.insert(item);
+ });
},
itemCount() {
diff --git a/models/lists.js b/models/lists.js
index 76708ffd..453e0be1 100644
--- a/models/lists.js
+++ b/models/lists.js
@@ -138,30 +138,30 @@ Lists.allow({
Lists.helpers({
copy() {
- const oldId = this._id;
- let _id = null;
- existingListWithSameName = Lists.findOne({
- boardId: this.boardId,
- title: this.title,
- });
- if (existingListWithSameName) {
- _id = existingListWithSameName._id;
- } else {
- this._id = null;
- _id = Lists.insert(this);
- }
+ const oldId = this._id;
+ let _id = null;
+ existingListWithSameName = Lists.findOne({
+ boardId: this.boardId,
+ title: this.title,
+ });
+ if (existingListWithSameName) {
+ _id = existingListWithSameName._id;
+ } else {
+ this._id = null;
+ _id = Lists.insert(this);
+ }
- // Copy all cards in list
- Cards.find({
- listId: oldId,
- archived: false,
- }).forEach((card) => {
- card.type = 'cardType-card';
- card.listId = _id;
- card.boardId = this.boardId;
- card.swimlaneId = this.swimlaneId;
- card.copy();
- });
+ // Copy all cards in list
+ Cards.find({
+ listId: oldId,
+ archived: false,
+ }).forEach((card) => {
+ card.type = 'cardType-card';
+ card.listId = _id;
+ card.boardId = this.boardId;
+ card.swimlaneId = this.swimlaneId;
+ card.copy();
+ });
},
cards(swimlaneId) {
@@ -224,7 +224,7 @@ Lists.mutations({
archive() {
if (this.isTemplateList()) {
this.cards().forEach((card) => {
- return card.archive();
+ return card.archive();
});
}
return { $set: { archived: true } };
@@ -233,7 +233,7 @@ Lists.mutations({
restore() {
if (this.isTemplateList()) {
this.allCards().forEach((card) => {
- return card.restore();
+ return card.restore();
});
}
return { $set: { archived: false } };
diff --git a/models/swimlanes.js b/models/swimlanes.js
index 205f1498..6f679a8d 100644
--- a/models/swimlanes.js
+++ b/models/swimlanes.js
@@ -102,20 +102,20 @@ Swimlanes.allow({
Swimlanes.helpers({
copy() {
- const oldId = this._id;
- this._id = null;
- const _id = Swimlanes.insert(this);
+ const oldId = this._id;
+ this._id = null;
+ const _id = Swimlanes.insert(this);
- // Copy all lists in swimlane
- Lists.find({
- swimlaneId: oldId,
- archived: false,
- }).forEach((list) => {
- list.type = 'list';
- list.swimlaneId = _id;
- list.boardId = this.boardId;
- list.copy();
- });
+ // Copy all lists in swimlane
+ Lists.find({
+ swimlaneId: oldId,
+ archived: false,
+ }).forEach((list) => {
+ list.type = 'list';
+ list.swimlaneId = _id;
+ list.boardId = this.boardId;
+ list.copy();
+ });
},
cards() {
@@ -127,8 +127,8 @@ Swimlanes.helpers({
lists() {
return Lists.find(Filter.mongoSelector({
- swimlaneId: this._id,
- archived: false,
+ swimlaneId: this._id,
+ archived: false,
}), { sort: ['sort'] });
},
@@ -155,22 +155,22 @@ Swimlanes.helpers({
},
isTemplateContainer() {
- return this.type === 'template-container';
+ return this.type === 'template-container';
},
isListTemplatesSwimlane() {
- const user = Users.findOne(Meteor.userId());
- return user.profile.listTemplatesSwimlaneId === this._id;
+ const user = Users.findOne(Meteor.userId());
+ return user.profile.listTemplatesSwimlaneId === this._id;
},
isCardTemplatesSwimlane() {
- const user = Users.findOne(Meteor.userId());
- return user.profile.cardTemplatesSwimlaneId === this._id;
+ const user = Users.findOne(Meteor.userId());
+ return user.profile.cardTemplatesSwimlaneId === this._id;
},
isBoardTemplatesSwimlane() {
- const user = Users.findOne(Meteor.userId());
- return user.profile.boardTemplatesSwimlaneId === this._id;
+ const user = Users.findOne(Meteor.userId());
+ return user.profile.boardTemplatesSwimlaneId === this._id;
},
});
@@ -182,7 +182,7 @@ Swimlanes.mutations({
archive() {
if (this.isTemplateSwimlane()) {
this.lists().forEach((list) => {
- return list.archive();
+ return list.archive();
});
}
return { $set: { archived: true } };
@@ -191,7 +191,7 @@ Swimlanes.mutations({
restore() {
if (this.isTemplateSwimlane()) {
this.allLists().forEach((list) => {
- return list.restore();
+ return list.restore();
});
}
return { $set: { archived: false } };
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}});
+ });
});
});
});