diff options
-rw-r--r-- | client/components/cards/cardDetails.jade | 20 | ||||
-rw-r--r-- | models/cards.js | 47 |
2 files changed, 56 insertions, 11 deletions
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 4401d24b..ac7218d4 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -129,14 +129,14 @@ template(name="cardDetails") +editCardRequesterForm else a.js-open-inlined-form - if requestedBy + if getRequestedBy +viewer - = requestedBy + = getRequestedBy else | {{_ 'add'}} - else if requestedBy + else if getRequestedBy +viewer - = requestedBy + = getRequestedBy .card-details-item.card-details-item-name h3.card-details-item-title {{_ 'assigned-by'}} @@ -145,14 +145,14 @@ template(name="cardDetails") +editCardAssignerForm else a.js-open-inlined-form - if assignedBy + if getAssignedBy +viewer - = assignedBy + = getAssignedBy else | {{_ 'add'}} - else if requestedBy + else if getRequestedBy +viewer - = assignedBy + = getAssignedBy hr +checklists(cardId = _id) @@ -192,13 +192,13 @@ template(name="editCardTitleForm") a.fa.fa-times-thin.js-close-inlined-form template(name="editCardRequesterForm") - input.js-edit-card-requester(type='text' autofocus value=requestedBy) + input.js-edit-card-requester(type='text' autofocus value=getRequestedBy) .edit-controls.clearfix button.primary.confirm.js-submit-edit-card-requester-form(type="submit") {{_ 'save'}} a.fa.fa-times-thin.js-close-inlined-form template(name="editCardAssignerForm") - input.js-edit-card-assigner(type='text' autofocus value=assignedBy) + input.js-edit-card-assigner(type='text' autofocus value=getAssignedBy) .edit-controls.clearfix button.primary.confirm.js-submit-edit-card-assigner-form(type="submit") {{_ 'save'}} a.fa.fa-times-thin.js-close-inlined-form diff --git a/models/cards.js b/models/cards.js index 171c21c5..1cb1e3d0 100644 --- a/models/cards.js +++ b/models/cards.js @@ -88,7 +88,6 @@ Cards.attachSchema(new SimpleSchema({ type: String, optional: true, defaultValue: '', - }, assignedBy: { type: String, @@ -769,6 +768,52 @@ Cards.helpers({ return this.archived; } }, + + setRequestedBy(requestedBy) { + if (this.isLinkedCard()) { + return Cards.update( + { _id: this.linkedId }, + {$set: {requestedBy}} + ); + } else { + return Cards.update( + {_id: this._id}, + {$set: {requestedBy}} + ); + } + }, + + getRequestedBy() { + if (this.isLinkedCard()) { + const card = Cards.findOne({ _id: this.linkedId }); + return card.requestedBy; + } else { + return this.requestedBy; + } + }, + + setAssignedBy(assignedBy) { + if (this.isLinkedCard()) { + return Cards.update( + { _id: this.linkedId }, + {$set: {assignedBy}} + ); + } else { + return Cards.update( + {_id: this._id}, + {$set: {assignedBy}} + ); + } + }, + + getAssignedBy() { + if (this.isLinkedCard()) { + const card = Cards.findOne({ _id: this.linkedId }); + return card.assignedBy; + } else { + return this.assignedBy; + } + }, }); Cards.mutations({ |