0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-09 20:02:54 +01:00

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

Datei anzeigen

@ -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);
if (model) {
$('#custom-wizard-main').addClass(model.get('id').dasherize());
}
});
controller.setProperties({

Datei anzeigen

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

Datei anzeigen

@ -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."