This is an automated email from the git hooks/post-receive script. New commit to branch feature/editVote in repository pollen. See http://git.chorem.org/pollen.git commit 7b8c0028892ea31ac548a56b416fa94f240d97d8 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Jul 31 11:39:53 2014 +0200 fix edit Choice : if error you can edit or delete the choice --- .../src/main/webapp/js/controllers/pollCtrl.js | 7 +++++-- .../src/main/webapp/partials/inline-poll.html | 14 +++++++------- 2 files changed, 12 insertions(+), 9 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 3a14bdf..a49c11e 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -382,7 +382,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr // add null in vote angular.forEach($scope.data.votants, function (voter) { - voter.choice.push({choiceId: $scope.data.choices[i].id, voteValue : $scope.getVoteValue(null)}); + voter.choice.push({choiceId: data.id, voteValue : $scope.getVoteValue(null)}); }); $rootScope.$broadcast('newSuccess', 'poll.saved'); @@ -1163,7 +1163,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } }); - $scope.data.votants.push(angular.copy($scope.data.vote)); + PollVote.get({pollId:$routeParams.pollId, voteId:returnRequest.id}, function (newVote) { + $scope.data.votants.push(newVote); + }) + $rootScope.$broadcast('newSuccess', 'vote.added'); initVote(); 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 730e339..d255389 100644 --- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html @@ -27,22 +27,22 @@ </td> <td ng-repeat="choice in data.choices" class="pollChoice pollAnim" ng-mouseenter="showEditHover = true" ng-mouseleave="showEditHover = false"> <div ng-if="choice.choiceType == 'TEXT'" edit-me="showEdit" > - <div ng-hide="showEdit && ((data.poll.addChoiceAllowed && choice.permission) || globalVariables.editMode)" class="fixe-input" title="{{choice.description}}"> + <div ng-hide="showEdit && ((data.poll.addChoiceAllowed && (choice.permission || !choice.id)) || globalVariables.editMode)" class="fixe-input" title="{{choice.description}}"> {{ choice.choiceValue || ('poll.edit' | translate) }} <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue"></info-error> - <input type="button" class="btn btn-default" ng-if="(data.poll.choiceAddAllowed && choice.permission) || globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/></div> - <div ng-show="showEdit && ((data.poll.addChoiceAllowed && choice.permission) || globalVariables.editMode)"> + <input type="button" class="btn btn-default" ng-if="(data.poll.choiceAddAllowed && (choice.permission || !choice.id)) || globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/></div> + <div ng-show="showEdit && ((data.poll.addChoiceAllowed && (choice.permission || !choice.id)) || globalVariables.editMode)"> <input type="text" class="form-control" ng-model="choice.choiceValue" focus-me="showEdit" ng-exit="showEdit = false;" auto-save="saveChoice(choice)" required/> <input type="button" class="btn btn-default" data-toggle="modal" data-target="#popupAddChoice" ng-click="editChoice(choice)" value="..."/> </div> </div> <div ng-if="choice.choiceType == 'DATE'" edit-me="showEdit" > - <div ng-hide="showEdit && (data.poll.addChoiceAllowed && choice.permission || globalVariables.editMode)" class="fixe-input" title="{{choice.description}}"> + <div ng-hide="showEdit && (data.poll.addChoiceAllowed && (choice.permission || !choice.id) || globalVariables.editMode)" class="fixe-input" title="{{choice.description}}"> {{ (choice.choiceValue | date:globalVariables.dateTimeFormat) || ('poll.edit' | translate) }} <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue"></info-error> - <input type="button" class="btn btn-default" ng-if="(data.poll.choiceAddAllowed && choice.permission) || globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/> + <input type="button" class="btn btn-default" ng-if="(data.poll.choiceAddAllowed && (choice.permission || !choice.id)) || globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/> </div> - <div ng-show="showEdit && (data.poll.choiceAddAllowed && choice.permission || globalVariables.editMode)" > + <div ng-show="showEdit && (data.poll.choiceAddAllowed && (choice.permission || !choice.id) || globalVariables.editMode)" > <datetimepicker ng-model="choice.choiceValue" focus="showEdit" ng-exit="showEdit = false" ng-save="saveChoice(choice)"></datetimepicker> <input type="button" class="btn btn-default" data-toggle="modal" data-target="#popupAddChoice" ng-click="editChoice(choice)" value="..."/> </div> @@ -51,7 +51,7 @@ <div class="fixe-input" title="{{choice.description}}"> {{choice.choiceValue.meta.name}} <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue"></info-error> - <input type="button" class="btn btn-default" ng-if="data.poll.choiceAddAllowed && choice.permission || globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/> + <input type="button" class="btn btn-default" ng-if="data.poll.choiceAddAllowed && (choice.permission || !choice.id) || globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/> <br/> <print-resource image="choice.choiceValue.id" name="choice.choiceValue.meta.name"></print-resource> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.