0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-15 22:32:54 +01:00
discourse-custom-wizard/assets/javascripts/wizard/routes/custom-index.js.es6

39 Zeilen
843 B
Text

2017-10-13 15:02:34 +02:00
export default Ember.Route.extend({
beforeModel() {
2021-02-24 08:43:35 +01:00
const appModel = this.modelFor("custom");
if (
appModel &&
appModel.permitted &&
!appModel.completed &&
appModel.start
) {
this.replaceWith("custom.step", appModel.start);
2017-10-13 15:02:34 +02:00
}
},
2017-11-29 10:48:49 +01:00
model() {
2021-02-24 08:43:35 +01:00
return this.modelFor("custom");
2017-11-29 10:48:49 +01:00
},
setupController(controller, model) {
2017-12-03 08:57:40 +01:00
if (model) {
2021-02-24 08:43:35 +01:00
const completed = model.get("completed");
const permitted = model.get("permitted");
const wizardId = model.get("id");
const user = model.get("user");
const name = model.get("name");
2017-12-03 08:57:40 +01:00
controller.setProperties({
2019-06-19 07:23:10 +02:00
requiresLogin: !user,
user,
2019-06-19 07:39:39 +02:00
name,
2017-12-03 08:57:40 +01:00
completed,
notPermitted: !permitted,
2021-02-24 08:43:35 +01:00
wizardId,
2017-12-03 08:57:40 +01:00
});
} else {
2021-02-24 08:43:35 +01:00
controller.set("noWizard", true);
2017-12-03 08:57:40 +01:00
}
2021-02-24 08:43:35 +01:00
},
});