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 23708fc1b737eb85d69dac9fa2ae9029330901ef Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Jul 9 15:42:11 2014 +0200 add in conf date Format --- pollen-ui-angular/src/main/webapp/i18n/en.js | 2 -- pollen-ui-angular/src/main/webapp/i18n/fr.js | 2 -- .../src/main/webapp/js/conf.js.exemple | 12 ++++++++ .../src/main/webapp/js/controllers/pollCtrl.js | 22 +++++++------- pollen-ui-angular/src/main/webapp/js/services.js | 34 ++++++++++++++++++++++ .../src/main/webapp/partials/poll-comment.html | 2 +- .../src/main/webapp/partials/poll-popupChoice.html | 1 + 7 files changed, 59 insertions(+), 16 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js index 8ae450a..66046a0 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/en.js +++ b/pollen-ui-angular/src/main/webapp/i18n/en.js @@ -113,8 +113,6 @@ var translateEN = { 'action.message.confirmDelete' : 'Are you sure to delete it?', 'action.message.confirmClose' : 'Are you sure to close it?', -'dateFormat' : 'MM-dd-yy', - 'error.forbidden' : 'Access forbidden', } diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js index 86bccd4..ea9c74b 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/fr.js +++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js @@ -113,8 +113,6 @@ var translateFR = { 'action.message.confirmDelete' : 'Êtes vous sûr de vouloir le supprimer?', 'action.message.confirmClose' : 'Êtes vous sûr de vouloir le fermer?', -'dateFormat' : 'dd/MM/yyyy', - 'error.forbidden' : 'Accès interdit', } diff --git a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple index 9c44d4a..4135a7c 100644 --- a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple +++ b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple @@ -32,4 +32,16 @@ var conf = { // Time in ms to print alert error // -1 for infinite time, click or reload for close alert defaultAlertTimeError: -1, // infinite + + // Format Date + // preference : shortDate, mediumDate, longDate, fullDate + defaultDateFormat : "shortDate", + + // Format Time + // preference : shortTime, mediumTime + defaultTimeFormat: "shortTime", + + // Format DateTime + // preference : short, medium + defaultDateTimeFormat: "short", } \ No newline at end of file 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 d038e2c..e5a201b 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -25,8 +25,8 @@ angular.module('pollControllers', []) }]) .controller('PollCtrl', - ['$scope', '$rootScope', '$controller', '$sce', '$timeout', '$routeParams', '$location', 'SessionStorage', '$translate', '$route', '$q', 'Poll', 'Page', - function ( $scope, $rootScope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll, Page) { + ['$scope', '$rootScope', '$controller', '$sce', '$timeout', '$routeParams', '$location', 'SessionStorage', '$translate', '$route', '$q', 'Poll', 'Page', 'DateFormat', + function ( $scope, $rootScope, $controller, $sce, $timeout, $routeParams, $location, SessionStorage, $translate, $route, $q, Poll, Page, DateFormat) { $scope.setTab = function (defaultValue) { if (angular.isDefined($routeParams.tab)) { return $routeParams.tab; @@ -69,15 +69,11 @@ angular.module('pollControllers', []) } var setDateFormat = function () { - $translate('dateFormat').then(function (dateFormat) { - $scope.globalVariables.dateFormat = dateFormat; - }); + $scope.globalVariables.dateFormat = DateFormat.getDateFormat(); + $scope.globalVariables.timeFormat = DateFormat.getTimeFormat(); + $scope.globalVariables.dateTimeFormat = DateFormat.getDateTimeFormat(); }; setDateFormat(); - $scope.$on('switchLocale', function() { - setDateFormat(); - }) - $scope.data = {}; $scope.data.poll = {}; @@ -1229,8 +1225,8 @@ angular.module('pollControllers', []) }]) -.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter', 'Page', - function ($scope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $filter, Page) { +.controller('PollResultCtrl', ['$scope', '$q', '$controller', '$route', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter', 'Page', + function ($scope, $q, $controller, $route, $routeParams, Poll, PollChoice, PollVote, $translate, $filter, Page) { $controller('PollCtrl', {$scope:$scope}); Page.setTitle('title.poll.result'); @@ -1244,6 +1240,10 @@ angular.module('pollControllers', []) $scope.tab = $scope.setTab('result'); $scope.plot = 'chart'; + $scope.$on('switchLocale', function() { + $route.reload(); + }) + var choicesDeferred = $q.defer(); PollChoice.query({pollId:$routeParams.pollId}, function (choices) { $scope.data.choices = choices; diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js index c9495f8..a1303ab 100644 --- a/pollen-ui-angular/src/main/webapp/js/services.js +++ b/pollen-ui-angular/src/main/webapp/js/services.js @@ -362,4 +362,38 @@ angular.module('pollenServices', ['ngResource']) localStorage.setItem(storageId, JSON.stringify(session)); } } +}]) + +////////////////////////////////////// +///// DATE AND TIME FORMAT ///// +////////////////////////////////////// +.factory('DateFormat', [function() { + return { + getDateFormat : function () { + if (angular.isDefined(conf.defaultDateFormat)) { + return conf.defaultDateFormat; + } + else { + return "shortDate"; + } + }, + + getTimeFormat : function () { + if (angular.isDefined(conf.defaultTimeFormat)) { + return conf.defaultTimeFormat; + } + else { + return "shortTime"; + } + }, + + getDateTimeFormat : function () { + if (angular.isDefined(conf.defaultDateTimeFormat)) { + return conf.defaultDateTimeFormat; + } + else { + return "short"; + } + } + } }]) \ No newline at end of file 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 841eb54..9aa9aba 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll-comment.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll-comment.html @@ -62,7 +62,7 @@ <tr ng-repeat="comment in data.comments"> <td> <span class="glyphicon glyphicon-user"></span>{{comment.authorName}}<br/> - <span class="glyphicon glyphicon-calendar"></span>{{comment.postDate | date:globalVariables.dateFormat}}<br/> + <span class="glyphicon glyphicon-calendar"></span>{{comment.postDate | date:globalVariables.dateTimeFormat}}<br/> <a class="fakeLink" ng-click="editPost(comment)" ng-if="comment.permission"><span class="glyphicon glyphicon-pencil" ng-show="comment.id"></span></a> <a class="fakeLink" ng-click="deletePost(comment)" ng-if="comment.permission"><span class="glyphicon glyphicon-trash danger" ng-show="comment.id"></span></a> </td> 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 a8a06f0..88a448e 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll-popupChoice.html @@ -59,6 +59,7 @@ <div class="col-sm-6"> <upload-file ng-model="choice.valueImage"></upload-file> + </div> </div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm