mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
When order cycle is changed, clear the cart
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
# TODO this SUCKS. Fix it
|
||||
|
||||
Darkswarm.controller "OrderCycleCtrl", ($scope, $timeout, OrderCycle) ->
|
||||
$scope.order_cycle = OrderCycle.order_cycle
|
||||
$scope.OrderCycle = OrderCycle
|
||||
@@ -12,12 +10,15 @@ Darkswarm.controller "OrderCycleCtrl", ($scope, $timeout, OrderCycle) ->
|
||||
$("#order_cycle_id").trigger("openTrigger")
|
||||
|
||||
|
||||
Darkswarm.controller "OrderCycleChangeCtrl", ($scope, $timeout, OrderCycle, Products, Variants) ->
|
||||
Darkswarm.controller "OrderCycleChangeCtrl", ($scope, $timeout, OrderCycle, Products, Variants, Cart) ->
|
||||
$scope.changeOrderCycle = ->
|
||||
OrderCycle.push_order_cycle $scope.orderCycleChanged
|
||||
$timeout ->
|
||||
$("#order_cycle_id").trigger("closeTrigger")
|
||||
|
||||
$scope.orderCycleChanged = ->
|
||||
# push_order_cycle clears the cart server-side. Here we call Cart.clear() to clear the
|
||||
# client-side cart.
|
||||
Variants.clear()
|
||||
Cart.clear()
|
||||
Products.update()
|
||||
|
||||
@@ -19,7 +19,6 @@ Darkswarm.factory 'Products', ($resource, Enterprises, Dereferencer, Taxons, Pro
|
||||
@registerVariants()
|
||||
@registerVariantsWithCart()
|
||||
@loading = false
|
||||
@
|
||||
|
||||
extend: ->
|
||||
for product in @products
|
||||
|
||||
Reference in New Issue
Block a user