[pollen] branch develop updated (86c5e1d -> 0bb0135)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen. See http://git.chorem.org/pollen.git from 86c5e1d Merge branch 'feature/homePage' into develop new 905a613 edit vote on oneline not in form for new vote new 496cd66 edit voterName for vote new 0bb0135 delete callBack for popup 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 0bb01354c5b6a360820443b86f217978b6c6fde6 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Fri Aug 1 15:48:39 2014 +0200 delete callBack for popup choice commit 496cd660548975297cba90a7844a642a8d5b73e2 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Fri Aug 1 15:30:29 2014 +0200 edit voterName for vote commit 905a613422ee182ba371cd25f70a4c4c278b26e0 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Fri Aug 1 14:40:01 2014 +0200 edit vote on oneline not in form for new vote Summary of changes: .../src/main/webapp/js/controllers/pollCtrl.js | 172 +++++++++++++-------- .../src/main/webapp/partials/inline-poll.html | 51 +++++- 2 files changed, 154 insertions(+), 69 deletions(-) -- 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 develop in repository pollen. See http://git.chorem.org/pollen.git commit 905a613422ee182ba371cd25f70a4c4c278b26e0 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Fri Aug 1 14:40:01 2014 +0200 edit vote on oneline not in form for new vote --- .../src/main/webapp/js/controllers/pollCtrl.js | 144 ++++++++++++++------- .../src/main/webapp/partials/inline-poll.html | 25 +++- 2 files changed, 116 insertions(+), 53 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 4982fd1..e1e4241 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -1160,65 +1160,117 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }); } - if (angular.isDefined($scope.data.vote.id)) { - // edit vote - PollVote.update({pollId:$routeParams.pollId}, sendVote, function (data) { - $rootScope.$broadcast('newSuccess', 'vote.added'); - $location.url('/poll/vote/'+$routeParams.pollId+'/'+ data.permission); - }, function (error) { - $scope.data.vote.restError = { voterName : error.data["voter.name"]}; + PollVote.add({pollId:$routeParams.pollId}, sendVote, function (returnRequest) { + $scope.data.vote.id = returnRequest.id; + $scope.data.vote.permission = returnRequest.permission; + + angular.forEach($scope.data.vote.choice, function (choice) { + if (choice.voteValue == "") { + delete choice.voteValue; + } + }); + + PollVote.get({pollId:$routeParams.pollId, voteId:returnRequest.id, permission:returnRequest.permission}, function (newVote) { + $scope.data.votants.push(newVote); }) - } - else { - // add vote - PollVote.add({pollId:$routeParams.pollId}, sendVote, function (returnRequest) { - $scope.data.vote.id = returnRequest.id; - $scope.data.vote.permission = returnRequest.permission; - - angular.forEach($scope.data.vote.choice, function (choice) { - if (choice.voteValue == "") { - delete choice.voteValue; - } - }); - PollVote.get({pollId:$routeParams.pollId, voteId:returnRequest.id, permission:returnRequest.permission}, function (newVote) { - $scope.data.votants.push(newVote); - }) + $rootScope.$broadcast('newInfo', + $filter('translate')('vote.added.printLink', {url: + '<input type="text" class="form-control" value="' + + $scope.globalVariables.baseUrl+'#/poll/vote/'+$routeParams.pollId+'/'+ returnRequest.permission + + '" readonly />'}) + , -1); - $rootScope.$broadcast('newInfo', - $filter('translate')('vote.added.printLink', {url: - '<input type="text" class="form-control" value="' + - $scope.globalVariables.baseUrl+'#/poll/vote/'+$routeParams.pollId+'/'+ returnRequest.permission + - '" readonly />'}) - , -1); + $rootScope.$broadcast('newSuccess', 'vote.added'); + initVote(); + + $location.url('/poll/vote/'+$routeParams.pollId+'/'+ returnRequest.permission); + }, function (error) { + if (angular.isDefined(error.data["voter.name"])) { + $scope.data.vote.restError = { voterName : error.data["voter.name"]}; + } - $rootScope.$broadcast('newSuccess', 'vote.added'); - initVote(); + if (angular.isDefined(error.data["vote.totalVoteValue"])) { + $rootScope.$broadcast('newError', error.data["vote.totalVoteValue"][0]); + } - $location.url('/poll/vote/'+$routeParams.pollId+'/'+ returnRequest.permission); - }, function (error) { - if (angular.isDefined(error.data["voter.name"])) { - $scope.data.vote.restError = { voterName : error.data["voter.name"]}; + angular.forEach($scope.data.vote.choice, function (choice, key) { + if (angular.isDefined(error.data["vote.voteValue["+choice.choiceId+"]"])) { + choice.restError = error.data["vote.voteValue["+choice.choiceId+"]"]; + } + else { + delete choice.restError; } + }); + }); + } + + var oldVote - if (angular.isDefined(error.data["vote.totalVoteValue"])) { - $rootScope.$broadcast('newError', error.data["vote.totalVoteValue"][0]); + $scope.editVote = function (vote) { + if (angular.isDefined(oldVote)) { + angular.forEach($scope.data.votants, function(oneVote) { + if (oneVote != vote) { + $scope.cancelVote(oneVote); } + }); + } - angular.forEach($scope.data.vote.choice, function (choice, key) { - if (angular.isDefined(error.data["vote.voteValue["+choice.choiceId+"]"])) { - choice.restError = error.data["vote.voteValue["+choice.choiceId+"]"]; - } - else { - delete choice.restError; - } - }); + oldVote = angular.copy(vote); + vote.onEdit = true; + } + + $scope.cancelVote = function (vote) { + if (angular.isDefined(oldVote) && vote.id == oldVote.id) { + vote.onEdit = false; + + for (var i = 0; i < vote.choice.length; i++) { + vote.choice[i].voteValue = oldVote.choice[i].voteValue; + } + } + } + + $scope.saveVote = function (vote) { + var sendVote = angular.copy(vote); + if ($scope.voteCountingIsBoolean()) { + angular.forEach(sendVote.choice, function (choice) { + choice.voteValue = (choice.voteValue)?1.0:0.0; + }); + } else { + angular.forEach(sendVote.choice, function (choice) { + if (choice.voteValue == "") { + choice.voteValue = null; + } }); } + + + // edit vote + PollVote.update({pollId:$routeParams.pollId}, sendVote, function (data) { + vote.onEdit = false; + + delete $scope.data.vote.restError; + $rootScope.$broadcast('newSuccess', 'vote.added'); + $location.url('/poll/vote/'+$routeParams.pollId+'/'+ data.permission); + }, function (error) { + $scope.data.vote.restError = { voterName : error.data["voter.name"]}; + }) } - $scope.editVote = function (vote) { - $scope.data.vote = vote; + $scope.toggleVoteValue = function (choice, onEdit, event) { + if (onEdit) { + if ($scope.voteCountingIsBoolean()) { + if (choice.voteValue == null) { + choice.voteValue = true; + } + else { + choice.voteValue = !choice.voteValue; + } + if (angular.isDefined(event)) { + event.stopPropagation(); + } + } + } } $scope.deleteVote = function (vote) { 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 d255389..c38d63a 100644 --- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html @@ -84,22 +84,33 @@ <!-- begin print vote --> <tr ng-repeat="vote in data.votants track by $index" class="pollAnim"> - <td class="pollChoice"> {{vote.voterName}}</td> + <td class="pollChoice text-muted"> {{vote.voterName}}</td> <td ng-repeat="choice in vote.choice" class="pollChoice" + ng-click="toggleVoteValue(choice, vote.onEdit, $event);" ng-class="{ voteTrue:choice.voteValue != null, voteFalse:(choice.voteValue == null || (choice.voteValue == false && data.voteCountingType.renderType == 'checkbox'))}"> - <div ng-show="data.voteCountingType.renderType == 'checkbox'"> - <input type="checkbox" ng-model="choice.voteValue" disabled /> + + <div ng-hide="vote.onEdit"> + <div ng-show="data.voteCountingType.renderType == 'checkbox'" > + <span class="glyphicon glyphicon-ok text-success" ng-show="choice.voteValue"></span> + </div> + <div ng-show="data.voteCountingType.renderType != 'checkbox'"> + {{choice.voteValue}} + </div> </div> - <div ng-show="data.voteCountingType.renderType != 'checkbox'"> - {{choice.voteValue}} + <div ng-show="vote.onEdit"> + <input-error error="choice.restError[0]" data="choice.voteValue"> + <input type="{{data.voteCountingType.renderType}}" ng-model="choice.voteValue" ng-disabled="!vote.onEdit" ng-click="toggleVoteValue(choice, vote.onEdit, $event);" /> + </input-error> </div> </td> <td> - <button class="btn btn-info" ng-if="vote.permission && !globalVariables.editMode" ng-click="editVote(vote)"><span class="glyphicon glyphicon-pencil"></span></button> - <button class="btn btn-danger" ng-if="vote.permission && !globalVariables.editMode" ng-click="deleteVote(vote)"><span class="glyphicon glyphicon-trash"></span></button> + <button class="btn btn-primary" ng-if="vote.permission && !globalVariables.editMode && vote.onEdit" ng-click="saveVote(vote)"><span class="glyphicon glyphicon-ok"></span></button> + <button class="btn btn-default" ng-if="vote.permission && !globalVariables.editMode && vote.onEdit" ng-click="cancelVote(vote)"><span class="glyphicon glyphicon-remove"></span></button> + <button class="btn btn-info" ng-if="vote.permission && !globalVariables.editMode && !vote.onEdit" ng-click="editVote(vote)"><span class="glyphicon glyphicon-pencil"></span></button> + <button class="btn btn-danger" ng-if="vote.permission && !globalVariables.editMode && !vote.onEdit" ng-click="deleteVote(vote)"><span class="glyphicon glyphicon-trash"></span></button> </td> </tr> <!-- end print vote --> -- 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 develop in repository pollen. See http://git.chorem.org/pollen.git commit 496cd660548975297cba90a7844a642a8d5b73e2 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Fri Aug 1 15:30:29 2014 +0200 edit voterName for vote --- .../src/main/webapp/partials/inline-poll.html | 36 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) 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 c38d63a..844240d 100644 --- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html @@ -84,7 +84,20 @@ <!-- begin print vote --> <tr ng-repeat="vote in data.votants track by $index" class="pollAnim"> - <td class="pollChoice text-muted"> {{vote.voterName}}</td> + <td class="pollChoice"> + <div class="text-muted" ng-hide="vote.onEdit"> + {{vote.voterName}} + </div> + <div ng-show="vote.onEdit"> + <input-error error="vote.restError.voterName[0]" data="vote.voterName"> + <input type="text" + class="form-control" + placeholder="{{ 'user.name' | translate }}" + ng-model="vote.voterName" + input-error="vote.restError.voterName[0]" /> + </input-error> + </div> + </td> <td ng-repeat="choice in vote.choice" class="pollChoice" ng-click="toggleVoteValue(choice, vote.onEdit, $event);" @@ -102,15 +115,26 @@ </div> <div ng-show="vote.onEdit"> <input-error error="choice.restError[0]" data="choice.voteValue"> - <input type="{{data.voteCountingType.renderType}}" ng-model="choice.voteValue" ng-disabled="!vote.onEdit" ng-click="toggleVoteValue(choice, vote.onEdit, $event);" /> + <input type="{{data.voteCountingType.renderType}}" + ng-model="choice.voteValue" + ng-disabled="!vote.onEdit" + ng-click="toggleVoteValue(choice, vote.onEdit, $event);" /> </input-error> </div> </td> <td> - <button class="btn btn-primary" ng-if="vote.permission && !globalVariables.editMode && vote.onEdit" ng-click="saveVote(vote)"><span class="glyphicon glyphicon-ok"></span></button> - <button class="btn btn-default" ng-if="vote.permission && !globalVariables.editMode && vote.onEdit" ng-click="cancelVote(vote)"><span class="glyphicon glyphicon-remove"></span></button> - <button class="btn btn-info" ng-if="vote.permission && !globalVariables.editMode && !vote.onEdit" ng-click="editVote(vote)"><span class="glyphicon glyphicon-pencil"></span></button> - <button class="btn btn-danger" ng-if="vote.permission && !globalVariables.editMode && !vote.onEdit" ng-click="deleteVote(vote)"><span class="glyphicon glyphicon-trash"></span></button> + <button class="btn btn-primary" ng-if="vote.permission && !globalVariables.editMode && vote.onEdit" ng-click="saveVote(vote)"> + <span class="glyphicon glyphicon-ok"></span> + </button> + <button class="btn btn-default" ng-if="vote.permission && !globalVariables.editMode && vote.onEdit" ng-click="cancelVote(vote)"> + <span class="glyphicon glyphicon-remove"></span> + </button> + <button class="btn btn-info" ng-if="vote.permission && !globalVariables.editMode && !vote.onEdit" ng-click="editVote(vote)"> + <span class="glyphicon glyphicon-pencil"></span> + </button> + <button class="btn btn-danger" ng-if="vote.permission && !globalVariables.editMode && !vote.onEdit" ng-click="deleteVote(vote)"> + <span class="glyphicon glyphicon-trash"></span> + </button> </td> </tr> <!-- end print vote --> -- 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 develop in repository pollen. See http://git.chorem.org/pollen.git commit 0bb01354c5b6a360820443b86f217978b6c6fde6 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Fri Aug 1 15:48:39 2014 +0200 delete callBack for popup choice --- .../src/main/webapp/js/controllers/pollCtrl.js | 28 ++++++++++------------ .../src/main/webapp/partials/inline-poll.html | 2 +- 2 files changed, 14 insertions(+), 16 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 e1e4241..1c8e103 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -367,15 +367,15 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr if (angular.isDefined($scope.restError)) { delete $scope.restError.choice; } - popupChoice(choice, 'Ajout d\'un Choix', $scope.callBackAddChoice); + popupChoice(choice, 'Ajout d\'un Choix'); } $scope.editChoice = function (choice) { - popupChoice(choice, 'Edition du Choix', $scope.callBackEditChoice); + popupChoice(choice, 'Edition du Choix'); } - $scope.callBackAddChoice = function (choice) { + $scope.saveAddChoice = function (choice) { if (angular.isDefined($routeParams.pollId)) { var saveChoice = angular.copy(choice); @@ -391,9 +391,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr // add null in vote angular.forEach($scope.data.votants, function (voter) { - if (voter != $scope.data.vote) { - voter.choice.push({choiceId: data.id, voteValue : $scope.getVoteValue(null)}); - } + voter.choice.push({choiceId: data.id, voteValue : $scope.getVoteValue(null)}); }); $rootScope.$broadcast('newSuccess', 'poll.saved'); @@ -403,7 +401,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } } - $scope.callBackEditChoice = function (choice) { + $scope.saveEditChoice = function (choice) { if (angular.isDefined($routeParams.pollId)) { var saveChoice = angular.copy(choice); @@ -449,18 +447,18 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.saveChoice = function (choice) { if (angular.isDefined(choice)) { if (angular.isDefined(choice.id) && choice.id != null) { - $scope.callBackEditChoice(choice); + $scope.saveEditChoice(choice); } else { - $scope.callBackAddChoice(choice); + $scope.saveAddChoice(choice); } } } - var popupChoice = function (choiceEdit, title, callBack) { + var popupChoice = function (choiceEdit, title) { var choice = angular.copy(choiceEdit); - var modalCallBack = function (choiceEdit, choice, callBack) { + var modalCallBack = function (choiceEdit, choice) { if (! angular.equals(choiceEdit.choiceValue, choice.choiceValue) || choiceEdit.choiceType != choice.choiceType @@ -471,7 +469,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr choiceEdit.choiceType = choice.choiceType; choiceEdit.description = choice.description; - callBack(choiceEdit); + $scope.saveChoice(choiceEdit); } } @@ -510,13 +508,13 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr if (choice.choiceType == 'TEXT') { choice.choiceValue = choice.choiceValueText; - modalCallBack(choiceEdit, choice, callBack) + modalCallBack(choiceEdit, choice); } else if (choice.choiceType == 'DATE') { choice.choiceValue = choice.choiceValueDate; $scope.globalVariables.lastDate = new Date(choice.choiceValueDate); - modalCallBack(choiceEdit, choice, callBack) + modalCallBack(choiceEdit, choice); } else if (choice.choiceType == 'RESOURCE') { var resourceOldId = angular.copy(choiceEdit.choiceValue.id); @@ -535,7 +533,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr choice.choiceValue = choice.choiceValueImage; - modalCallBack(choiceEdit, choice, callBack) + modalCallBack(choiceEdit, choice) } else { choiceEdit.choiceValue.id = resourceOldId; 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 844240d..dc36e4b 100644 --- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html @@ -83,7 +83,7 @@ <!-- end input vote --> <!-- begin print vote --> - <tr ng-repeat="vote in data.votants track by $index" class="pollAnim"> + <tr ng-show="!globalVariables.editMode" ng-repeat="vote in data.votants track by $index" class="pollAnim"> <td class="pollChoice"> <div class="text-muted" ng-hide="vote.onEdit"> {{vote.voterName}} -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm