From 9beb560b7219cdfbaeb96a38e2ebaca0c527c46e Mon Sep 17 00:00:00 2001 From: Rob H Date: Mon, 17 Jun 2013 19:07:07 +0530 Subject: [PATCH] BPUR: cancel any pre-existing timeouts on message models when new message set --- app/assets/javascripts/admin/bulk_product_update.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/admin/bulk_product_update.js b/app/assets/javascripts/admin/bulk_product_update.js index 382db20e11..d3f649e31f 100644 --- a/app/assets/javascripts/admin/bulk_product_update.js +++ b/app/assets/javascripts/admin/bulk_product_update.js @@ -204,8 +204,9 @@ productsApp.controller('AdminBulkProductsCtrl', function($scope, $timeout, $http $scope.setMessage = function(model,text,style,timeout){ model.text = text; model.style = style; + if (model.timeout) $timeout.cancel(model.timeout); if (timeout){ - $timeout(function() { $scope.setMessage(model,"",{},false); }, timeout, true); + model.timeout = $timeout(function() { $scope.setMessage(model,"",{},false); }, timeout, true); } }