1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/wizard/routes/custom-index.js.es6
2020-03-30 17:16:03 +11:00

34 Zeilen
829 B
JavaScript

export default Ember.Route.extend({
beforeModel() {
const appModel = this.modelFor('custom');
if (appModel && appModel.permitted && !appModel.completed && appModel.start) {
this.replaceWith('custom.step', appModel.start);
}
},
model() {
return this.modelFor('custom');
},
setupController(controller, model) {
if (model) {
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');
controller.setProperties({
requiresLogin: !user,
user,
name,
completed,
notPermitted: !permitted,
minTrust,
wizardId
});
} else {
controller.set('noWizard', true);
}
}
});