Do not fetch products JSON on every shopping page

This commit is contained in:
Rohan Mitchell
2014-05-29 10:54:08 +10:00
parent 2a630a855a
commit fdff442ec6
6 changed files with 23 additions and 22 deletions

View File

@@ -1,15 +1,17 @@
Darkswarm.controller "OrderCycleCtrl", ($scope, $rootScope, OrderCycle, $timeout) ->
Darkswarm.controller "OrderCycleCtrl", ($scope, OrderCycle, $timeout) ->
$scope.order_cycle = OrderCycle.order_cycle
$scope.OrderCycle = OrderCycle
$scope.changeOrderCycle = ->
OrderCycle.push_order_cycle()
$timeout ->
$("#order_cycle_id").trigger("closeTrigger")
# Timeout forces this to be evaluated after everything is loaded
# This is a hack. We should probably write our own "popover" directive
# That takes an expression instead of a trigger, and binds to that
$timeout =>
if !$scope.OrderCycle.selected()
$("#order_cycle_id").trigger("openTrigger")
Darkswarm.controller "OrderCycleChangeCtrl", ($scope, OrderCycle, Product, $timeout) ->
$scope.changeOrderCycle = ->
OrderCycle.push_order_cycle Product.update
$timeout ->
$("#order_cycle_id").trigger("closeTrigger")