Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +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({
|
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,13 +11,17 @@ export default Ember.Route.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
const completed = model.get('completed');
|
if (model) {
|
||||||
const permitted = model.get('permitted');
|
const completed = model.get('completed');
|
||||||
const minTrust = model.get('min_trust');
|
const permitted = model.get('permitted');
|
||||||
controller.setProperties({
|
const minTrust = model.get('min_trust');
|
||||||
completed,
|
controller.setProperties({
|
||||||
notPermitted: !permitted,
|
completed,
|
||||||
minTrust
|
notPermitted: !permitted,
|
||||||
});
|
minTrust
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
controller.set('noWizard', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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);
|
||||||
$('#custom-wizard-main').addClass(model.get('id').dasherize());
|
if (model) {
|
||||||
|
$('#custom-wizard-main').addClass(model.get('id').dasherize());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
|
|
|
@ -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}}
|
||||||
|
|
|
@ -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."
|
||||||
|
|
Laden …
In neuem Issue referenzieren