0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-14 13:52:54 +01:00
discourse-custom-wizard/assets/javascripts/wizard/controllers/custom-step.js.es6
Angus McLeod cf50a7deb3
Apply prettier 💄 (#80)
* Apply prettier

* applied prettier for similar-topics-validator

Co-authored-by: Faizaan Gagan <fzngagan@gmail.com>
2021-03-28 14:36:49 +05:30

32 Zeilen
921 B
JavaScript

import StepController from "wizard/controllers/step";
import getUrl from "discourse-common/lib/get-url";
export default StepController.extend({
actions: {
goNext(response) {
const next = this.get("step.next");
if (response.redirect_on_next) {
window.location.href = response.redirect_on_next;
} else if (response.refresh_required) {
const id = this.get("wizard.id");
window.location.href = getUrl(`/w/${id}/steps/${next}`);
} else {
this.transitionToRoute("custom.step", next);
}
},
goBack() {
this.transitionToRoute("custom.step", this.get("step.previous"));
},
showMessage(message) {
this.set("stepMessage", message);
},
resetWizard() {
const id = this.get("wizard.id");
const stepId = this.get("step.id");
window.location.href = getUrl(`/w/${id}/steps/${stepId}?reset=true`);
},
},
});