Patching a minor bug in cart emptying

This commit is contained in:
Will Marshall
2014-06-10 15:21:41 +10:00
parent 98611c3672
commit f6690cb8dd

View File

@@ -5,12 +5,13 @@ Darkswarm.directive "ofnEmptiesCart", (CurrentHub, CurrentOrder, Navigation, sto
template: "{{action}} <strong>{{hub.name}}</strong>"
link: (scope, elm, attr)->
# A hub is selected, we're changing to a different hub, and the cart isn't empty
if CurrentHub.id and CurrentHub.id isnt scope.hub.id and not CurrentOrder.empty()
if CurrentHub.id and CurrentHub.id isnt scope.hub.id
scope.action = attr.change
elm.bind 'click', (ev)->
ev.preventDefault()
if confirm "Are you sure? This will change your selected Hub and remove any items in you shopping cart."
storage.clearAll() # One day this will have to be moar GRANULAR
Navigation.go scope.hub.path
unless CurrentOrder.empty()
elm.bind 'click', (ev)->
ev.preventDefault()
if confirm "Are you sure? This will change your selected Hub and remove any items in you shopping cart."
storage.clearAll() # One day this will have to be moar GRANULAR
Navigation.go scope.hub.path
else
scope.action = attr.shop