Skip to content

Commit

Permalink
Fix removed setters and getters
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmanelli committed Aug 15, 2018
1 parent 53c0a52 commit e55d7e4
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 11 deletions.
20 changes: 10 additions & 10 deletions client/components/cards/cardDetails.jade
Expand Up @@ -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'}}
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
47 changes: 46 additions & 1 deletion models/cards.js
Expand Up @@ -88,7 +88,6 @@ Cards.attachSchema(new SimpleSchema({
type: String,
optional: true,
defaultValue: '',

},
assignedBy: {
type: String,
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit e55d7e4

Please sign in to comment.