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 2e7b2834d8a5b7e6f0518f93196371a88ce4ae1e Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Tue Aug 19 14:58:55 2014 +0200 add info error un tab and remove button create user in home when connected --- pollen-ui-angular/src/main/webapp/i18n/en.js | 1 + pollen-ui-angular/src/main/webapp/i18n/fr.js | 1 + .../src/main/webapp/js/controllers/pollCtrl.js | 29 ++++++++++++++++++++-- .../src/main/webapp/partials/home.html | 3 ++- .../src/main/webapp/partials/poll.html | 12 ++++----- 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js index b90399c..5800ba0 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/en.js +++ b/pollen-ui-angular/src/main/webapp/i18n/en.js @@ -177,6 +177,7 @@ var translateEN = { 'action.message.confirmDelete' : 'Are you sure to delete it?', 'action.message.confirmClose' : 'Are you sure to close it?', +'error.form' : 'Form error', 'error.forbidden' : 'Access forbidden', 'error.notFound' : 'Not found resource', 'error.noServer' : 'No connexion with the server', diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js index 2c7fd84..8a284d7 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/fr.js +++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js @@ -177,6 +177,7 @@ var translateFR = { 'action.message.confirmDelete' : 'Êtes vous sûr de vouloir le supprimer?', 'action.message.confirmClose' : 'Êtes vous sûr de vouloir le fermer?', +'error.form' : 'Erreur de formulaire', 'error.forbidden' : 'Accès interdit', 'error.notFound' : 'Aucune ressource trouvée', 'error.noServer' : 'Erreur de connexion avec le serveur', 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 7e3317f..88fa104 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -21,8 +21,9 @@ 'use strict'; angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.translate', 'ui.bootstrap']) -.controller('HomeCtrl', ['$scope', 'Poll', 'Page', function ($scope, Poll, Page) { +.controller('HomeCtrl', ['$scope', 'Poll', 'SessionStorage', 'Page', function ($scope, Poll, SessionStorage, Page) { Page.setTitle('title.home'); + $scope.isConnected = (SessionStorage.get().user !== undefined); Poll.skeletonNew(); }]) @@ -804,6 +805,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } Poll.add(poll, function (data) { + $scope.globalVariables.pollError = false; + $scope.globalVariables.configError = false; + $scope.globalVariables.participantError = false; + $rootScope.$broadcast('newInfo', $filter('translate')('poll.created.printLink', {url: '<input type="text" class="form-control" value="' + @@ -820,11 +825,31 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $location.url('/poll/edit/'+data.id+'/'+data.permission); } }, function (error) { - $scope.globalVariables.restError = true; + console.log(error) + if (error.data.hasOwnProperty('title') || error.data.hasOwnProperty('choice')) { + $scope.globalVariables.pollError = true; + } + + if (error.data.hasOwnProperty('endDate') || + error.data.hasOwnProperty('beginChoiceDate') || + error.data.hasOwnProperty('endChoiceDate') || + error.data.hasOwnProperty('commentVisibility') || + error.data.hasOwnProperty('resultVisibility') || + error.data.hasOwnProperty('voteVisibility') || + error.data.hasOwnProperty('voteCountingType')) { + + $scope.globalVariables.configError = true; + } + + if (error.data.hasOwnProperty('pollType')) { + $scope.globalVariables.participantError = true; + } + $scope.restError = error.data; angular.forEach($scope.data.choices, function (choice, index) { if (angular.isDefined(error.data['choice['+index+'].choiceValue'])) { choice.restError = {choiceValue:error.data['choice['+index+'].choiceValue']}; + $scope.globalVariables.pollError = true; } else { delete choice.restError; diff --git a/pollen-ui-angular/src/main/webapp/partials/home.html b/pollen-ui-angular/src/main/webapp/partials/home.html index ab0d19d..addf9a2 100644 --- a/pollen-ui-angular/src/main/webapp/partials/home.html +++ b/pollen-ui-angular/src/main/webapp/partials/home.html @@ -29,7 +29,8 @@ </p> <p class=""> <a href="#/poll/create" class="btn btn-primary btn-lg"><span class="fa fa-plus-circle"></span> {{ 'home.newPoll' | translate }}</a> - <a href="#/user/register" class="btn btn-default btn-lg"><span class="fa fa-users"></span> {{ 'home.register' | translate }} </a> + <a href="#/user/register" class="btn btn-default btn-lg" ng-if="!isConnected"><span class="fa fa-users"></span> {{ 'home.register' | translate }} </a> </p> </div> </div> + diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html index a32b7d8..876170b 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll.html @@ -24,13 +24,13 @@ <li ng-class="{active: tab == 'vote'}" ng-show="data.poll.id"><a href="{{globalVariables.linkVote}}" ng-click="tab = 'vote'"><span class="fa fa-thumbs-o-up fa-flip-horizontal"></span> {{ 'poll.tab.vote' | translate }}</a></li> <li ng-class="{active: tab == 'comment'}" ng-show="data.poll.commentIsVisible"><a href="{{globalVariables.linkComment}}" ng-click="tab = 'comment'"><span class="fa fa-comments-o"></span> {{ 'poll.tab.comment' | translate }}</a></li> <li ng-class="{active: tab == 'result'}" ng-show="data.poll.resultIsVisible"><a href="{{globalVariables.linkResult}}" ng-click="tab = 'result'"><span class="fa fa-bar-chart-o"></span> {{ 'poll.tab.result' | translate }}</a></li> - <li ng-class="{active: tab == 'edit'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkEdit}}" ng-click="tab = 'edit'"><span class="fa fa-pencil-square-o"></span> {{ 'poll.tab.edit' | translate }}</a></li> - <li ng-class="{active: tab == 'conf'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkConf}}" ng-click="tab = 'conf'"><span class="fa fa-wrench"></span> {{ 'poll.tab.conf' | translate }}</a></li> - <li ng-class="{active: tab == 'participant'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkParticipant}}" ng-click="tab = 'participant'"><span class="fa fa-users"></span> {{ 'poll.tab.participant' | translate }}</a></li> + <li ng-class="{active: tab == 'edit'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkEdit}}" ng-click="tab = 'edit'"><span class="fa fa-pencil-square-o"></span> {{ 'poll.tab.edit' | translate }} <info-error error="'error.form'" ng-if="pollError"></info-error></a></li> + <li ng-class="{active: tab == 'conf'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkConf}}" ng-click="tab = 'conf'"><span class="fa fa-wrench"></span> {{ 'poll.tab.conf' | translate }} <info-error error="'error.form'" ng-if="configError"></info-error></a></li> + <li ng-class="{active: tab == 'participant'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkParticipant}}" ng-click="tab = 'participant'"><span class="fa fa-users"></span> {{ 'poll.tab.participant' | translate }} <info-error error="'error.form'" ng-if="participantError"></info-error></a></li> - <li ng-class="{active: tab == 'create'}" ng-show="globalVariables.create"><a href="#/poll/create" ng-click="tab = 'create'"><span class="fa fa-pencil-square-o"></span> {{ 'poll.tab.create' | translate }}</a></li> - <li ng-class="{active: tab == 'conf'}" ng-show="globalVariables.create"><a href="#/poll/create/conf" ng-click="tab = 'conf'"><span class="fa fa-wrench"></span> {{ 'poll.tab.conf' | translate }}</a></li> - <li ng-class="{active: tab == 'participant'}" ng-show="globalVariables.create"><a href="#/poll/create/participant" ng-click="tab = 'participant'"><span class="fa fa-users"></span> {{ 'poll.tab.participant' | translate }}</a></li> + <li ng-class="{active: tab == 'create'}" ng-show="globalVariables.create"><a href="#/poll/create" ng-click="tab = 'create'"><span class="fa fa-pencil-square-o"></span> {{ 'poll.tab.create' | translate }} <info-error error="'error.form'" ng-if="globalVariables.pollError"></info-error></a></li> + <li ng-class="{active: tab == 'conf'}" ng-show="globalVariables.create"><a href="#/poll/create/conf" ng-click="tab = 'conf'"><span class="fa fa-wrench"></span> {{ 'poll.tab.conf' | translate }} <info-error error="'error.form'" ng-if="globalVariables.configError"></info-error></a></li> + <li ng-class="{active: tab == 'participant'}" ng-show="globalVariables.create"><a href="#/poll/create/participant" ng-click="tab = 'participant'"><span class="fa fa-users"></span> {{ 'poll.tab.participant' | translate }} <info-error error="'error.form'" ng-if="globalVariables.participantError"></info-error></a></li> </ul> <div ng-include="'./partials/poll-info.html'" ng-controller="PollInfoCtrl" class="poll-info"></div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.