custom-step.js.es6 799 B

1234567891011121314151617181920212223242526272829303132
  1. import StepController from 'wizard/controllers/step';
  2. import getUrl from 'discourse-common/lib/get-url';
  3. export default StepController.extend({
  4. actions: {
  5. goNext(response) {
  6. const next = this.get('step.next');
  7. if (response.refresh_required) {
  8. const id = this.get('wizard.id');
  9. window.location.href = getUrl(`/w/${id}/steps/${next}`);
  10. } else {
  11. this.transitionToRoute('custom.step', next);
  12. }
  13. },
  14. goBack() {
  15. this.transitionToRoute('custom.step', this.get('step.previous'));
  16. },
  17. showMessage(message) {
  18. this.set('stepMessage', message);
  19. },
  20. finished(result) {
  21. let url = "/";
  22. if (result.topic_id) {
  23. url += `t/${result.topic_id}`;
  24. }
  25. window.location.href = getUrl(url);
  26. }
  27. }
  28. });