[pollen] branch feature/editVote created (now 7b8c002)
This is an automated email from the git hooks/post-receive script. New change to branch feature/editVote in repository pollen. See http://git.chorem.org/pollen.git at 7b8c002 fix edit Choice : if error you can edit or delete the choice This branch includes the following new commits: new 3962d70 generate editVote permission and deleteVote permission for connected user or by url permission new 7cadb32 fix all-delete-orphan when editVote new 7b8c002 fix edit Choice : if error you can edit or delete the choice The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: 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 commit 3962d700b22855b1a7c4f218408ec6c68fc5a693 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Jul 30 17:40:15 2014 +0200 generate editVote permission and deleteVote permission for connected user or by url permission commit 7cadb32f89c3293f479eb3d44ae29bd46039f8da Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Jul 31 11:29:54 2014 +0200 fix all-delete-orphan when editVote -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 3962d700b22855b1a7c4f218408ec6c68fc5a693 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Jul 30 17:40:15 2014 +0200 generate editVote permission and deleteVote permission for connected user or by url permission --- .../org/chorem/pollen/services/service/security/SecurityService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/security/SecurityService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/security/SecurityService.java index c2e3342..b5a652d 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/security/SecurityService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/security/SecurityService.java @@ -458,6 +458,10 @@ public class SecurityService extends PollenServiceSupport { } + for(Vote vote: principalByType.votes) { + permissions.add(createWildcardSubjectPermission(vote)); + } + for (Poll poll : principalByType.polls) { // creator has all rights on the poll, choices and comments, but can only read votes -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 7cadb32f89c3293f479eb3d44ae29bd46039f8da Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Jul 31 11:29:54 2014 +0200 fix all-delete-orphan when editVote --- .../pollen/services/service/VoteService.java | 57 +++++++++++++--------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java index fb663ed..b1bf6ad 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java @@ -39,10 +39,7 @@ import org.chorem.pollen.services.bean.VoteBean; import org.chorem.pollen.services.bean.VoteToChoiceBean; import org.chorem.pollen.services.service.security.PermissionVerb; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; /** * TODO @@ -283,15 +280,35 @@ public class VoteService extends PollenServiceSupport { // -- List of VoteToChoice -- // - Set<VoteToChoice> choicesToSave = new HashSet<>(); - for (VoteToChoiceBean input : vote.getChoice()) { + if (voteExist) { - VoteToChoice voteToChoice = createVoteToChoice(toSave, input); - choicesToSave.add(voteToChoice); + //TODO dralagen 31/07/14 : review code for persisted Collection - } + Collection<VoteToChoice> choicesToSave = toSave.getVoteToChoice(); + for(VoteToChoiceBean input: vote.getChoice()) { + if (input.isPersisted()) { + for ( VoteToChoice voteToChoice : choicesToSave ) { + if ( input.getChoiceId().getEntityId().equals(voteToChoice.getChoice().getTopiaId()) ) { + voteToChoice.setVoteValue(input.getVoteValue()); + } + } + } + else { + choicesToSave.add(createVoteToChoice(toSave, input)); + } + } + } else { + + Set<VoteToChoice> choicesToSave = new HashSet<>(); + for ( VoteToChoiceBean input : vote.getChoice() ) { - toSave.setVoteToChoice(choicesToSave); + VoteToChoice voteToChoice = createVoteToChoice(toSave, input); + choicesToSave.add(voteToChoice); + + } + + toSave.setVoteToChoice(choicesToSave); + } return toSave; @@ -335,27 +352,19 @@ public class VoteService extends PollenServiceSupport { protected VoteToChoice createVoteToChoice(Vote vote, VoteToChoiceBean source) { - VoteToChoiceTopiaDao voteToChoiceDao = getVoteToChoiceDao(); - VoteToChoice result; - if (source.isPersisted()) { - - result = getVoteToChoice(vote, source.getEntityId()); - - } else { - - result = voteToChoiceDao.create(); + VoteToChoiceTopiaDao voteToChoiceDao = getVoteToChoiceDao(); - String choiceId = source.getChoiceId().getEntityId(); + result = voteToChoiceDao.create(); - Choice choiceLoaded = getChoiceDao().forTopiaIdEquals(choiceId).findUnique(); + String choiceId = source.getChoiceId().getEntityId(); - result.setChoice(choiceLoaded); + Choice choiceLoaded = getChoiceDao().forTopiaIdEquals(choiceId).findUnique(); - vote.addVoteToChoice(result); + result.setChoice(choiceLoaded); - } + vote.addVoteToChoice(result); result.setVoteValue(source.getVoteValue()); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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>.
participants (1)
-
chorem.org scm