Skip to content

A platform for community discussion. Free, open, simple.

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

Arpit Jalancfd0a04965fc
diff --git a/app/assets/javascripts/wizard/addon/components/wizard-step.js b/app/assets/javascripts/wizard/addon/components/wizard-step.js
index c3777684dea..84e14b1f223 100644
--- a/app/assets/javascripts/wizard/addon/components/wizard-step.js
+++ b/app/assets/javascripts/wizard/addon/components/wizard-step.js
@@ -17,34 +17,44 @@ export default Component.extend({
this.autoFocus();
},
+ @discourseComputed("step.index")
+ showBackButton(index) {
+ return index > 0;
+ },
+
@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")
+ nextButtonLabel(step) {
+ return `wizard.${step === "ready" ? "configure_more" : "next"}`;
},
@discourseComputed("step.id")
- showFinishButton(step) {
- return step === "styling" || step === "branding";
+ nextButtonClass(step) {
+ return step === "ready" ? "configure-more" : "next";
},
- @discourseComputed("step.index")
- showBackButton(index) {
- return index > 0;
+ @discourseComputed("step.id")
+ showJumpInButton(step) {
+ return step === "ready";
},
@discourseComputed("step.id")
- nextButtonLabel(step) {
- return `wizard.${step === "ready" ? "configure_more" : "next"}`;
+ showFinishButton(step) {
+ return ["styling", "branding", "corporate"].includes(step);
},
@discourseComputed("step.id")
- nextButtonClass(step) {
- return step === "ready" ? "configure-more" : "next";
+ finishButtonLabel(step) {
+ return `wizard.${step === "corporate" ? "jump_in" : "finish"}`;
+ },
+
+ @discourseComputed("step.id")
+ finishButtonClass(step) {
+ return step === "corporate" ? "jump-in" : "finish";
},
@discourseComputed("step.id")
@@ -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");
diff --git a/app/assets/javascripts/wizard/addon/templates/components/wizard-step.hbs b/app/assets/javascripts/wizard/addon/templates/components/wizard-step.hbs
index 37e74bdb82d..6807ebc0ccb 100644
--- a/app/assets/javascripts/wizard/addon/templates/components/wizard-step.hbs
+++ b/app/assets/javascripts/wizard/addon/templates/components/wizard-step.hbs
@@ -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}}
diff --git a/app/assets/javascripts/wizard/addon/test-helpers/wizard-pretender.js b/app/assets/javascripts/wizard/addon/test-helpers/wizard-pretender.js
index a3c9cf85958..d6b65853ce3 100644
--- a/app/assets/javascripts/wizard/addon/test-helpers/wizard-pretender.js
+++ b/app/assets/javascripts/wizard/addon/test-helpers/wizard-pretender.js
@@ -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 },
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 17dcbfd8991..591125ae617 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -5718,7 +5718,7 @@ en:
wizard_js:
wizard:
- done: "Jump in!"
+ jump_in: "Jump in!"
finish: "Exit setup"
back: "Back"
next: "Next"