From ef0038a6610dd813bb2d11ab7d3d6e4bcf6dcf2b Mon Sep 17 00:00:00 2001 From: Steve Roberts Date: Thu, 27 Aug 2020 18:02:01 +1000 Subject: [PATCH] Change trigger to update filters after ProductsCtrl is loaded. --- .../darkswarm/controllers/products_controller.js.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee index d1369fc393..5b92b28280 100644 --- a/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee @@ -12,6 +12,11 @@ Darkswarm.controller "ProductsCtrl", ($scope, $sce, $filter, $rootScope, Product $scope.supplied_properties = null $scope.showFilterSidebar = false + # Update filters after initial load of shop tab + $timeout => + $scope.update_filters() + + # Update filters when order cycle changed $rootScope.$on "orderCycleSelected", -> $scope.update_filters() $scope.clearAll() @@ -49,7 +54,6 @@ Darkswarm.controller "ProductsCtrl", ($scope, $sce, $filter, $rootScope, Product $scope.$watch 'query', (newValue, oldValue) -> $scope.loadProducts() if newValue != oldValue $scope.$watchCollection 'activeTaxons', (newValue, oldValue) -> $scope.loadProducts() if newValue != oldValue $scope.$watchCollection 'activeProperties', (newValue, oldValue) -> $scope.loadProducts() if newValue != oldValue - $scope.$watch 'Products.loading', (newValue, oldValue) -> $scope.update_filters() if newValue == false && newValue != oldValue $scope.loadProducts = -> $scope.page = 1