diff --git a/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee index ed4aee83a3..40f8d221f8 100644 --- a/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee @@ -4,7 +4,8 @@ angular.module("Checkout").controller "CheckoutCtrl", ($scope, $rootScope) -> $scope.payment_method = -1 $scope.shippingMethodChanged = -> - $scope.require_ship_address = $("#order_shipping_method_" + $scope.shipping_method).attr("data-require-ship-address") + console.log $("#order_shipping_method_id_" + $scope.shipping_method).attr("data-require-ship-address") + $scope.require_ship_address = $("#order_shipping_method_id_" + $scope.shipping_method).attr("data-require-ship-address") $scope.purchase = (event)-> event.preventDefault() diff --git a/app/views/shop/checkout/_form.html.haml b/app/views/shop/checkout/_form.html.haml index e21c86a94e..2688a4dfb7 100644 --- a/app/views/shop/checkout/_form.html.haml +++ b/app/views/shop/checkout/_form.html.haml @@ -36,7 +36,9 @@ .large-6.columns.right = ba.text_field :zipcode + {{ require_ship_address }} %fieldset#shipping + %legend Shipping - checked_id = @order.shipping_method_id || current_distributor.shipping_methods.first.andand.id - for ship_method, i in current_distributor.shipping_methods.uniq @@ -44,7 +46,7 @@ .large-12.columns = f.radio_button :shipping_method_id, ship_method.id, text: ship_method.name, - "ng-init" => "shipping_method = #{checked_id}", + "ng-init" => "shipping_method = #{checked_id}; shippingMethodChanged()", "ng-model" => "shipping_method", "ng-change" => "shippingMethodChanged()", "data-require-ship-address" => ship_method.require_ship_address