diff --git a/assets/javascripts/wizard/routes/custom-index.js.es6 b/assets/javascripts/wizard/routes/custom-index.js.es6 index 261e07fd..b3fa3bd4 100644 --- a/assets/javascripts/wizard/routes/custom-index.js.es6 +++ b/assets/javascripts/wizard/routes/custom-index.js.es6 @@ -1,7 +1,7 @@ export default Ember.Route.extend({ beforeModel() { const appModel = this.modelFor('custom'); - if (appModel.permitted && !appModel.completed && appModel.start) { + if (appModel && appModel.permitted && !appModel.completed && appModel.start) { this.replaceWith('custom.step', appModel.start); } }, @@ -11,13 +11,17 @@ export default Ember.Route.extend({ }, setupController(controller, model) { - const completed = model.get('completed'); - const permitted = model.get('permitted'); - const minTrust = model.get('min_trust'); - controller.setProperties({ - completed, - notPermitted: !permitted, - minTrust - }); + if (model) { + const completed = model.get('completed'); + const permitted = model.get('permitted'); + const minTrust = model.get('min_trust'); + controller.setProperties({ + completed, + notPermitted: !permitted, + minTrust + }); + } else { + controller.set('noWizard', true); + } } }); diff --git a/assets/javascripts/wizard/routes/custom.js.es6 b/assets/javascripts/wizard/routes/custom.js.es6 index 0bcf8901..db5b4ca4 100644 --- a/assets/javascripts/wizard/routes/custom.js.es6 +++ b/assets/javascripts/wizard/routes/custom.js.es6 @@ -19,7 +19,9 @@ export default Ember.Route.extend({ const background = model ? model.get('background') : 'AliceBlue'; Ember.run.scheduleOnce('afterRender', this, function(){ $('body.custom-wizard').css('background', background); - $('#custom-wizard-main').addClass(model.get('id').dasherize()); + if (model) { + $('#custom-wizard-main').addClass(model.get('id').dasherize()); + } }); controller.setProperties({ diff --git a/assets/javascripts/wizard/templates/custom.index.hbs b/assets/javascripts/wizard/templates/custom.index.hbs index 8bbddfcb..7223b017 100644 --- a/assets/javascripts/wizard/templates/custom.index.hbs +++ b/assets/javascripts/wizard/templates/custom.index.hbs @@ -4,4 +4,7 @@ {{#if notPermitted}} {{i18n 'wizard.not_permitted' level=minTrust}} {{/if}} + {{#if noWizard}} + {{i18n 'wizard.none'}} + {{/if}} {{/if}} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 65f97310..b199ba95 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -153,3 +153,4 @@ en: wizard: completed: "You have completed this wizard." not_permitted: "You need to be trust level {{level}} or higher to access this wizard." + none: "There is no wizard here."