2021-04-12 08:26:22 +02:00
|
|
|
/* eslint no-undef: 0*/
|
2018-03-06 04:38:33 +01:00
|
|
|
|
2021-04-20 19:58:19 +02:00
|
|
|
import { findCustomWizard, updateCachedWizard } from "../models/custom";
|
2021-03-28 11:06:49 +02:00
|
|
|
import { ajax } from "wizard/lib/ajax";
|
2017-10-13 15:02:34 +02:00
|
|
|
|
|
|
|
export default Ember.Route.extend({
|
2019-07-02 06:49:14 +02:00
|
|
|
beforeModel(transition) {
|
2021-03-28 11:06:49 +02:00
|
|
|
this.set("queryParams", transition.intent.queryParams);
|
2019-07-02 06:49:14 +02:00
|
|
|
},
|
|
|
|
|
2017-10-13 15:02:34 +02:00
|
|
|
model(params) {
|
2021-03-28 11:06:49 +02:00
|
|
|
return findCustomWizard(params.wizard_id, this.get("queryParams"));
|
2017-10-13 15:02:34 +02:00
|
|
|
},
|
|
|
|
|
2021-04-20 19:58:19 +02:00
|
|
|
afterModel(model) {
|
|
|
|
updateCachedWizard(model);
|
|
|
|
|
2017-10-13 15:02:34 +02:00
|
|
|
return ajax({
|
|
|
|
url: `/site/settings`,
|
2021-03-28 11:06:49 +02:00
|
|
|
type: "GET",
|
2017-10-13 15:02:34 +02:00
|
|
|
}).then((result) => {
|
2018-06-14 01:59:41 +02:00
|
|
|
$.extend(Wizard.SiteSettings, result);
|
2017-10-13 15:02:34 +02:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
2021-03-28 11:06:49 +02:00
|
|
|
const background = model ? model.get("background") : "AliceBlue";
|
|
|
|
Ember.run.scheduleOnce("afterRender", this, function () {
|
|
|
|
$("body.custom-wizard").css("background", background);
|
2021-04-20 19:58:19 +02:00
|
|
|
|
|
|
|
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,
|
2021-03-28 11:06:49 +02:00
|
|
|
reset: null,
|
2017-10-13 15:02:34 +02:00
|
|
|
});
|
2021-03-28 11:06:49 +02:00
|
|
|
},
|
2017-10-13 15:02:34 +02:00
|
|
|
});
|