From faa8c11d453baa3436e446e12f82a75ae96d8d12 Mon Sep 17 00:00:00 2001 From: Thomas EUDE Date: Sat, 2 Dec 2023 21:14:50 +0100 Subject: [PATCH 1/2] remove redirect for setup wazard --- lib/wicked/wizard.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/wicked/wizard.rb b/lib/wicked/wizard.rb index 309b0a3..f0ffbcc 100644 --- a/lib/wicked/wizard.rb +++ b/lib/wicked/wizard.rb @@ -49,16 +49,10 @@ def wizard_value(step_name) @wicked_redirect_params = nil end - private def check_redirect_to_first_last!(step) - redirect_to wizard_path(steps.first) if step.to_s == Wicked::FIRST_STEP - redirect_to wizard_path(steps.last) if step.to_s == Wicked::LAST_STEP - end - private def setup_step_from(the_step) return if steps.nil? the_step ||= steps.first - check_redirect_to_first_last!(the_step) valid_steps = steps + self.class::PROTECTED_STEPS resolved_step = valid_steps.detect { |stp| stp.to_s == the_step } From 280b4ac8ba5dd51939822670c02f845dd6f22519 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 3 Dec 2023 11:39:29 +0100 Subject: [PATCH 2/2] init first last step --- lib/wicked/wizard.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/wicked/wizard.rb b/lib/wicked/wizard.rb index f0ffbcc..b266b9d 100644 --- a/lib/wicked/wizard.rb +++ b/lib/wicked/wizard.rb @@ -49,10 +49,17 @@ def wizard_value(step_name) @wicked_redirect_params = nil end + private def check_first_last_step!(step) + return steps.first if step.to_s == Wicked::FIRST_STEP + return steps.last if step.to_s == Wicked::LAST_STEP + return step + end + private def setup_step_from(the_step) return if steps.nil? the_step ||= steps.first + the_step = check_first_last_step!(the_step) valid_steps = steps + self.class::PROTECTED_STEPS resolved_step = valid_steps.detect { |stp| stp.to_s == the_step }