summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2018-04-18 02:30:24 -0300
committerAndrés Manelli <andresmanelli@gmail.com>2018-08-11 00:14:13 +0200
commit37306c8d2244c33aa924de375f2e17f438117d54 (patch)
treec0147504109f2fc7728a6b33e9d64c43b38d996d
parent4ffa8784a25913fda5ba2046b7e5d179569e5af8 (diff)
downloadwekan-37306c8d2244c33aa924de375f2e17f438117d54.tar.gz
wekan-37306c8d2244c33aa924de375f2e17f438117d54.tar.bz2
wekan-37306c8d2244c33aa924de375f2e17f438117d54.zip
Add title binding
-rw-r--r--client/components/cards/cardDetails.jade6
-rw-r--r--client/components/cards/minicard.jade2
-rw-r--r--models/cards.js107
3 files changed, 35 insertions, 80 deletions
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade
index b8c16f80..71b3bce4 100644
--- a/client/components/cards/cardDetails.jade
+++ b/client/components/cards/cardDetails.jade
@@ -10,7 +10,7 @@ template(name="cardDetails")
h2.card-details-title.js-card-title(
class="{{#if canModifyCard}}js-open-inlined-form is-editable{{/if}}")
+viewer
- = title
+ = getTitle
if isWatching
i.fa.fa-eye.card-details-watch
.card-details-path
@@ -186,7 +186,7 @@ template(name="cardDetails")
template(name="editCardTitleForm")
textarea.js-edit-card-title(rows='1' autofocus)
- = title
+ = getTitle
.edit-controls.clearfix
button.primary.confirm.js-submit-edit-card-title-form(type="submit") {{_ 'save'}}
a.fa.fa-times-thin.js-close-inlined-form
@@ -237,7 +237,7 @@ template(name="moveCardPopup")
template(name="copyCardPopup")
label(for='copy-card-title') {{_ 'title'}}:
textarea#copy-card-title.minicard-composer-textarea.js-card-title(autofocus)
- = title
+ = getTitle
+boardsAndLists
template(name="copyChecklistToManyCardsPopup")
diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade
index 88ad5564..e7e38e7a 100644
--- a/client/components/cards/minicard.jade
+++ b/client/components/cards/minicard.jade
@@ -18,7 +18,7 @@ template(name="minicard")
if isImported
span.imported-icon.fa.fa-share-alt
+viewer
- | {{ title }}
+ = getTitle
if $eq 'subtext-with-full-path' currentBoard.presentParentTask
.parent-subtext
| {{ parentString ' > ' }}
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}};
},