This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See http://git.chorem.org/pollen.git commit 27ffc1f8485311abd4bedafea4c3e78f5cffad5f Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Jul 30 15:09:58 2014 +0200 hover alert reset timeout --- .../src/main/webapp/js/controllers/alertCtrl.js | 21 +++++++++++++++++++-- .../src/main/webapp/partials/alerts.html | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js index 85075fd..2123092 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js @@ -71,7 +71,7 @@ angular.module('alertControllers', []) var alertNotExist = true; angular.forEach($scope.data.alerts, function (oneAlert, key) { if (angular.equals(oneAlert.msg, alert.msg) && angular.equals(oneAlert.type, alert.type)) { - $timeout.cancel(oneAlert.timeout); + $timeout.cancel(oneAlert.timeoutPromise); alert = oneAlert; alertNotExist = false; } @@ -82,9 +82,12 @@ angular.module('alertControllers', []) } if (angular.isDefined(timeout) && timeout >= 0) { - alert.timeout = $timeout(function () { + alert.timeout = timeout + alert.timeoutPromise = $timeout(function () { $scope.hideAlert(alert) }, timeout); + } else { + alert.timeout = -1; } } @@ -95,6 +98,20 @@ angular.module('alertControllers', []) } } + $scope.hoverAlert = function (alert) { + if (alert.timeout >= 0) { + $timeout.cancel(alert.timeoutPromise); + } + } + + $scope.leaveAlert = function (alert) { + if (alert.timeout >= 0) { + alert.timeoutPromise = $timeout(function () { + $scope.hideAlert(alert); + }, alert.timeout); + } + } + $scope.toHTML = function (msg) { return $sce.trustAsHtml($filter('translate')(msg)); } diff --git a/pollen-ui-angular/src/main/webapp/partials/alerts.html b/pollen-ui-angular/src/main/webapp/partials/alerts.html index 37bc807..f5aa327 100644 --- a/pollen-ui-angular/src/main/webapp/partials/alerts.html +++ b/pollen-ui-angular/src/main/webapp/partials/alerts.html @@ -1,5 +1,7 @@ <div ng-controller="printAlertCtrl" > <alert ng-repeat="alert in data.alerts" type="{{alert.type}}" + ng-mouseenter="hoverAlert(alert)" + ng-mouseleave="leaveAlert(alert)" close="hideAlert(alert)"><span class="glyphicon" ng-class="alert.glyphicon"></span> <div class="alert-message" ng-bind-html="toHTML(alert.msg)"></div> </alert> </div> \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.