0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-16 06:40:29 +01:00
discourse-custom-wizard/assets/javascripts/wizard/controllers/custom-step.js.es6

33 Zeilen
921 B
Text

2021-02-24 08:43:35 +01:00
import StepController from "wizard/controllers/step";
import getUrl from "discourse-common/lib/get-url";
export default StepController.extend({
actions: {
goNext(response) {
2021-02-24 08:43:35 +01:00
const next = this.get("step.next");
2019-08-29 01:51:18 +02:00
if (response.redirect_on_next) {
window.location.href = response.redirect_on_next;
} else if (response.refresh_required) {
2021-02-24 08:43:35 +01:00
const id = this.get("wizard.id");
2017-10-17 15:17:53 +02:00
window.location.href = getUrl(`/w/${id}/steps/${next}`);
} else {
2021-02-24 08:43:35 +01:00
this.transitionToRoute("custom.step", next);
}
},
goBack() {
2021-02-24 08:43:35 +01:00
this.transitionToRoute("custom.step", this.get("step.previous"));
2017-10-13 15:02:34 +02:00
},
showMessage(message) {
2021-02-24 08:43:35 +01:00
this.set("stepMessage", message);
2019-07-27 09:01:29 +02:00
},
resetWizard() {
2021-02-24 08:43:35 +01:00
const id = this.get("wizard.id");
const stepId = this.get("step.id");
2019-07-27 09:01:29 +02:00
window.location.href = getUrl(`/w/${id}/steps/${stepId}?reset=true`);
2021-02-24 08:43:35 +01:00
},
},
});