FIX: wizard last step "corporate" was not saving changes (#17739)

This commit is contained in:
Arpit Jalan 2022-08-01 14:49:09 +05:30 committed by GitHub
parent 6ce75d3824
commit cfd0a04965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 23 deletions

View File

@ -17,26 +17,16 @@ export default Component.extend({
this.autoFocus();
},
@discourseComputed("step.displayIndex", "wizard.totalSteps")
showNextButton(current, total) {
return current < total;
},
@discourseComputed("step.id", "step.displayIndex", "wizard.totalSteps")
showDoneButton(step, current, total) {
return step === "ready" || current === total;
},
@discourseComputed("step.id")
showFinishButton(step) {
return step === "styling" || step === "branding";
},
@discourseComputed("step.index")
showBackButton(index) {
return index > 0;
},
@discourseComputed("step.displayIndex", "wizard.totalSteps")
showNextButton(current, total) {
return current < total;
},
@discourseComputed("step.id")
nextButtonLabel(step) {
return `wizard.${step === "ready" ? "configure_more" : "next"}`;
@ -47,6 +37,26 @@ export default Component.extend({
return step === "ready" ? "configure-more" : "next";
},
@discourseComputed("step.id")
showJumpInButton(step) {
return step === "ready";
},
@discourseComputed("step.id")
showFinishButton(step) {
return ["styling", "branding", "corporate"].includes(step);
},
@discourseComputed("step.id")
finishButtonLabel(step) {
return `wizard.${step === "corporate" ? "jump_in" : "finish"}`;
},
@discourseComputed("step.id")
finishButtonClass(step) {
return step === "corporate" ? "jump-in" : "finish";
},
@discourseComputed("step.id")
stepClass(step) {
return step;
@ -73,7 +83,7 @@ export default Component.extend({
keyPress(event) {
if (event.key === "Enter") {
if (this.showDoneButton) {
if (this.showJumpInButton) {
this.send("quit");
} else {
this.send("nextStep");

View File

@ -42,9 +42,9 @@
<div class="wizard-container__buttons">
{{#if this.showDoneButton}}
{{#if this.showJumpInButton}}
<button {{action "quit"}} disabled={{this.saving}} type="button" class="wizard-container__button jump-in">
{{i18n "wizard.done"}}
{{i18n "wizard.jump_in"}}
</button>
{{/if}}
@ -55,8 +55,8 @@
{{/if}}
{{#if this.showFinishButton}}
<button {{action "exitEarly"}} disabled={{this.saving}} type="button" class="wizard-container__button finish">
{{i18n "wizard.finish"}}
<button {{action "exitEarly"}} disabled={{this.saving}} type="button" class="wizard-container__button {{this.finishButtonClass}}">
{{i18n this.finishButtonLabel}}
</button>
{{/if}}

View File

@ -28,10 +28,10 @@ export default function (helpers) {
index: 1,
fields: [{ id: "some-title", type: "text" }],
previous: "hello-world",
next: "last-step",
next: "corporate",
},
{
id: "last-step",
id: "corporate",
index: 2,
fields: [
{ id: "snack", type: "dropdown", required: true },

View File

@ -5718,7 +5718,7 @@ en:
wizard_js:
wizard:
done: "Jump in!"
jump_in: "Jump in!"
finish: "Exit setup"
back: "Back"
next: "Next"