custom.js.es6 907 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { findCustomWizard } from '../models/custom';
  2. import { ajax } from 'wizard/lib/ajax';
  3. import { getUrl } from 'discourse-common/lib/get-url';
  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. Object.assign(Wizard.SiteSettings, result);
  14. });
  15. },
  16. setupController(controller, model) {
  17. Ember.run.scheduleOnce('afterRender', this, function(){
  18. $('body.custom-wizard').css('background', model.get('background'));
  19. });
  20. controller.setProperties({
  21. customWizard: true,
  22. logoUrl: Wizard.SiteSettings.logo_small_url
  23. });
  24. },
  25. actions: {
  26. finished(result) {
  27. let url = "/";
  28. if (result.topic_id) url += `t/${result.topic_id}`;
  29. document.location.replace(getUrl(url));
  30. }
  31. }
  32. });