From a1ed9519318259d59428d7b5296b7e02ee75d72f Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Wed, 12 Mar 2014 13:20:50 +1100 Subject: [PATCH] Default shipping address same as billing address, rendering data panel for pickup info --- .../darkswarm/controllers/checkout_controller.js.coffee | 4 +--- app/views/shop/checkout/_form.html.haml | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee index 8349ef1a81..54c949d247 100644 --- a/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/checkout_controller.js.coffee @@ -1,14 +1,12 @@ angular.module("Checkout").controller "CheckoutCtrl", ($scope, $rootScope, order) -> $scope.require_ship_address = false - $scope.shipping_method = -1 - $scope.payment_method = -1 - $scope.same_as_billing = true $scope.order = order # Our shipping_methods comes through as a hash like so: {id: requires_shipping_address} # 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 $scope.require_ship_address = $scope.order.shipping_methods[$scope.order.shipping_method_id] $scope.shippingMethodChanged = -> diff --git a/app/views/shop/checkout/_form.html.haml b/app/views/shop/checkout/_form.html.haml index 6213cbf3ac..fa08d0c451 100644 --- a/app/views/shop/checkout/_form.html.haml +++ b/app/views/shop/checkout/_form.html.haml @@ -57,11 +57,16 @@ "ng-change" => "shippingMethodChanged()", "ng-model" => "order.shipping_method_id" + #distributor_address.panel{"ng-show" => "!require_ship_address"} + = @order.distributor.distributor_info.andand.html_safe + = @order.order_cycle.pickup_time_for(@order.distributor) + = @order.order_cycle.pickup_instructions_for(@order.distributor) + = f.fields_for :ship_address, @order.ship_address do |sa| + #ship_address{"ng-show" => "require_ship_address"} %label = check_box_tag "order[ship_address_same_as_billing]", true, @order.ship_address_same_as_billing, - "ng-checked" => "order.ship_address_same_as_billing == 'true'", "ng-model" => "order.ship_address_same_as_billing" Shipping address same as billing address?