Commit c0574309 authored by Bryce Johnson's avatar Bryce Johnson

Clean up approvals body computed logic.

parent 9e874405
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
props: ['approvedBy', 'approvalsLeft', 'userCanApprove', 'userHasApproved', 'suggestedApprovers', 'widgetLoading'], props: ['approvedBy', 'approvalsLeft', 'userCanApprove', 'userHasApproved', 'suggestedApprovers', 'widgetLoading'],
computed: { computed: {
approvalsRequiredStringified() { approvalsRequiredStringified() {
return this.approvalsLeft === 1 ? 'one more approval' : const baseString = `${this.approvalsLeft} more approval`;
`${this.approvalsLeft} more approvals`; return this.approvalsLeft === 1 ? baseString : `${baseString}s`;
}, },
approverNamesStringified() { approverNamesStringified() {
const approvers = this.suggestedApprovers; const approvers = this.suggestedApprovers;
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
return `${nextMemo}, `; return `${nextMemo}, `;
}, ''); }, '');
}
}, },
showApproveButton() { showApproveButton() {
return this.userCanApprove && !this.userHasApproved; return this.userCanApprove && !this.userHasApproved;
...@@ -41,7 +40,7 @@ ...@@ -41,7 +40,7 @@
template: ` template: `
<div class='approvals-body mr-widget-body'> <div class='approvals-body mr-widget-body'>
<h4> Requires {{ approvalsRequiredStringified }} <h4> Requires {{ approvalsRequiredStringified }}
<span v-if='!!suggestedApprovers.length'> (from {{ approverNamesStringified }}) </span> <span> (from {{ approverNamesStringified }}) </span>
</h4> </h4>
<div v-if='showApproveButton' class='append-bottom-10'> <div v-if='showApproveButton' class='append-bottom-10'>
<button <button
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment