0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00

FIX: pass restart_on_revisit as option on initial load

Dieser Commit ist enthalten in:
Angus McLeod 2019-11-15 10:29:48 +11:00
Ursprung acad46b246
Commit c812f60fd7
2 geänderte Dateien mit 2 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -22,7 +22,7 @@ class CustomWizard::WizardController < ::ApplicationController
format.json do
builder = CustomWizard::Builder.new(current_user, params[:wizard_id].underscore)
builder_opts = {}
builder_opts[:reset] = params[:reset] if params[:reset]
builder_opts[:reset] = params[:reset] || builder.wizard.restart_on_revisit
if builder.wizard.present?
wizard = builder.build(builder_opts, params)

Datei anzeigen

@ -78,8 +78,7 @@ class CustomWizard::Builder
def build(build_opts = {}, params = {})
unless (@wizard.completed? && !@wizard.multiple_submissions && !@wizard.user.admin) || !@steps || !@wizard.permitted?
reset_submissions if build_opts[:reset] || @wizard.restart_on_revisit
reset_submissions if build_opts[:reset]
@steps.each do |step_template|
@wizard.append_step(step_template['id']) do |step|