This is an automated email from the git hooks/post-receive script. New commit to branch feature/importFavoriteList in repository pollen. See http://git.chorem.org/pollen.git commit 816ac2a76baa75fc586c7cccd0361cbc8e0adfe3 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Aug 21 13:32:29 2014 +0200 add redirect when error 403 to / on favoriteListCtrl --- .../main/webapp/js/controllers/favoriteListCtrl.js | 38 +++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js index a0fe4b7..4548fca 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js @@ -21,8 +21,8 @@ 'use strict'; angular.module('favoriteListControllers', []) -.controller('FavoriteListCtrl', ['$scope', 'FavoriteList', 'FavoriteListMember', '$translate', '$routeParams', 'Page', - function ($scope, FavoriteList, FavoriteListMember, $translate, $routeParams, Page) { +.controller('FavoriteListCtrl', ['$scope', '$rootScope', 'FavoriteList', 'FavoriteListMember', '$translate', '$routeParams', 'Page', '$location', + function ($scope, $rootScope, FavoriteList, FavoriteListMember, $translate, $routeParams, Page, $location) { $scope.data = {}; Page.setTitle('user.favoriteList'); @@ -51,13 +51,18 @@ angular.module('favoriteListControllers', []) FavoriteList.get({paginationParameter:paginationParameter}, function (data) { $scope.data.favoriteList = data.elements; $scope.data.favoriteListPagination = data.pagination; + }, function (error) { + if (error.status === 403) { + $rootScope.$broadcast('newError', 'error.forbidden'); + $location.url('/'); + } }); }; initFavoriteList(); }]) -.controller('FavoriteListEditCtrl', ['$scope', 'FavoriteList', 'FavoriteListMember', '$translate', '$routeParams', '$timeout', '$q', '$location', '$route', - function ($scope, FavoriteList, FavoriteListMember, $translate, $routeParams, $timeout, $q, $location, $route) { +.controller('FavoriteListEditCtrl', ['$scope', '$rootScope', 'FavoriteList', 'FavoriteListMember', '$translate', '$routeParams', '$timeout', '$q', '$location', '$route', + function ($scope, $rootScope, FavoriteList, FavoriteListMember, $translate, $routeParams, $timeout, $q, $location, $route) { $scope.data = {}; var paginationParameter = {pageSize: conf.favoriteListMemberDefaultPageSize}; @@ -89,6 +94,11 @@ angular.module('favoriteListControllers', []) FavoriteList.get({favoriteListId:$routeParams.favoriteListId}, function (favList) { $scope.data.favoriteList = favList; initFavoriteListMember(); + }, function (error) { + if (error.status === 403) { + $rootScope.$broadcast('newError', 'error.forbidden'); + $location.url('/'); + } }); } else { @@ -98,13 +108,19 @@ angular.module('favoriteListControllers', []) var initFavoriteListMember = function () { var deferred = $q.defer(); - FavoriteListMember.get({favoriteListId:$routeParams.favoriteListId, paginationParameter:paginationParameter}, function (members) { - $timeout(function () { - $scope.data.favoriteList.members = members.elements; - $scope.data.favoriteListMemberPagination = members.pagination; - deferred.resolve(); - }, 100); - }); + FavoriteListMember.get({favoriteListId:$routeParams.favoriteListId, paginationParameter:paginationParameter}, + function (members) { + $timeout(function () { + $scope.data.favoriteList.members = members.elements; + $scope.data.favoriteListMemberPagination = members.pagination; + deferred.resolve(); + }, 100); + }, function (error) { + if (error.status === 403) { + $rootScope('newError', 'error.forbidden'); + $location.url('/'); + } + }); return deferred.promise; }; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.