custom.js.es6 835 B

1234567891011121314151617181920212223242526272829303132
  1. import { findCustomWizard } from '../models/custom';
  2. import { ajax } from 'wizard/lib/ajax';
  3. export default Ember.Route.extend({
  4. model(params) {
  5. return findCustomWizard(params.wizard_id);
  6. },
  7. afterModel() {
  8. return ajax({
  9. url: `/site/settings`,
  10. type: 'GET',
  11. }).then((result) => {
  12. Object.assign(Wizard.SiteSettings, result);
  13. });
  14. },
  15. setupController(controller, model) {
  16. const background = model ? model.get('background') : 'AliceBlue';
  17. Ember.run.scheduleOnce('afterRender', this, function(){
  18. $('body.custom-wizard').css('background', background);
  19. if (model) {
  20. $('#custom-wizard-main').addClass(model.get('id').dasherize());
  21. }
  22. });
  23. controller.setProperties({
  24. customWizard: true,
  25. logoUrl: Wizard.SiteSettings.logo_small_url
  26. });
  27. }
  28. });