mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Finally fixing the same as billing address checkbox?
This commit is contained in:
@@ -7,6 +7,7 @@ angular.module("Checkout").controller "CheckoutCtrl", ($scope, $rootScope, order
|
||||
# Here we default to the first shipping method if none is selected
|
||||
$scope.order.shipping_method_id ||= Object.keys(order.shipping_methods)[0]
|
||||
$scope.order.ship_address_same_as_billing = true if $scope.order.ship_address_same_as_billing == null
|
||||
|
||||
$scope.require_ship_address = $scope.order.shipping_methods[$scope.order.shipping_method_id]
|
||||
|
||||
$scope.shippingMethodChanged = ->
|
||||
|
||||
@@ -65,6 +65,12 @@ Spree::Order.class_eval do
|
||||
where("state != ?", state)
|
||||
}
|
||||
|
||||
# Accessors
|
||||
#
|
||||
def ship_address_same_as_billing=(string_value)
|
||||
@ship_address_same_as_billing = (string_value == "true")
|
||||
end
|
||||
|
||||
|
||||
# -- Methods
|
||||
def products_available_from_new_distribution
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
|
||||
#ship_address{"ng-show" => "require_ship_address"}
|
||||
%label
|
||||
= hidden_field_tag "order[ship_address_same_as_billing]", "false"
|
||||
= check_box_tag "order[ship_address_same_as_billing]", true, @order.ship_address_same_as_billing,
|
||||
"ng-model" => "order.ship_address_same_as_billing"
|
||||
Shipping address same as billing address?
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
object current_order
|
||||
attributes :id, :email, :shipping_method_id
|
||||
node :ship_address_same_as_billing do
|
||||
current_order.ship_address_same_as_billing == "true"
|
||||
end
|
||||
attributes :id, :email, :shipping_method_id, :ship_address_same_as_billing
|
||||
|
||||
child current_order.bill_address => :bill_address do
|
||||
attributes :phone, :firstname, :lastname, :address1, :address2, :city, :country_id, :state_id, :zipcode
|
||||
|
||||
Reference in New Issue
Block a user