[pollen] branch feature/createPreviewRessource updated (4a68b5f -> d647c8e)
This is an automated email from the git hooks/post-receive script. New change to branch feature/createPreviewRessource in repository pollen. See http://git.chorem.org/pollen.git from 4a68b5f add voteCountingType into poll info new d647c8e add rest error message. Add information message when loading of a page 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 d647c8e441a68c9a613b6dba53174e8788c2055d Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Aug 14 12:41:45 2014 +0200 add rest error message. Add information message when loading of a page Summary of changes: pollen-ui-angular/src/main/webapp/i18n/en.js | 5 ++- pollen-ui-angular/src/main/webapp/i18n/fr.js | 5 ++- pollen-ui-angular/src/main/webapp/js/app.js | 46 +++++++++++++++++++++- .../src/main/webapp/js/controllers/alertCtrl.js | 16 ++++++++ .../src/main/webapp/js/controllers/pollCtrl.js | 32 ++++++++------- pollen-ui-angular/src/main/webapp/less/style.less | 4 +- .../src/main/webapp/partials/poll-info.html | 4 +- .../src/main/webapp/partials/poll.html | 2 +- 8 files changed, 91 insertions(+), 23 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 feature/createPreviewRessource in repository pollen. See http://git.chorem.org/pollen.git commit d647c8e441a68c9a613b6dba53174e8788c2055d Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Thu Aug 14 12:41:45 2014 +0200 add rest error message. Add information message when loading of a page --- pollen-ui-angular/src/main/webapp/i18n/en.js | 5 ++- pollen-ui-angular/src/main/webapp/i18n/fr.js | 5 ++- pollen-ui-angular/src/main/webapp/js/app.js | 46 +++++++++++++++++++++- .../src/main/webapp/js/controllers/alertCtrl.js | 16 ++++++++ .../src/main/webapp/js/controllers/pollCtrl.js | 32 ++++++++------- pollen-ui-angular/src/main/webapp/less/style.less | 4 +- .../src/main/webapp/partials/poll-info.html | 4 +- .../src/main/webapp/partials/poll.html | 2 +- 8 files changed, 91 insertions(+), 23 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js index ac7aabf..cef2cad 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/en.js +++ b/pollen-ui-angular/src/main/webapp/i18n/en.js @@ -171,7 +171,10 @@ var translateEN = { 'action.message.confirmDelete' : 'Are you sure to delete it?', 'action.message.confirmClose' : 'Are you sure to close it?', -'error.forbidden' : 'Access forbidden' +'error.forbidden' : 'Access forbidden', +'error.notFound' : 'Not found resource', +'error.noServer' : 'No connexion with the server', +'info.load' : 'Loading' }; diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js index b59d1ad..2b13096 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/fr.js +++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js @@ -171,7 +171,10 @@ 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.forbidden' : 'Accès interdit' +'error.forbidden' : 'Accès interdit', +'error.notFound' : 'Aucune ressource trouvée', +'error.noServer' : 'Erreur de connexion avec le serveur', +'info.load' : 'Chargement en cours' }; diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js index 9f64313..359faae 100644 --- a/pollen-ui-angular/src/main/webapp/js/app.js +++ b/pollen-ui-angular/src/main/webapp/js/app.js @@ -29,7 +29,31 @@ angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'Polle $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; }]) -.factory('httpInterceptor', ['$q', '$rootScope', '$location', 'SessionStorage', function ($q, $rootScope, $location, SessionStorage) { +.factory('httpInterceptor', ['$q', '$rootScope', '$location', '$timeout', 'SessionStorage', + function ($q, $rootScope, $location, $timeout, SessionStorage) { + if (angular.isUndefined($rootScope.nbRequest)) { + $rootScope.nbRequest = -1; + } + + var startRequest = function () { + if ($rootScope.nbRequest == -1) { + $rootScope.$broadcast('load', $rootScope.nbRequest); + } + $rootScope.nbRequest+=2; + }; + + var finishRequest = function () { + $rootScope.nbRequest--; + $timeout(function () { + $rootScope.nbRequest--; + + if ($rootScope.nbRequest == -1) { + $rootScope.$broadcast('unload'); + } + }, 50); + }; + + return { request: function($config) { var session = SessionStorage.get(); @@ -41,10 +65,28 @@ angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'Polle // set header for session token $config.headers['X-Pollen-Session-Token'] = session.token; + + startRequest(); + return $config; }, + response: function(response) { + finishRequest(); + + return response; + }, responseError: function(response) { - if (response.status === 401) { + finishRequest(); + + if (response.status === 0) { + // no access to server + $rootScope.$broadcast('newError', 'error.noServer'); + } + else if (response.status === 404) { + // not found resource + $rootScope.$broadcast('newError', 'error.notFound'); + } + else if (response.status === 401) { //error login or sessionToken $rootScope.$broadcast('sessionExpired'); } diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js index 8493e41..721c7fa 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js @@ -68,6 +68,22 @@ angular.module('alertControllers', []) } }); + $scope.$on('load', function () { + console.log('load'); + if (angular.isUndefined($scope.alert)) { + $scope.alert = {msg: 'info.load', type: 'info', icon: 'fa fa-spin fa-spinner'}; + $scope.data.alerts.push($scope.alert); + } + }); + $scope.$on('unload', function () { + console.log('finish load'); + var index = $scope.data.alerts.indexOf($scope.alert); + if (index >= 0) { + $scope.data.alerts.splice(index, 1); + delete $scope.alert; + } + }); + $scope.addAlert = function (alert, timeout) { var alertNotExist = true; var poolAlert; 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 6204cbb..cde3338 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -103,7 +103,6 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }; setDateFormat(); $scope.data = {}; - $scope.data.poll = {}; $scope.pollDeferred = $q.defer(); @@ -140,6 +139,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr pollDeferred.promise.then(function () { setVoteCountingType(); + initTemplateURL(); $scope.data.poll.limitedVote = $scope.data.poll.maxChoiceNumber > 0; }); @@ -174,17 +174,15 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }; $scope.inlineVersion = function () { - $scope.data.poll.template = 'inline'; $scope.templateURL = './partials/inline-poll.html'; }; $scope.bigVersion = function () { - $scope.data.poll.template = 'big'; $scope.templateURL = './partials/big-poll.html'; }; var initTemplateURL = function () { - if (angular.isDefined($scope.data.poll.template)) { + if (angular.isDefined($scope.data.poll) && angular.isDefined($scope.data.poll.template)) { if ($scope.data.poll.template == "big") { $scope.bigVersion(); } @@ -284,8 +282,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } }); - $scope.$watch('data.poll.title', function () { - Page.setValue($scope.data.poll.title); + $scope.$watch('data.poll.title', function (newVal) { + if (angular.isDefined(newVal)) { + Page.setValue(newVal); + } }); }); @@ -727,11 +727,13 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }; initVoteCountingType(); var setHelper = function () { - angular.forEach($scope.data.allVoteCountingType, function (value) { - if (value.id == $scope.data.poll.voteCountingType) { - $scope.data.voteCountingType = angular.copy(value); - } - }); + if (angular.isDefined($scope.data.poll)) { + angular.forEach($scope.data.allVoteCountingType, function (value) { + if (value.id == $scope.data.poll.voteCountingType) { + $scope.data.voteCountingType = angular.copy(value); + } + }); + } }; $timeout(function () { @@ -741,8 +743,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }); $timeout(function () { - $scope.$watch('data.poll.voteCountingType', function () { - setHelper(); + $scope.$watch('data.poll.voteCountingType', function (newVal) { + if (angular.isDefined(newVal)) { + setHelper(); + } }) }); }]) @@ -765,8 +769,6 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr var initPoll = function () { Poll.skeletonNew(function (poll) { $scope.data.poll = poll; - }, function () { - $scope.data.poll = {}; }); $scope.data.choices = []; diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less index 764d2ae..666903c 100644 --- a/pollen-ui-angular/src/main/webapp/less/style.less +++ b/pollen-ui-angular/src/main/webapp/less/style.less @@ -307,7 +307,9 @@ body { .btn-large { height:60px; width:80px; - font-size: 1.5em; + span { + font-size: 1.5em; + } } .preview { diff --git a/pollen-ui-angular/src/main/webapp/partials/poll-info.html b/pollen-ui-angular/src/main/webapp/partials/poll-info.html index 5fb145d..6a88165 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll-info.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll-info.html @@ -32,11 +32,11 @@ </p> </div> -<div ng-if="data.poll.limitedVote"> +<div ng-if="data.poll.limitedVote" class="anim"> <h4>{{ 'poll.info.limitedChoice' | translate:{'nb':data.poll.maxChoiceNumber} }}</h4> </div> -<div> +<div ng-if="data.voteCountingType" class="anim"> <h4>{{ 'poll.info.voteCountingType' | translate:{'name':data.voteCountingType.name} }}</h4> <p ng-bind-html="toHTML(data.voteCountingType.helper)"></p> </div> \ 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 b3e7fcc..f41830f 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll.html @@ -19,7 +19,7 @@ #L% --> -<div id="poll-content" ng-class="{'maxi-content': globalVariables.minify}"> +<div id="poll-content" ng-class="{'maxi-content': globalVariables.minify}" ng-if="data.poll"> <ul class="nav nav-tabs"> <li ng-class="{active: tab == 'vote'}" ng-show="data.poll.id"><a href="{{globalVariables.linkVote}}" ng-click="tab = 'vote'">{{ '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'">{{ 'poll.tab.comment' | translate }}</a></li> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm