custom.js.es6 856 B

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