0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-16 14:50:28 +01:00
discourse-custom-wizard/assets/javascripts/wizard/routes/custom.js.es6

42 Zeilen
1 KiB
Text

/* eslint no-undef: 0*/
import { findCustomWizard, updateCachedWizard } from "../models/custom";
import { ajax } from "wizard/lib/ajax";
2017-10-13 15:02:34 +02:00
export default Ember.Route.extend({
beforeModel(transition) {
this.set("queryParams", transition.intent.queryParams);
},
2017-10-13 15:02:34 +02:00
model(params) {
return findCustomWizard(params.wizard_id, this.get("queryParams"));
2017-10-13 15:02:34 +02:00
},
afterModel(model) {
updateCachedWizard(model);
2017-10-13 15:02:34 +02:00
return ajax({
url: `/site/settings`,
type: "GET",
2017-10-13 15:02:34 +02:00
}).then((result) => {
$.extend(Wizard.SiteSettings, result);
2017-10-13 15:02:34 +02:00
});
},
setupController(controller, model) {
const background = model ? model.get("background") : "AliceBlue";
Ember.run.scheduleOnce("afterRender", this, function () {
$("body.custom-wizard").css("background", background);
if (model && model.id) {
$("#custom-wizard-main").addClass(model.id.dasherize());
2017-12-03 08:57:40 +01:00
}
2017-10-13 15:02:34 +02:00
});
controller.setProperties({
customWizard: true,
2019-07-27 09:07:22 +02:00
logoUrl: Wizard.SiteSettings.logo_small,
reset: null,
2017-10-13 15:02:34 +02:00
});
},
2017-10-13 15:02:34 +02:00
});