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 2ed75b28f9c8454745d8f70903defa52036f9797 Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 27 12:04:55 2014 +0200 fixes #1060 Comment page layout --- pollen-ui-angular/src/main/webapp/i18n/en.js | 5 ++ pollen-ui-angular/src/main/webapp/i18n/fr.js | 10 ++- .../src/main/webapp/js/controllers/pollCtrl.js | 10 ++- .../src/main/webapp/partials/poll-comment.html | 83 +++++++++++++--------- 4 files changed, 72 insertions(+), 36 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js index da8473a..54ca91d 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/en.js +++ b/pollen-ui-angular/src/main/webapp/i18n/en.js @@ -5,6 +5,7 @@ var translateEN = { 'title.poll.edit' : 'Edit poll', 'title.poll.vote' : 'Vote', 'title.poll.comment' : 'Comment', +'title.poll.comments' : 'Comments', 'title.poll.result' : 'Result of poll', 'title.poll.list' : 'List of poll', 'title.user.register' : 'Register', @@ -149,6 +150,9 @@ var translateEN = { 'comment.added.printLink' : 'You can modify your comment to using this address when you are not connected: {{url}}', 'comment.order.toDesc' : 'Ordered by newer date', 'comment.order.toAsc' : 'Ordered by older date', +'comment.none' : 'No comment', +'comment.edit' : 'Edit the comment', +'comment.delete' : 'Delete the comment', 'action.logout' : 'Logout', 'action.login' : 'Login', @@ -179,6 +183,7 @@ var translateEN = { 'action.unselectAll' : 'Unselect All', 'action.toggleSelectAll' : 'Toggle the select', 'action.deleteSelected' : 'Delete the selected', +'action.choice.add' : 'Add a choice', 'action.message.confirmDelete' : 'Are you sure to delete it?', 'action.message.confirmClose' : 'Are you sure to close it?', diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js index 9c49bb3..8b83e77 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/fr.js +++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js @@ -5,6 +5,7 @@ var translateFR = { 'title.poll.edit' : 'Edition du sondage', 'title.poll.vote' : 'Voter', 'title.poll.comment' : 'Laisser un Commentaire', +'title.poll.comments' : 'Commentaires', 'title.poll.result' : 'Résultat du sondage', 'title.poll.list' : 'Liste des sondages', 'title.user.register' : 'Inscription', @@ -59,7 +60,7 @@ var translateFR = { 'user.error.listEmpty' : 'Aucun utilisateur trouvé', 'poll.tab.vote' : 'Voter', -'poll.tab.comment' : 'Commenter', +'poll.tab.comment' : 'Commentaires', 'poll.tab.result' : 'Résultat', 'poll.tab.create' : 'Créer', 'poll.tab.edit' : 'Éditer', @@ -147,8 +148,11 @@ var translateFR = { 'comment' : 'Commentaire', 'comment.added' : 'Commentaire effectué', 'comment.added.printLink' : 'Garder le lien suivant pour pouvoir modifier votre commentaire, lorsque vous n\'êtes pas connecté : {{url}}', -'comment.order.toDesc' : 'Ordonner par le plus récent', -'comment.order.toAsc' : 'Ordonner par ordre chronologique', +'comment.order.toDesc' : 'Ordonner du plus récent au plus ancien', +'comment.order.toAsc' : 'Ordonner du plus ancien au plus récent', +'comment.none' : 'Aucun commentaire', +'comment.edit' : 'Éditer le commentaire', +'comment.delete' : 'Supprimer le commentaire', 'action.logout' : 'Se Deconnecter', 'action.login' : 'Se Connecter', 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 ff0b922..be976fe 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -1501,7 +1501,8 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.commentToken = $routeParams.commentToken; } - $scope.comment = {text:''}; + $scope.comment = {text:'', hideForm : true}; + var initAuthor = function () { if (angular.isDefined($scope.session.user)) { if (angular.isDefined($scope.session.user.name)) { @@ -1571,6 +1572,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr initComments(); initAuthor(); }).$promise; + } else { //Add commentPromise = PollComment.add({pollId:$routeParams.pollId}, $scope.comment, function (data) { @@ -1606,22 +1608,28 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.data.commentsPagination.currentPage = $scope.data.commentsPagination.lastPage; }); } + }).$promise; } commentPromise.then(function () { $rootScope.$broadcast('newSuccess', 'comment.added'); + //hide comment form + $scope.comment.hideForm = true; //clean form $scope.comment.text = ''; + delete $scope.comment.postDate; delete $scope.comment.id; delete $scope.comment.permission; + }, function (error) { $scope.restError = error.data; }) }; $scope.editPost = function (comment) { + $scope.comment.hideForm = false; $scope.comment = angular.copy(comment); $scope.comment.page = paginationParameter.pageNumber; }; diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html index 15f3736..1f90e43 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html @@ -20,51 +20,70 @@ --> <div> <h1>{{ data.poll.title }}</h1> - <h2>{{ 'title.poll.comment' | translate }}</h2> - <!-- begin for add comment --> - <form class="form-horizontal" ng-submit="postComment()" novalidate> - <div class="form-group"> - <label class="col-sm-2"> {{ 'user.name' | translate }} </label> - <div class="col-sm-1"> - <info-error error="restError['author.name'][0]" data="comment.authorName" append-class="fa-2x"></info-error> - </div> - <div class="col-sm-9"> - <input type="text" ng-model="comment.authorName" class="form-control" focus-me="comment.id != null || restError['author.name'] !== undefined" /> - </div> - </div> + <button ng-click="comment.hideForm = false" class="btn btn-info"> + <span class="fa fa-plus"></span> {{ 'title.poll.comment' | translate }} + </button> - <div class="form-group"> - <label class="col-sm-2"> {{ 'comment' | translate }} </label> - <div class="col-sm-1"><info-error error="restError.text[0]" data="comment.text" append-class="fa-2x"></info-error></div> - <div class="col-sm-9"> - <textarea ck-editor ng-model="comment.text" focus-me="comment.id != null || restError.text[0] !== undefined"></textarea> + <div ng-hide="comment.hideForm" style="margin-top: 10px;"> + + <!-- begin for add comment --> + <form class="form-horizontal" ng-submit="postComment()" novalidate> + <div class="form-group"> + <label class="col-sm-2"> {{ 'user.name' | translate }} </label> + <div class="col-sm-1"> + <info-error error="restError['author.name'][0]" data="comment.authorName" append-class="fa-2x"></info-error> + </div> + <div class="col-sm-9"> + <input type="text" ng-model="comment.authorName" class="form-control" focus-me="comment.id != null || restError['author.name'] !== undefined" /> + </div> </div> - </div> - <div class="form-group"> - <div class="col-sm-3"> - <div ng-show="data.comments"> - <a class="fakeLink" ng-click="toggleOrder()" ng-show="desc" tooltip="{{ 'comment.order.toAsc' | translate }}"><span class="fa fa-sort-amount-asc"></span></a> - <a class="fakeLink" ng-click="toggleOrder()" ng-hide="desc" tooltip="{{ 'comment.order.toDesc' | translate }}"><span class="fa fa-sort-amount-desc"></span></a> + <div class="form-group"> + <label class="col-sm-2"> {{ 'comment' | translate }} </label> + <div class="col-sm-1"><info-error error="restError.text[0]" data="comment.text" append-class="fa-2x"></info-error></div> + <div class="col-sm-9"> + <textarea ck-editor ng-model="comment.text" focus-me="comment.id != null || restError.text[0] !== undefined"></textarea> </div> </div> - <div class="col-sm-9"> - <button type="submit" class="btn btn-primary" ng-hide="comment.id"><span class="fa fa-comment"></span> {{ 'action.comment' | translate }}</button> - <button type="submit" class="btn btn-primary" ng-show="comment.id"><span class="fa fa-pencil-square-o"></span> {{ 'action.edit' | translate }}</button> + + <div class="form-group"> + <div class="col-sm-3"> + </div> + <div class="col-sm-9"> + <button type="submit" class="btn btn-primary" ng-hide="comment.id"><span class="fa fa-comment"></span> {{ 'action.comment' | translate }}</button> + <button type="submit" class="btn btn-primary" ng-show="comment.id"><span class="fa fa-pencil-square-o"></span> {{ 'action.edit' | translate }}</button> + <a class="btn btn-danger" ng-click="comment.hideForm = true; comment.text = ''"> + <span class="fa fa-times"></span> {{ 'action.cancel' | translate }} + </a> + </div> </div> - </div> - </form> - <!-- end form comment --> + </form> + <!-- end form comment --> + </div> <!-- begin print comments --> + <h2> + {{ 'title.poll.comments' | translate }} + <a class="fakeLink" + ng-click="toggleOrder()" + ng-show="data.comments" + tooltip="{{ desc ? ('comment.order.toAsc' | translate) : ('comment.order.toDesc' | translate) }}"> + <span ng-class="desc ? 'fa fa-sort-amount-asc' : 'fa fa-sort-amount-desc'"></span> + </a> + </h2> + <span ng-if="data.comments.length == 0">{{ 'poll.noComment' | translate }}</span> <table id="comments"> <tr ng-repeat="comment in data.comments"> <td> <span class="fa fa-user"></span> {{comment.authorName}}<br/> - <span class="fa fa-calendar"></span> {{comment.postDate | date:globalVariables.dateTimeFormat}}<br/> - <a class="fakeLink" ng-click="editPost(comment)" ng-if="comment.permission"><span class="fa fa-pencil-square-o" ng-show="comment.id"></span></a> - <a class="fakeLink" ng-click="deletePost(comment)" ng-if="comment.permission"><span class="fa fa-trash-o danger" ng-show="comment.id"></span></a> + <span class="fa fa-calendar-o"></span> {{comment.postDate | date:globalVariables.dateTimeFormat}}<br/> + <a class="fakeLink" ng-click="editPost(comment)" ng-if="comment.permission" title="{{ 'comment.edit' | translate }}"> + <span class="fa fa-pencil-square-o" ng-show="comment.id"></span> + </a> + <a class="fakeLink" ng-click="deletePost(comment)" ng-if="comment.permission" title="{{ 'comment.delete' | translate }}"> + <span class="fa fa-trash-o danger" ng-show="comment.id"></span> + </a> </td> <td> <div ng-bind-html="toHTML(comment.text)"></div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.