Class: Stall::Checkout::StepsController

Inherits:
ApplicationController show all
Includes:
Stall::CheckoutHelper
Defined in:
app/controllers/stall/checkout/steps_controller.rb

Instance Method Summary collapse

Methods included from Stall::CheckoutHelper

#available_shipping_methods_for, #step_path

Instance Method Details

#changeObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/stall/checkout/steps_controller.rb', line 25

def change
  target_step = params[:step]

  if @wizard.step_complete?(target_step)
    @wizard.move_to_step!(target_step)
    redirect_to step_path
  else
    @step.prepare
    flash[:error] ||= t("stall.checkout.#{ target_step }.error")
    render 'show'
  end
end

#showObject



10
11
12
# File 'app/controllers/stall/checkout/steps_controller.rb', line 10

def show
  @step.prepare
end

#updateObject



14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/stall/checkout/steps_controller.rb', line 14

def update
  if @step.process
    @wizard.validate_current_step!
    redirect_to step_path
  else
    @step.prepare
    flash[:error] ||= t("stall.checkout.#{ @wizard.current_step_name }.error")
    render 'show'
  end
end