Class: Stall::Checkout::StepsController

Inherits:
Stall::CheckoutBaseController show all
Defined in:
app/controllers/stall/checkout/steps_controller.rb

Instance Method Summary collapse

Methods inherited from Stall::CheckoutBaseController

#set_stall_layout

Methods included from Stall::CheckoutHelper

#available_shipping_methods_for, #step_path

Instance Method Details

#changeObject



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

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



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

def show
  @step.prepare
end

#updateObject Also known as: foreign_update



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

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