summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/cards.js107
1 files changed, 31 insertions, 76 deletions
diff --git a/models/cards.js b/models/cards.js
index b295a4fe..c48c5fa1 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -693,6 +693,37 @@ Cards.helpers({
);
}
},
+
+ getTitle() {
+ if (this.isImportedCard()) {
+ const card = Cards.findOne({ _id: this.importedId });
+ return card.title;
+ } else if (this.isImportedBoard()) {
+ const board = Boards.findOne({ _id: this.importedId});
+ return board.title;
+ } else {
+ return this.title;
+ }
+ },
+
+ setTitle(title) {
+ if (this.isImportedCard()) {
+ return Cards.update(
+ { _id: this.importedId },
+ {$set: {title}}
+ );
+ } else if (this.isImportedBoard()) {
+ return Boards.update(
+ {_id: this.importedId},
+ {$set: {title}}
+ );
+ } else {
+ return Cards.update(
+ {_id: this._id},
+ {$set: {title}}
+ );
+ }
+ },
});
Cards.mutations({
@@ -712,22 +743,6 @@ Cards.mutations({
return {$set: {archived: false}};
},
- setTitle(title) {
- return {$set: {title}};
- },
-
- setDescription(description) {
- return {$set: {description}};
- },
-
- setRequestedBy(requestedBy) {
- return {$set: {requestedBy}};
- },
-
- setAssignedBy(assignedBy) {
- return {$set: {assignedBy}};
- },
-
move(swimlaneId, listId, sortIndex) {
const list = Lists.findOne(listId);
const mutatedFields = {
@@ -756,22 +771,6 @@ Cards.mutations({
}
},
- assignMember(memberId) {
- return {$addToSet: {members: memberId}};
- },
-
- unassignMember(memberId) {
- return {$pull: {members: memberId}};
- },
-
- toggleMember(memberId) {
- if (this.members && this.members.indexOf(memberId) > -1) {
- return this.unassignMember(memberId);
- } else {
- return this.assignMember(memberId);
- }
- },
-
assignCustomField(customFieldId) {
return {$addToSet: {customFields: {_id: customFieldId, value: null}}};
},
@@ -809,50 +808,6 @@ Cards.mutations({
return {$unset: {coverId: ''}};
},
- setReceived(receivedAt) {
- return {$set: {receivedAt}};
- },
-
- unsetReceived() {
- return {$unset: {receivedAt: ''}};
- },
-
- setStart(startAt) {
- return {$set: {startAt}};
- },
-
- unsetStart() {
- return {$unset: {startAt: ''}};
- },
-
- setDue(dueAt) {
- return {$set: {dueAt}};
- },
-
- unsetDue() {
- return {$unset: {dueAt: ''}};
- },
-
- setEnd(endAt) {
- return {$set: {endAt}};
- },
-
- unsetEnd() {
- return {$unset: {endAt: ''}};
- },
-
- setOvertime(isOvertime) {
- return {$set: {isOvertime}};
- },
-
- setSpentTime(spentTime) {
- return {$set: {spentTime}};
- },
-
- unsetSpentTime() {
- return {$unset: {spentTime: '', isOvertime: false}};
- },
-
setParentId(parentId) {
return {$set: {parentId}};
},