mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-18 04:39:14 +00:00
Able to submit Checkout form via Ajax
This commit is contained in:
@@ -10,7 +10,7 @@ Darkswarm.factory 'Order', ($resource, Product, order, $http)->
|
||||
submit: ->
|
||||
$http.put('/shop/checkout', {order: @preprocess()}).success (data, status)=>
|
||||
console.log data
|
||||
# Navigate to order confirmation
|
||||
window.location.pathname = data.path
|
||||
.error (errors, status)=>
|
||||
console.log "error"
|
||||
@errors = errors
|
||||
@@ -23,6 +23,8 @@ Darkswarm.factory 'Order', ($resource, Product, order, $http)->
|
||||
munged_order["bill_address_attributes"] = value
|
||||
else if name == "ship_address"
|
||||
munged_order["ship_address_attributes"] = value
|
||||
else if name == "payment_method_id"
|
||||
munged_order["payments_attributes"] = [{payment_method_id: value}]
|
||||
else
|
||||
munged_order[name] = value
|
||||
munged_order
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"ng-model" => "order.bill_address.city"
|
||||
|
||||
.large-6.columns
|
||||
= ba.select :state_id, @order.billing_address.country.states.map{|c|[c.name, c.id]},
|
||||
= ba.select :state_id, @order.billing_address.country.states.map{|c|[c.name, c.id]}, {include_blank: false},
|
||||
"ng-model" => "order.bill_address.state_id"
|
||||
.row
|
||||
.large-6.columns
|
||||
|
||||
@@ -94,7 +94,6 @@ describe Shop::CheckoutController do
|
||||
it "returns order confirmation url on success" do
|
||||
order.stub(:update_attributes).and_return true
|
||||
order.stub(:state).and_return "complete"
|
||||
#order.stub(:completed?).and_return true
|
||||
|
||||
xhr :post, :update, order: {}, use_route: :spree
|
||||
response.status.should == 200
|
||||
|
||||
Reference in New Issue
Block a user