custom-step.js.es6 629 B

123456789101112131415161718192021222324
  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. }
  21. });