[pollen] branch develop updated (0663b64 -> 2bb2997)
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 0663b64 [jgitflow-maven-plugin]Updating develop poms back to pre merge state new 2bb2997 refs #1111 Replace the auto-save of the poll form by a "Save" button The 1 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 2bb2997f7b38ec83efbd23b24d0fa32700a55cd1 Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 19 17:02:29 2014 +0200 refs #1111 Replace the auto-save of the poll form by a "Save" button Summary of changes: pollen-ui-angular/src/main/webapp/i18n/en.js | 2 + pollen-ui-angular/src/main/webapp/i18n/fr.js | 2 + .../src/main/webapp/js/controllers/pollCtrl.js | 74 ++++++++----- pollen-ui-angular/src/main/webapp/js/directives.js | 120 ++++++++++----------- .../src/main/webapp/partials/inline-poll.html | 18 +++- .../src/main/webapp/partials/poll-poll.html | 4 +- .../src/main/webapp/partials/poll-popupChoice.html | 2 + .../src/main/webapp/partials/poll.html | 8 ++ .../src/main/webapp/partials/user-login.html | 4 +- 9 files changed, 139 insertions(+), 95 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 2bb2997f7b38ec83efbd23b24d0fa32700a55cd1 Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 19 17:02:29 2014 +0200 refs #1111 Replace the auto-save of the poll form by a "Save" button --- pollen-ui-angular/src/main/webapp/i18n/en.js | 2 + pollen-ui-angular/src/main/webapp/i18n/fr.js | 2 + .../src/main/webapp/js/controllers/pollCtrl.js | 74 ++++++++----- pollen-ui-angular/src/main/webapp/js/directives.js | 120 ++++++++++----------- .../src/main/webapp/partials/inline-poll.html | 18 +++- .../src/main/webapp/partials/poll-poll.html | 4 +- .../src/main/webapp/partials/poll-popupChoice.html | 2 + .../src/main/webapp/partials/poll.html | 8 ++ .../src/main/webapp/partials/user-login.html | 4 +- 9 files changed, 139 insertions(+), 95 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js index dbd9b1d..818a62c 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/en.js +++ b/pollen-ui-angular/src/main/webapp/i18n/en.js @@ -105,6 +105,8 @@ var translateEN = { 'poll.new' : 'New Poll', 'poll.edit' : 'Click to edit', +'poll.edit.choice' : 'Click to edit the choice', +'poll.edit.title' : 'Click to edit the title', 'poll.desc' : 'Description is optional. This message will not visible in vote page.', 'poll.saved' : 'Poll saved.', 'poll.created.printLink' : 'You can modify your poll to using this address when you are not connected: {{url}}', diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js index ed95bda..2d17b93 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/fr.js +++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js @@ -105,6 +105,8 @@ var translateFR = { 'poll.new' : 'Nouveau sondage', 'poll.edit' : 'Cliquez pour modifier', +'poll.edit.choice' : 'Cliquez pour modifier le choix', +'poll.edit.title' : 'Cliquez pour modifier le titre', 'poll.desc' : 'Description (facultative). Ce cadre n\'apparait pas si aucune description n\'est saisie.', 'poll.saved' : 'Sondage sauvegardé', 'poll.created.printLink' : 'Garder le lien suivant pour pouvoir modifier votre sondage plus tard, lorsque vous n\'êtes pas connecté : {{url}}', 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 dddaa28..7c2d75e 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -435,7 +435,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.globalVariables.lastType = 'TEXT'; $scope.globalVariables.lastDate = new Date(); - var initChoice = function () { + $scope.initChoice = function () { return { choiceType : $scope.globalVariables.lastType, choiceValue : '', @@ -444,7 +444,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }; $scope.addChoice = function () { - var index = $scope.data.choices.push(initChoice()); + var index = $scope.data.choices.push($scope.initChoice()); var choice = $scope.data.choices[index-1]; if (angular.isDefined($scope.restError)) { delete $scope.restError.choice; @@ -480,7 +480,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr voter.choice.push({choiceId: data.id, voteValue : $scope.getVoteValue(null)}); }); - $rootScope.$broadcast('newSuccess', 'poll.saved'); +// $rootScope.$broadcast('newSuccess', 'poll.saved'); }, function (error) { choice.restError = error.data; }); @@ -495,7 +495,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr PollChoice.update({pollId:$routeParams.pollId, permission:choice.permission}, saveChoice, function() { delete choice.restError; - $rootScope.$broadcast('newSuccess', 'poll.saved'); +// $rootScope.$broadcast('newSuccess', 'poll.saved'); }, function (error) { choice.restError = error.data; }); @@ -503,30 +503,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }; $scope.deleteChoice = function (choice) { - if (angular.isDefined($routeParams.pollId) && angular.isDefined(choice.id)) { - PollChoice.remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, choiceId: choice.id}, function () { - $rootScope.$broadcast('newSuccess', 'poll.saved'); - deleteChoice(choice); - }, function (error) { - if (error.status == 400) { - angular.extend($scope.restError, error.data); - if (angular.isDefined(error.data.choice)) { - $rootScope.$broadcast('newError', error.data.choice[0]); - } - } - else { - deleteChoice(choice); - } - }); - } else { - deleteChoice(choice); - } - }; - - var deleteChoice = function (choice) { var index = $scope.data.choices.indexOf(choice); if (index > -1) { $scope.data.choices.splice(index,1); + $scope.data.choicesToDelete.push(choice); } }; @@ -555,7 +535,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr choiceEdit.choiceType = choice.choiceType; choiceEdit.description = choice.description; - $scope.saveChoice(choiceEdit); +// $scope.saveChoice(choiceEdit); } }; @@ -651,6 +631,17 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $modalInstance.dismiss(); }; +// $scope.saveChoiceAndContinue = function () { +//// $modalInstance.dismiss(); +// $scope.addChoice(); +// var index = $scope.data.choices.push($scope.initChoice()); +// var choice = $scope.data.choices[index-1]; +// if (angular.isDefined($scope.restError)) { +// delete $scope.restError.choice; +// } +//// popupChoice(choice, 'Ajout d\'un Choix'); +// }; + $scope.cancelChoice = function () { if (angular.isDefined(oldChoice)) { angular.copy(oldChoice, $scope.choice); @@ -812,7 +803,8 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.data.poll = poll; }); - $scope.data.choices = []; + $scope.data.choices = [$scope.initChoice()]; + $scope.data.choicesToDelete = []; $scope.data.vote = {}; $scope.data.vote.choices = $scope.data.choices; }; @@ -1139,6 +1131,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr choices[key] = $scope.postReceiveChoice(ch); }); $scope.data.choices = choices; + $scope.data.choicesToDelete = []; $scope.data.vote = {}; $scope.data.vote.choice = angular.copy($scope.data.choices); }); @@ -1179,6 +1172,33 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.savePoll = function () { var savePoll = angular.copy($scope.data.poll); + savePoll.choice = angular.copy($scope.data.choices); + + angular.forEach(savePoll.choice, function(choice, key) { + $scope.saveChoice(choice); + }); + + angular.forEach($scope.data.choicesToDelete, function(choice, key) { + if (angular.isDefined(choice.id)) { + PollChoice.remove({ + pollId: $routeParams.pollId, + permission: $scope.globalVariables.pollToken, + choiceId: choice.id + }, function() { + var index = $scope.data.choicesToDelete.indexOf(choice); + if (index > -1) { + $scope.data.choicesToDelete.splice(index,1); + } + }, function (error) { + if (error.status == 400) { + angular.extend($scope.restError, error.data); + if (angular.isDefined(error.data.choice)) { + $rootScope.$broadcast('newError', error.data.choice[0]); + } + } + }); + } + }); if (angular.isDate(savePoll.beginDate)) { savePoll.beginDate = savePoll.beginDate.getTime(); diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js index 3504360..3d433f0 100644 --- a/pollen-ui-angular/src/main/webapp/js/directives.js +++ b/pollen-ui-angular/src/main/webapp/js/directives.js @@ -202,66 +202,66 @@ angular.module('pollenDirective', []) ///// AUTO SAVE ///// ////////////////////////////////////// -.directive('autoSave', ['$timeout', function ($timeout) { - return { - restrict : 'A', - link : function (scope, element, attrs) { - scope.oldVal = {}; - scope.change = false; - scope.timeout = null; - $timeout(function () { - scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel); - scope.$watch(attrs.ngModel, function () { - scope.change = scope.$eval(attrs.ngModel) != scope.oldVal[attrs.ngModel]; - }, true); - }); - - var save = function () { - try { - scope.$digest(); - } catch (e) {} - - $timeout(function () { - if (scope.change && !scope.lock) { - scope.$apply(function () { - scope.change = false; - scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel); - scope.$eval(attrs.autoSave); - }); - } - }, 100); - }; - - element.bind('change', function () { - if (scope.timeout) { - $timeout.cancel(scope.timeout) - } - scope.timeout = $timeout(save,1000); - }); - - element.bind('dp.show', function() { - scope.lock = true; - - }); - - element.bind('dp.hide', function () { - scope.lock = false; - if (scope.timeout) { - $timeout.cancel(scope.timeout); - } - - scope.timeout = $timeout(save, 100); - }); - - element.bind('blur', function () { - if (scope.timeout) { - $timeout.cancel(scope.timeout) - } - scope.timeout = $timeout(save, 100); - }); - } - } -}]) +//.directive('autoSave', ['$timeout', function ($timeout) { +// return { +// restrict : 'A', +// link : function (scope, element, attrs) { +// scope.oldVal = {}; +// scope.change = false; +// scope.timeout = null; +// $timeout(function () { +// scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel); +// scope.$watch(attrs.ngModel, function () { +// scope.change = scope.$eval(attrs.ngModel) != scope.oldVal[attrs.ngModel]; +// }, true); +// }); +// +// var save = function () { +// try { +// scope.$digest(); +// } catch (e) {} +// +// $timeout(function () { +// if (scope.change && !scope.lock) { +// scope.$apply(function () { +// scope.change = false; +// scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel); +// scope.$eval(attrs.autoSave); +// }); +// } +// }, 100); +// }; +// +// element.bind('change', function () { +// if (scope.timeout) { +// $timeout.cancel(scope.timeout) +// } +// scope.timeout = $timeout(save,1000); +// }); +// +// element.bind('dp.show', function() { +// scope.lock = true; +// +// }); +// +// element.bind('dp.hide', function () { +// scope.lock = false; +// if (scope.timeout) { +// $timeout.cancel(scope.timeout); +// } +// +// scope.timeout = $timeout(save, 100); +// }); +// +// element.bind('blur', function () { +// if (scope.timeout) { +// $timeout.cancel(scope.timeout) +// } +// scope.timeout = $timeout(save, 100); +// }); +// } +// } +//}]) ////////////////////////////////////// ///// MAKE PAGINATION ///// 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 3d6a1ea..c610940 100644 --- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html @@ -26,28 +26,39 @@ <!--<button ng-click="bigVersion()" class="btn btn-default" >Big version</button>--> </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 || !choice.id)) || globalVariables.editMode)" class="fixe-input" title="{{choice.description}}"> - {{ choice.choiceValue || ('poll.edit' | translate) }} + {{ choice.choiceValue || ('poll.edit.choice' | translate) }} <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue" append-class="fa-lg"></info-error> - <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, $event);" value="..."/></div> + <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, $event);" 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, $event);" value="..."/> </div> + </div> + <div ng-if="choice.choiceType == 'DATE'" edit-me="showEdit" > + <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) }} + {{ (choice.choiceValue | date:globalVariables.dateTimeFormat) || ('poll.edit.choice' | translate) }} <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue" append-class="fa-lg"></info-error> <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, $event);" value="..."/> </div> + <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, $event);" value="..."/> </div> + </div> + <div ng-if="choice.choiceType == 'RESOURCE'"> + <div class="fixe-input" title="{{choice.description}}"> {{choice.choiceValue.meta.name}} <info-error error="choice.restError.choiceValue[0]" data="choice.choiceValue" append-class="fa-lg"></info-error> @@ -57,7 +68,6 @@ </div> - </div> </td> <td ng-if="data.poll.choiceAddAllowed || globalVariables.editMode"><button class="btn btn-default btn-large" ng-click="addChoice()" tooltip="{{ 'action.choice.add' | translate }}"> <span class="fa fa-plus"></span> </button></td> 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 1d7631c..6201431 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll-poll.html @@ -20,7 +20,7 @@ --> <div class="pollTitle" edit-me="showEditTitle" novalidate> <h1 ng-hide="showEditTitle"> - <span tooltip="{{ !globalVariables.editMode ? '' : 'poll.edit' | translate }}">{{data.poll.title || 'poll.edit' | translate }}</span> <span class="fa fa-pencil" showonhoverparent ng-if="globalVariables.editMode"></span> + <span tooltip="{{ !globalVariables.editMode ? '' : 'poll.edit.title' | translate }}">{{data.poll.title || 'poll.edit.title' | translate }}</span> <span class="fa fa-pencil" showonhoverparent ng-if="globalVariables.editMode"></span> <info-error error="restError.title[0]" data="data.poll.title" append-class="fa-lg"></info-error> </h1> @@ -44,7 +44,7 @@ <div ng-show="showEditDesc" class="pollDesc"> <textarea id="descEditor" data-ck-editor ng-model="data.poll.description" focus-me="showEditDesc"></textarea> - <button type="button" class="btn btn-primary" ng-click="showEditDesc = false; autoSavePoll()">{{ 'action.return' | translate }}</button> + <button type="button" class="btn btn-primary" ng-click="showEditDesc = false">{{ 'action.return' | translate }}</button> </div> <div id="poll"> diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html index 0784d8d..84e0111 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html @@ -72,5 +72,7 @@ <button type="button" class="btn btn-danger" ng-if="choice.choiceIsDeletable" ng-click="deleteChoice(choice)"><span class="fa fa-trash"></span> Supprimer</button> <button type="button" class="btn btn-default" ng-click="cancelChoice()"><span class="fa fa-remove"></span> Annuler</button> <button type="button" class="btn btn-primary" ng-click="saveChoice()"><span class="fa fa-save"></span> Sauvegarder</button> + <!--<button type="button" class="btn btn-success" ng-click="saveChoice()"><span class="fa fa-save"></span> Sauvegarder</button>--> + <!--<button type="button" class="btn btn-primary" ng-click="saveChoiceAndContinue()"><span class="fa fa-save"></span> Sauvegarder et nouveau</button>--> </div> </form> \ No newline at end of file diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html index ebbf377..04dc5dc 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll.html @@ -38,11 +38,18 @@ <div ng-include="'./partials/poll-poll.html'" ng-if="tab == 'vote'" ng-controller="PollVoteCtrl" class="anim-fade"></div> <div ng-if="!globalVariables.create && (tab == 'edit' || tab == 'conf' || tab == 'participant')" ng-controller="PollEditCtrl"> + <div ng-include="'./partials/poll-poll.html'" ng-if="tab == 'edit'" class="anim-fade"></div> <div ng-include="'./partials/poll-settings.html'" ng-if="tab == 'conf'" class="anim-fade poll-settings"></div> <div ng-include="'./partials/poll-listParticipant.html'" ng-if="tab == 'participant'" class="anim-fade"></div> + + <div> + <hr/> + <button class="btn btn-primary" ng-click="savePoll()"><span class="fa fa-save"></span> {{ 'action.save' | translate }}</button> + </div> + </div> <div ng-if="globalVariables.create && (tab == 'create' || tab == 'conf' || tab == 'participant')"> @@ -57,6 +64,7 @@ <hr/> <button class="btn btn-primary" ng-click="savePoll()"><span class="fa fa-save"></span> {{ 'action.save' | translate }}</button> </div> + </div> diff --git a/pollen-ui-angular/src/main/webapp/partials/user-login.html b/pollen-ui-angular/src/main/webapp/partials/user-login.html index 0db15c4..614295a 100644 --- a/pollen-ui-angular/src/main/webapp/partials/user-login.html +++ b/pollen-ui-angular/src/main/webapp/partials/user-login.html @@ -38,13 +38,13 @@ <div class="control-group"> <label class="control-label checkbox" > - <input type="checkbox" name='rememberMe' ng-model="data.user.rememberMe"> + <input type="checkbox" name='rememberMe' ng-model="data.user.rememberMe" /> {{ 'user.rememberMe' | translate }} </label> </div> <div class="form-actions"> - <button type="submit" class="btn btn-primary"><span class="fa fa-sign-in"></span> {{ 'action.login' | translate }}</button> + <button type="submit" class="btn btn-primary"><span class="fa fa-sign-in"></span> {{ 'action.login' | translate }}</button> <hr/> <a href="#/user/lostpassword"> {{ 'user.forgotPassword' | translate }}</a> </div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm