refactor to remove fields that cache & duplicate some functions
This commit is contained in:
@@ -31,10 +31,10 @@
|
|||||||
<div class="truncate">
|
<div class="truncate">
|
||||||
From
|
From
|
||||||
{{
|
{{
|
||||||
givenByProjectFunction()
|
givenByProject()
|
||||||
? providerProjectName
|
? providerProjectName
|
||||||
: // check for DID because name could be "Unnamed"
|
: // check for DID because name could be "Unnamed"
|
||||||
givenByPersonFunction() && giverDid
|
givenByPerson() && giverDid
|
||||||
? giverName
|
? giverName
|
||||||
: "someone not named"
|
: "someone not named"
|
||||||
}}
|
}}
|
||||||
@@ -42,9 +42,10 @@
|
|||||||
<div class="truncate">
|
<div class="truncate">
|
||||||
to
|
to
|
||||||
{{
|
{{
|
||||||
givenToProject
|
givenToProject()
|
||||||
? fulfillsProjectName
|
? fulfillsProjectName
|
||||||
: givenToRecipient
|
: // check for DID because name could be "Unnamed"
|
||||||
|
givenToPerson() && recipientDid
|
||||||
? recipientName
|
? recipientName
|
||||||
: "someone not named"
|
: "someone not named"
|
||||||
}}
|
}}
|
||||||
@@ -114,9 +115,9 @@
|
|||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<label class="text-sm flex-1">
|
<label class="text-sm flex-1">
|
||||||
{{
|
{{
|
||||||
givenByProjectFunction() && providerProjectName
|
givenByProject() && providerProjectName
|
||||||
? "From " + providerProjectName
|
? "From " + providerProjectName
|
||||||
: givenByPersonFunction() && giverName
|
: givenByPerson() && giverName
|
||||||
? "From " + giverName
|
? "From " + giverName
|
||||||
: "Unnamed giver"
|
: "Unnamed giver"
|
||||||
}}
|
}}
|
||||||
@@ -169,9 +170,9 @@
|
|||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<label class="text-sm flex-1">
|
<label class="text-sm flex-1">
|
||||||
{{
|
{{
|
||||||
givenToProjectFunction() && fulfillsProjectName
|
givenToProject() && fulfillsProjectName
|
||||||
? "To " + fulfillsProjectName
|
? "To " + fulfillsProjectName
|
||||||
: givenToPersonFunction() && recipientName
|
: givenToPerson() && recipientName
|
||||||
? "To " + recipientName
|
? "To " + recipientName
|
||||||
: "Unnamed recipient"
|
: "Unnamed recipient"
|
||||||
}}
|
}}
|
||||||
@@ -309,8 +310,6 @@ export default class GiftedDetails extends Vue {
|
|||||||
destinationPathAfter = "";
|
destinationPathAfter = "";
|
||||||
fulfillsProjectId = "";
|
fulfillsProjectId = "";
|
||||||
fulfillsProjectName = "a project";
|
fulfillsProjectName = "a project";
|
||||||
givenToProject = false; // basically static, based on input; if we allow changing then let's fix things (see below)
|
|
||||||
givenToRecipient = false; // basically static, based on input; if we allow changing then let's fix things (see below)
|
|
||||||
giverDid = "";
|
giverDid = "";
|
||||||
giverName = "";
|
giverName = "";
|
||||||
hideBackButton = false;
|
hideBackButton = false;
|
||||||
@@ -468,9 +467,6 @@ export default class GiftedDetails extends Vue {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// these should be functions but something's wrong with the syntax in the <> conditional
|
|
||||||
this.givenToProject = !!this.fulfillsProjectId;
|
|
||||||
this.givenToRecipient = !this.givenToProject && !!this.recipientDid;
|
|
||||||
|
|
||||||
this.showGeneralAdvanced = !!settings.showGeneralAdvanced;
|
this.showGeneralAdvanced = !!settings.showGeneralAdvanced;
|
||||||
|
|
||||||
@@ -498,19 +494,19 @@ export default class GiftedDetails extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
givenByPersonFunction() {
|
givenByPerson() {
|
||||||
return !!this.giverDid;
|
return !!this.giverDid;
|
||||||
}
|
}
|
||||||
|
|
||||||
givenByProjectFunction() {
|
givenByProject() {
|
||||||
return !!this.providerProjectId;
|
return !!this.providerProjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
givenToPersonFunction() {
|
givenToPerson() {
|
||||||
return !!this.recipientDid;
|
return !!this.recipientDid;
|
||||||
}
|
}
|
||||||
|
|
||||||
givenToProjectFunction() {
|
givenToProject() {
|
||||||
return !!this.fulfillsProjectId;
|
return !!this.fulfillsProjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,7 +656,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
TIMEOUTS.SHORT,
|
TIMEOUTS.SHORT,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// must be because givenToProject is true
|
// must be because givenToProject() is true
|
||||||
this.notify.warning(
|
this.notify.warning(
|
||||||
"You cannot assign both to a recipient and to a project.",
|
"You cannot assign both to a recipient and to a project.",
|
||||||
TIMEOUTS.SHORT,
|
TIMEOUTS.SHORT,
|
||||||
@@ -837,12 +833,12 @@ export default class GiftedDetails extends Vue {
|
|||||||
* Computed property for current receiver entity data
|
* Computed property for current receiver entity data
|
||||||
*/
|
*/
|
||||||
get currentReceiver() {
|
get currentReceiver() {
|
||||||
if (this.givenToProject && this.fulfillsProjectId) {
|
if (this.givenToProject() && this.fulfillsProjectId) {
|
||||||
return {
|
return {
|
||||||
handleId: this.fulfillsProjectId,
|
handleId: this.fulfillsProjectId,
|
||||||
name: this.fulfillsProjectName,
|
name: this.fulfillsProjectName,
|
||||||
};
|
};
|
||||||
} else if (this.givenToRecipient && this.recipientDid) {
|
} else if (this.givenToPerson() && this.recipientDid) {
|
||||||
return {
|
return {
|
||||||
did: this.recipientDid,
|
did: this.recipientDid,
|
||||||
name: this.recipientName,
|
name: this.recipientName,
|
||||||
|
|||||||
Reference in New Issue
Block a user