This is an automated email from the git hooks/post-receive script. New commit to branch feature/permissionPollRestricted in repository pollen. See http://git.chorem.org/pollen.git commit 8694ab2ab9b3419a1ae0b5695b501c980be2e2fd Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Aug 6 16:00:06 2014 +0200 get voterId and voterListMemberId for new vote --- pollen-ui-angular/src/main/webapp/js/app.js | 4 --- .../src/main/webapp/js/controllers/pollCtrl.js | 29 +++++++++++----------- pollen-ui-angular/src/main/webapp/js/services.js | 4 +++ 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js index bdc23a3..6e9954c 100644 --- a/pollen-ui-angular/src/main/webapp/js/app.js +++ b/pollen-ui-angular/src/main/webapp/js/app.js @@ -48,10 +48,6 @@ angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'Polle //error login or sessionToken $rootScope.$broadcast('sessionExpired'); } - if (response.status === 403) { - //access forbidden - $location.path('/'); - } return $q.reject(response); } }; 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 704b3d1..dd0384d 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -130,6 +130,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr pollDeferred.resolve('bad token') }, function (error) { + if (error.status == 403) { + $rootScope.$broadcast('newError', 'error.forbidden'); + $location.path("/"); + } pollDeferred.reject(error); }); }); @@ -1125,18 +1129,20 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.globalVariables.voteMode = true; var initVote = function () { - $scope.data.vote = {}; - $scope.data.vote.voterName = ""; - initAuthor(); - $scope.data.vote.anonymous = false; - $scope.data.vote.choice = []; + PollVote.skeletonNew({pollId:$routeParams.pollId}, function (data) { + $scope.data.vote = data; - var defaultValue = ($scope.voteCountingIsBoolean()) ? false : null; + initAuthor(); - for (var i = 0; i < $scope.data.choices.length; ++i) { + var defaultValue = ($scope.voteCountingIsBoolean()) ? false : null; - $scope.data.vote.choice.push({'choiceId':$scope.data.choices[i].id, 'voteValue': defaultValue}); - } + for (var i = 0; i < $scope.data.choices.length; ++i) { + + $scope.data.vote.choice.push({'choiceId':$scope.data.choices[i].id, 'voteValue': defaultValue}); + } + }, function (error) { + $scope.data.poll.canVote = false; + }); } $scope.voter = function () { @@ -1154,11 +1160,6 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } PollVote.add({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken}, sendVote, function (returnRequest) { - - if ($scope.data.poll.pollType != 'FREE') { - $scope.data.poll.canVote = false; - } - $scope.data.vote.id = returnRequest.id; $scope.data.vote.permission = returnRequest.permission; diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js index 2f1b45d..6be865b 100644 --- a/pollen-ui-angular/src/main/webapp/js/services.js +++ b/pollen-ui-angular/src/main/webapp/js/services.js @@ -102,6 +102,10 @@ angular.module('pollenServices', ['ngResource']) return $resource(conf.restURL+'/polls/:pollId/votes/:voteId', {voteId : '@id', permission : '@permission'}, { + 'skeletonNew': { + method:'GET', + url:conf.restURL+'/polls/:pollId/votes/new' + }, 'add' : { method:'POST', transformRequest : function (data, headersGetter) { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.