This is an automated email from the git hooks/post-receive script. New commit to branch devel in repository Pollen. See http://git.None/Pollen.git commit 23830920e3546045fb379b781a0f0628a9ab2e27 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed May 28 14:00:00 2014 +0200 fix url tab, no get result in vote controllers set pageNumber and pageSize --- .../src/main/webapp/js/controllers/pollCtrl.js | 39 +++++++++------------- .../src/main/webapp/partials/poll.html | 4 +-- 2 files changed, 17 insertions(+), 26 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 ee5b00f..cebc55e 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -388,17 +388,17 @@ angular.module('pollControllers', []) $scope.tab = $scope.setTab('vote'); var initPoll = function () { - var pollPromise = Poll.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, function (poll) { + Poll.get({pollId:$routeParams.pollId, permission:$scope.globalVariables.permission}, function (poll) { $scope.data.poll = poll; - }).$promise; + }); - var choicesPromise = PollChoice.query({pollId:$routeParams.pollId}, function (choices) { + PollChoice.query({pollId:$routeParams.pollId}, function (choices) { $scope.data.choices = choices; initVote(); - }).$promise; + }); - var votesPromise = PollVote.query({pollId:$routeParams.pollId}, function (votes) { + PollVote.query({pollId:$routeParams.pollId}, function (votes) { $scope.data.votants = votes; angular.forEach($scope.data.votants, function (vote) { angular.forEach(vote.choice, function (choice) { @@ -410,21 +410,6 @@ angular.module('pollControllers', []) } }) }) - }).$promise; - - $q.all([choicesPromise, votesPromise]).then(function () { - Poll.get({pollId:$routeParams.pollId, cmd:'results'}, function (result) { - $scope.data.result = result; - angular.forEach(result.scores, function(value, key) { - for (var i = 0; i < $scope.data.choices.length; i++) { - if ($scope.data.choices[i].id == value.choiceId) { - value.choice = $scope.data.choices[i]; - i = $scope.data.choices.length; - } - } - }) - $scope.data.result.nbVotant = $scope.data.votants.length; - }); }); } initPoll(); @@ -500,6 +485,7 @@ angular.module('pollControllers', []) //clean form $scope.comment.text = ''; + delete $scope.comment.postDate; }, function (error) { $scope.restError = error.data; }); @@ -557,14 +543,19 @@ angular.module('pollControllers', []) $controller('PollCtrl', {$scope:$scope}); var pollPromise; - var paginationParameter = {pageSize:5}; - if (angular.isDefined($routeParams.pageSize)) { - paginationParameter.pageSize= $routeParams.pageSize; - } + var paginationParameter; if (angular.isDefined($routeParams.page)) { + if (angular.isDefined($routeParams.pageSize)) { + paginationParameter = {pageSize:$routeParams.pageSize}; + } + else { + paginationParameter = {pageSize:10}; + } + paginationParameter.pageNumber = $routeParams.page; } + if (angular.isDefined($routeParams.cmd)) { pollPromise = Poll.get({cmd:$routeParams.cmd, paginationParameter:paginationParameter}).$promise; } diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html index 6d35af1..f2fe86d 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll.html @@ -25,13 +25,13 @@ <alert type="success" class="alert-float" ng-if="globalVariables.commentMode && globalVariables.saved" close="globalVariables.saved = false"> Commentaire effectué..</alert> <ul class="nav nav-tabs"> - <li ng-class="{active: tab == 'home'}"><a href="{{url}}tab=home"> <span class="glyphicon glyphicon-home"></span> </a></li> + <li ng-class="{active: tab == 'home'}"><a href="{{urlTab}}tab=home"> <span class="glyphicon glyphicon-home"></span> </a></li> <li ng-class="{active: tab == 'vote'}" ng-show="data.poll.id"><a href="{{globalVariables.linkVote}}">Voter</a></li> <li ng-class="{active: tab == 'comment'}" ng-show="data.poll.id"><a href="{{globalVariables.linkComment}}">Commenter</a></li> <li ng-class="{active: tab == 'result'}" ng-show="!globalVariables.create"><a href="{{globalVariables.linkResult}}">Résultat</a></li> <li ng-class="{active: tab == 'edit'}" ng-show="globalVariables.create"><a href="#/poll/create">Créer</a></li> <li ng-class="{active: tab == 'edit'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkEdit}}">Editer</a></li> - <li ng-class="{active: tab == 'conf'}" ng-show="data.poll.permission || globalVariables.create"><a href="{{url}}tab=conf">Configuration</a></li> + <li ng-class="{active: tab == 'conf'}" ng-show="data.poll.permission || globalVariables.create"><a href="{{urlTab}}tab=conf">Configuration</a></li> </ul> <div ng-include="'partials/poll-link.html'" ng-if="tab == 'home'"></div> -- To stop receiving notification emails like this one, please contact Chorem.org SCM administrator <admin+scm@chorem.org>.