[pollen] branch develop updated (4161687 -> bb5a0b3)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen. See http://git.chorem.org/pollen.git from 4161687 for cursor pointer on input readonly new c5a2a28 add trigger to hide alert new b716058 remove alert when can remove it new bb5a0b3 fixes #1068 redirect to home when logout and delete all alert, and delete all data in session storage without locale The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit bb5a0b3f3636f0d9c90115cf25dd0d135b468e64 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Aug 28 16:26:31 2014 +0200 fixes #1068 redirect to home when logout and delete all alert, and delete all data in session storage without locale commit b7160584668c0c89cdd135d7a7aecc183e543392 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Aug 28 16:24:30 2014 +0200 remove alert when can remove it commit c5a2a282307c29dbc644a352147eff40bfa61726 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Aug 28 16:23:11 2014 +0200 add trigger to hide alert Summary of changes: .../src/main/webapp/js/controllers/alertCtrl.js | 101 +++++++++++++++++---- .../src/main/webapp/js/controllers/pollCtrl.js | 23 ++++- .../src/main/webapp/js/controllers/userCtrl.js | 15 ++- 3 files changed, 111 insertions(+), 28 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 c5a2a282307c29dbc644a352147eff40bfa61726 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Aug 28 16:23:11 2014 +0200 add trigger to hide alert --- .../src/main/webapp/js/controllers/alertCtrl.js | 101 +++++++++++++++++---- 1 file changed, 81 insertions(+), 20 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 486c2e1..0b40766 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js @@ -31,8 +31,44 @@ angular.module('alertControllers', []) $scope.data.alerts = []; $scope.data.persistentAlerts = []; - $scope.$on('newError', function (event, error, timeout) { - var alert = {msg:error, type:'danger', icon:'fa fa-info-error'}; + var makeAlert = function (msg, type, icon, id) { + var alert = {msg:msg, type:type}; + + if (icon !== undefined) { + alert.icon = icon; + } + + if (id !== undefined) { + alert.id = id; + } + return alert; + }; + + var getPoolAlert = function (timeout) { + if (angular.isDefined(timeout) && timeout >= 0) { + return $scope.data.alerts; + } else { + return $scope.data.persistentAlerts; + } + }; + + var hideFilterAlert = function (filter) { + var alert = $($scope.data.persistentAlerts).filter(function() { + return filter(this); + }); + + alert.add($($scope.data.alerts).filter(function () { + return filter(this); + })); + + alert.each(function () { + $scope.hideAlert(this); + }); + }; + + $scope.$on('newError', function (event, error, timeout, id) { + var alert = makeAlert(error,'danger','fa fa-info-error', id); + if (angular.isDefined(timeout)) { $scope.addAlert(alert, timeout); } else { @@ -40,8 +76,9 @@ angular.module('alertControllers', []) } }); - $scope.$on('newWarning', function (event, warning, timeout) { - var alert = {msg:warning, type:'warning', icon:'fa fa-warning'}; + $scope.$on('newWarning', function (event, warning, timeout, id) { + var alert = makeAlert(warning, 'warning', 'fa fa-warning', id); + if (angular.isDefined(timeout)) { $scope.addAlert(alert, timeout); } else { @@ -50,8 +87,9 @@ angular.module('alertControllers', []) }); - $scope.$on('newSuccess', function (event, success, timeout) { - var alert = {msg:success, type:'success', icon:'fa fa-check'}; + $scope.$on('newSuccess', function (event, success, timeout, id) { + var alert = makeAlert(success, 'success', 'fa fa-check', id); + if (angular.isDefined(timeout)) { $scope.addAlert(alert, timeout); } else { @@ -59,8 +97,9 @@ angular.module('alertControllers', []) } }); - $scope.$on('newInfo', function (event, info, timeout) { - var alert = {msg:info, type:'info', icon:'fa fa-info-circle'}; + $scope.$on('newInfo', function (event, info, timeout, id) { + var alert = makeAlert(info, 'info', 'fa fa-info-circle', id); + if (angular.isDefined(timeout)) { $scope.addAlert(alert, timeout); } else { @@ -82,15 +121,42 @@ angular.module('alertControllers', []) } }); - $scope.addAlert = function (alert, timeout) { - var alertNotExist = true; - var poolAlert; + $scope.$on('hideAlertByMsg', function (event, msg) { + var filter = function (alert) { + return alert.msg === msg; + }; + hideFilterAlert(filter); + }); - if (angular.isDefined(timeout) && timeout >= 0) { - poolAlert = $scope.data.alerts; + $scope.$on('hideAlertByType', function (event, type) { + var filter = function (alert) { + return alert.type === type; + }; + console.log("hide alert type : " + type); + hideFilterAlert(filter); + }); + + $scope.$on('hideAlertById', function (event, id) { + var filter = function (alert) { + return alert.id === id; + }; + hideFilterAlert(filter); + }); + + $scope.$on('cleanAlert', function(persistent) { + if (persistent === undefined) { + $scope.$emit('cleanAlert', false); + $scope.$emit('cleanAlert', true); + } else if (persistent) { + $scope.data.persistentAlerts = []; } else { - poolAlert = $scope.data.persistentAlerts; + $scope.data.alerts = []; } + }); + + $scope.addAlert = function (alert, timeout) { + var alertNotExist = true; + var poolAlert = getPoolAlert(timeout); angular.forEach(poolAlert, function (oneAlert) { if (angular.equals(oneAlert.msg, alert.msg) && angular.equals(oneAlert.type, alert.type)) { @@ -115,12 +181,7 @@ angular.module('alertControllers', []) }; $scope.hideAlert = function (alert) { - var poolAlert; - if (angular.isDefined(alert.timeout) && alert.timeout >= 0) { - poolAlert = $scope.data.alerts; - } else { - poolAlert = $scope.data.persistentAlerts; - } + var poolAlert = getPoolAlert(alert.timeout); var index = poolAlert.indexOf(alert); if (index >= 0) { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 b7160584668c0c89cdd135d7a7aecc183e543392 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Aug 28 16:24:30 2014 +0200 remove alert when can remove it --- .../src/main/webapp/js/controllers/pollCtrl.js | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js index 7a7ffdc..05a4d25 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -207,6 +207,11 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.tab = $scope.setTab(); $route.current = lastRoute; } + else if (lastRoute.$$route.controller != 'PollCreateCtrl' || $route.current.$$route.controller != 'PollCtrl') { + $rootScope.$broadcast('hideAlertByType', 'warning'); + $rootScope.$broadcast('hideAlertByType', 'success'); + $rootScope.$broadcast('hideAlertByType', 'info'); + } }); }); @@ -303,6 +308,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr var confirmDelete = confirm(confirmMessage); if (confirmDelete == true) { $scope.data.poll.$remove({permission:$scope.globalVariables.pollToken}, function() { + $rootScope.$broadcast('cleanAlert'); $rootScope.$broadcast('newSuccess', 'poll.deleted'); $location.path('/'); }); @@ -320,6 +326,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr var confirmClose = confirm(confirmMessage); if (confirmClose == true) { $scope.data.poll.$close({permission:$scope.globalVariables.pollToken}, function() { + $rootScope.$broadcast('cleanAlert'); $rootScope.$broadcast('newSuccess', 'poll.closed'); $route.reload(); }); @@ -331,13 +338,14 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.clonePoll = function () { if (angular.isDefined($scope.data.poll.id)) { Poll.clone({pollId: $scope.data.poll.id, permission: $scope.globalVariables.pollToken}, {}, function (data) { + $rootScope.$broadcast('cleanAlert'); $rootScope.$broadcast('newInfo', $filter('translate')('poll.created.printLink', {url: '<input type="text" class="form-control" value="' + $scope.globalVariables.baseUrl+'#/poll/edit/'+data.id+'/'+data.permission + '" readonly />' }) - , -1); + , -1, data.id); $rootScope.$broadcast('newSuccess', 'poll.cloned'); $location.url('/poll/edit/'+data.id+'/'+data.permission); $route.reload(); @@ -840,13 +848,15 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.globalVariables.configError = false; $scope.globalVariables.participantError = false; + $rootScope.$broadcast('hideAlertByType', 'danger'); + $rootScope.$broadcast('newInfo', $filter('translate')('poll.created.printLink', {url: '<input type="text" class="form-control" value="' + $scope.globalVariables.baseUrl+'#/poll/edit/'+data.id+'/'+data.permission + '" readonly />' }) - , -1); + , -1, data.id); $rootScope.$broadcast('newSuccess', 'poll.saved'); if ($scope.data.poll.pollType != 'FREE') { SessionStorage.save({'voterList':$scope.data.voterList}); @@ -1192,6 +1202,8 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.globalVariables.configError = false; $scope.globalVariables.participantError = false; + $rootScope.$broadcast('hideAlertByType', 'danger'); + $rootScope.$broadcast('newSuccess', 'poll.saved'); }, function (error) { $scope.tabError(error.data); @@ -1313,7 +1325,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr '<input type="text" class="form-control" value="' + $scope.globalVariables.baseUrl+'#' + redirect + '" readonly />'}) - , -1); + , -1, returnRequest.id); $rootScope.$broadcast('newSuccess', 'vote.added'); initVote(); @@ -1453,6 +1465,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr var index = $scope.data.votants.indexOf(vote); PollVote.remove({pollId:$routeParams.pollId}, vote, function () { + $rootScope.$broadcast('hideAlertById', vote.id); $scope.data.votants.splice(index, 1); }) } @@ -1598,7 +1611,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr '<input type="text" class="form-control" value="' + $scope.globalVariables.baseUrl+'#' + redirect + '" readonly />' }) - , -1); + , -1, data.id); $location.url(redirect); @@ -1659,6 +1672,8 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } PollComment.remove({pollId:$routeParams.pollId, commentId:comment.id}, function () { + $rootScope.$broadcast('hideAlertById', comment.id); + // reload comments initComments().then(function () { // if no comment then change page if it's possible -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 bb5a0b3f3636f0d9c90115cf25dd0d135b468e64 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Aug 28 16:26:31 2014 +0200 fixes #1068 redirect to home when logout and delete all alert, and delete all data in session storage without locale --- .../src/main/webapp/js/controllers/userCtrl.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js index 146c079..01a0e2d 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js @@ -88,6 +88,7 @@ angular.module('userControllers', []) currentUser.emailIsValidate = true; SessionStorage.save({user: currentUser}); $rootScope.$broadcast('editUser'); + $rootScope.$broadcast('cleanAlert'); } $location.url('/'); }, function () { @@ -266,12 +267,18 @@ angular.module('userControllers', []) $scope.logout = function () { UserLogout.logout(); - // delete user information - SessionStorage.remove('token'); - SessionStorage.remove('user'); + $rootScope.$broadcast('cleanAlert'); + + var locale = SessionStorage.get().locale; + + // all information + SessionStorage.remove(); delete $scope.currentUser; + // stock the locale + SessionStorage.save({locale : locale}); + //got to the home - $route.reload(); + $location.url('/'); } }]); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm