Created
November 2, 2012 12:50
-
-
Save jordanmaguire/4001202 to your computer and use it in GitHub Desktop.
Original Wizard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OnlineEnquiryWizard < EnquiryWizard | |
# Called within the CapacityCheckController to find which step to go to | |
# if 'previous' is pressed on the first step of the first CapacityCheck | |
def step_before_capacity_check | |
if @object.vehicle_selection_method == "none" | |
"select_vehicle" | |
else | |
"duty_of_disclosure" | |
end | |
end | |
# This method returns which step should come up when an enquiry is considered approved, declined or referred | |
def approved_declined_referred_step | |
if @object.enquiry_pass? | |
return "enquiry_pre_approved" | |
else | |
if @object.declined_reasons.any? | |
return "enquiry_declined" | |
elsif @object.referred_reasons.any? | |
return "enquiry_referred" | |
end | |
end | |
end | |
def next_step current_step | |
case current_step.to_s | |
when "privacy_consent" | |
if @object.should_have_more_privacy_consent? or @object.next_privacy_consent | |
return "next_privacy_consent" | |
else | |
return approved_declined_referred_step | |
end | |
when "upload_documentation" | |
return "complete" | |
end | |
super current_step | |
end | |
def prev_step current_step | |
case current_step.to_s | |
when "privacy_consent" | |
return "previous_privacy_consent" if @object.previous_privacy_consent | |
when "enquiry_declined", "enquiry_referred" | |
return "privacy_consent" | |
end | |
super current_step | |
end | |
def label_for_next_button current_step | |
case current_step | |
when "postal_address" | |
return "Next Customer" if @object.customer_group.has_next_customer? | |
end | |
super current_step | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment