Fixing a Javascript bug

This commit is contained in:
Will Marshall
2014-02-27 14:47:33 +11:00
parent 18f92fbff5
commit 91a8e1c071
2 changed files with 5 additions and 2 deletions

View File

@@ -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()

View File

@@ -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