Tweaks for laura, reworking authentication workflow, tidying up checkout

This commit is contained in:
Will Marshall
2014-05-09 15:41:18 +10:00
parent 5a0cc1b6db
commit f25617dde7
17 changed files with 75 additions and 49 deletions

View File

@@ -3,4 +3,8 @@ Darkswarm.controller "BillingCtrl", ($scope) ->
$scope.name = "billing"
$scope.nextPanel = "shipping"
$scope.summary = ->
[$scope.order.bill_address.address1,
$scope.order.bill_address.city,
$scope.order.bill_address.zipcode]

View File

@@ -3,6 +3,15 @@ Darkswarm.controller "DetailsCtrl", ($scope) ->
$scope.name = "details"
$scope.nextPanel = "billing"
$scope.summary = ->
[$scope.fullName(),
$scope.order.email,
$scope.order.bill_address.phone]
$scope.fullName = ->
[$scope.order.bill_address.firstname ? null,
$scope.order.bill_address.lastname ? null].join(" ").trim()
#$scope.$watch ->
#$scope.detailsValid()

View File

@@ -1,6 +1,13 @@
Darkswarm.filter "printArray", ->
Darkswarm.filter "printArrayOfObjects", ->
(array, attr = 'name')->
array ?= []
array.map (a)->
a[attr].toLowerCase()
.join(", ")
Darkswarm.filter "printArray", ->
(array)->
array ?= []
output = (item for item in array when item).join ", "
output

View File

@@ -4,8 +4,6 @@ Darkswarm.factory 'Order', ($resource, Product, order, $http, CheckoutFormState,
constructor: ->
@order = order
# Default to first shipping method if none selected
@order.shipping_method_id ||= parseInt(Object.keys(@order.shipping_methods)[0])
submit: ->
$http.put('/checkout', {order: @preprocess()}).success (data, status)=>
@@ -35,7 +33,7 @@ Darkswarm.factory 'Order', ($resource, Product, order, $http, CheckoutFormState,
munged_order
shippingMethod: ->
@order.shipping_methods[@order.shipping_method_id]
@order.shipping_methods[@order.shipping_method_id] if @order.shipping_method_id
requireShipAddress: ->
@shippingMethod()?.require_ship_address