Skip to content

Instantly share code, notes, and snippets.

@zevarito
Created August 9, 2013 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zevarito/6190362 to your computer and use it in GitHub Desktop.
Save zevarito/6190362 to your computer and use it in GitHub Desktop.
class Cart::WizardWidget < Cart::BaseWidget
has_widgets do
setup(options)
self << widget("cart/list", :cart_list, :display, purchase_order: @purchase_order)
self << widget("cart/resume", :cart_resume)
self << widget("shipping/form", :shipping_form, :display, purchase_order: @purchase_order)
self << widget("payment/form", :payment_form)
self << widget("authentication")
end
responds_to_event :selectShipping, with: :select_shipping
responds_to_event :shippingAddressSaved, with: :select_payment
responds_to_event :signIn, with: :select_sign_in
after_initialize :setup!
def setup!(*)
setup(options)
end
def setup(options)
@purchase_order ||= options.fetch(:purchase_order, nil)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment