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 926f8a47e5516d50f08a59325914639b56c6421a Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Jun 12 18:20:56 2014 +0200 delete vote --- .../src/main/webapp/js/controllers/pollCtrl.js | 24 +++++++++++++++++++++- .../src/main/webapp/partials/inline-poll.html | 2 +- .../src/main/webapp/partials/poll-poll.html | 2 +- 3 files changed, 25 insertions(+), 3 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 6d298b4..879495e 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -625,7 +625,8 @@ angular.module('pollControllers', []) } }]) -.controller('PollVoteCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote) { +.controller('PollVoteCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', + function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate) { $controller('PollCtrl', {$scope:$scope}); $scope.tab = $scope.setTab('vote'); @@ -715,6 +716,27 @@ angular.module('pollControllers', []) $scope.data.vote = vote; } + $scope.deleteVote = function (vote) { + var confirmMessage; + $translate('action.message.confirmDelete').then(function (msg) { + confirmMessage = msg; + }).then( function () { + var confirmDelete = confirm(confirmMessage); + if (confirmDelete == true) { + // delete if edit + if ($scope.data.vote.id == vote.id) { + initVote(); + } + + var index = $scope.data.votants.indexOf(vote); + PollVote.remove({pollId:$routeParams.pollId}, vote, function (data) { + $scope.data.votants.splice(index, 1); + }) + } + }); + + } + }]) .controller('PollCommentCtrl', diff --git a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html index 196300b..37a85c4 100644 --- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html @@ -71,7 +71,7 @@ </td> <td> <button class="btn btn-info" ng-if="vote.permission" ng-click="editVote(vote)"><span class="glyphicon glyphicon-pencil"></span></button> - <button class="btn btn-danger" ng-if="vote.permission" disabled><span class="glyphicon glyphicon-remove"></span></button> + <button class="btn btn-danger" ng-if="vote.permission" ng-click="deleteVote(vote)"><span class="glyphicon glyphicon-remove"></span></button> </td> </tr> <!-- end print vote --> diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-poll.html b/pollen-ui-angular/src/main/webapp/partials/poll-poll.html index d9eec6d..a88d3e6 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll-poll.html @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #L% --> -<div class="pollTitle" edit-me="showEditTitle"> +<div class="pollTitle" edit-me="showEditTitle" novalidate> <h1 ng-hide="showEditTitle"> {{data.poll.title || 'poll.edit' | translate }} <info-error error="restError.title[0]" data="data.poll.title"></info-error> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm