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:
Ursprung
8dfbb273ca
Commit
0d4ecc3c90
4 geänderte Dateien mit 20 neuen und 10 gelöschten Zeilen
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -4,4 +4,7 @@
|
|||
{{#if notPermitted}}
|
||||
{{i18n 'wizard.not_permitted' level=minTrust}}
|
||||
{{/if}}
|
||||
{{#if noWizard}}
|
||||
{{i18n 'wizard.none'}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
@ -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."
|
||||
|
|
Laden …
In neuem Issue referenzieren