1
0
Fork 0

Handle id for which there is no wizard

Dieser Commit ist enthalten in:
Angus McLeod 2017-12-03 15:57:40 +08:00
Ursprung 8dfbb273ca
Commit 0d4ecc3c90
4 geänderte Dateien mit 20 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,7 @@
export default Ember.Route.extend({ export default Ember.Route.extend({
beforeModel() { beforeModel() {
const appModel = this.modelFor('custom'); 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); this.replaceWith('custom.step', appModel.start);
} }
}, },
@ -11,6 +11,7 @@ export default Ember.Route.extend({
}, },
setupController(controller, model) { setupController(controller, model) {
if (model) {
const completed = model.get('completed'); const completed = model.get('completed');
const permitted = model.get('permitted'); const permitted = model.get('permitted');
const minTrust = model.get('min_trust'); const minTrust = model.get('min_trust');
@ -19,5 +20,8 @@ export default Ember.Route.extend({
notPermitted: !permitted, notPermitted: !permitted,
minTrust minTrust
}); });
} else {
controller.set('noWizard', true);
}
} }
}); });

Datei anzeigen

@ -19,7 +19,9 @@ export default Ember.Route.extend({
const background = model ? model.get('background') : 'AliceBlue'; const background = model ? model.get('background') : 'AliceBlue';
Ember.run.scheduleOnce('afterRender', this, function(){ Ember.run.scheduleOnce('afterRender', this, function(){
$('body.custom-wizard').css('background', background); $('body.custom-wizard').css('background', background);
if (model) {
$('#custom-wizard-main').addClass(model.get('id').dasherize()); $('#custom-wizard-main').addClass(model.get('id').dasherize());
}
}); });
controller.setProperties({ controller.setProperties({

Datei anzeigen

@ -4,4 +4,7 @@
{{#if notPermitted}} {{#if notPermitted}}
{{i18n 'wizard.not_permitted' level=minTrust}} {{i18n 'wizard.not_permitted' level=minTrust}}
{{/if}} {{/if}}
{{#if noWizard}}
{{i18n 'wizard.none'}}
{{/if}}
{{/if}} {{/if}}

Datei anzeigen

@ -153,3 +153,4 @@ en:
wizard: wizard:
completed: "You have completed this wizard." completed: "You have completed this wizard."
not_permitted: "You need to be trust level {{level}} or higher to access this wizard." not_permitted: "You need to be trust level {{level}} or higher to access this wizard."
none: "There is no wizard here."