From f6690cb8ddf3a77fb9ef82c8d6a4dbfae639530b Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Tue, 10 Jun 2014 15:21:41 +1000 Subject: [PATCH] Patching a minor bug in cart emptying --- .../darkswarm/directives/empties_cart.js.coffee | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/darkswarm/directives/empties_cart.js.coffee b/app/assets/javascripts/darkswarm/directives/empties_cart.js.coffee index 0b29180b57..4691d9b830 100644 --- a/app/assets/javascripts/darkswarm/directives/empties_cart.js.coffee +++ b/app/assets/javascripts/darkswarm/directives/empties_cart.js.coffee @@ -5,12 +5,13 @@ Darkswarm.directive "ofnEmptiesCart", (CurrentHub, CurrentOrder, Navigation, sto template: "{{action}} {{hub.name}}" 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