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 97c1cf9aa56dafb384f7bb153b31c82277f2a381 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Mon Aug 11 11:35:37 2014 +0200 remove unused parameter and add end statement --- pollen-ui-angular/src/main/webapp/js/app.js | 2 +- .../src/main/webapp/js/conf.js.exemple | 3 +- .../src/main/webapp/js/controllers/alertCtrl.js | 14 +- .../main/webapp/js/controllers/favoriteListCtrl.js | 22 +-- .../src/main/webapp/js/controllers/localeCtrl.js | 4 +- .../src/main/webapp/js/controllers/mainCtrl.js | 2 +- .../src/main/webapp/js/controllers/pollCtrl.js | 157 ++++++++++----------- .../src/main/webapp/js/controllers/userCtrl.js | 30 ++-- pollen-ui-angular/src/main/webapp/js/directives.js | 66 ++++----- pollen-ui-angular/src/main/webapp/js/services.js | 54 +++---- 10 files changed, 173 insertions(+), 181 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js index 6e9954c..9f64313 100644 --- a/pollen-ui-angular/src/main/webapp/js/app.js +++ b/pollen-ui-angular/src/main/webapp/js/app.js @@ -88,5 +88,5 @@ angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'Polle $translateProvider.preferredLanguage('en'); // $translateProvider.fallbackLanguage('en'); } -}]) +}]); 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 4135a7c..6d89a32 100644 --- a/pollen-ui-angular/src/main/webapp/js/conf.js.exemple +++ b/pollen-ui-angular/src/main/webapp/js/conf.js.exemple @@ -1,5 +1,6 @@ var conf = { // Rest-API Base Url + // This value is Mandatory restURL : "http://exemple.com/pollen-rest-api/v1", // Poll number per page @@ -44,4 +45,4 @@ var conf = { // Format DateTime // preference : short, medium defaultDateTimeFormat: "short", -} \ No newline at end of file +}; \ No newline at end of file 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 6f81b28..06bf08f 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/alertCtrl.js @@ -78,7 +78,7 @@ angular.module('alertControllers', []) poolAlert = $scope.data.persistentAlerts; } - angular.forEach(poolAlert, function (oneAlert, key) { + angular.forEach(poolAlert, function (oneAlert) { if (angular.equals(oneAlert.msg, alert.msg) && angular.equals(oneAlert.type, alert.type)) { $timeout.cancel(oneAlert.timeoutPromise); alert = oneAlert; @@ -91,14 +91,14 @@ angular.module('alertControllers', []) } if (angular.isDefined(timeout) && timeout >= 0) { - alert.timeout = timeout + alert.timeout = timeout; alert.timeoutPromise = $timeout(function () { $scope.hideAlert(alert) }, timeout); } else { alert.timeout = -1; } - } + }; $scope.hideAlert = function (alert) { var poolAlert; @@ -112,13 +112,13 @@ angular.module('alertControllers', []) if (index >= 0) { poolAlert.splice(index, 1); } - } + }; $scope.hoverAlert = function (alert) { if (alert.timeout >= 0) { $timeout.cancel(alert.timeoutPromise); } - } + }; $scope.leaveAlert = function (alert) { if (alert.timeout >= 0) { @@ -126,9 +126,9 @@ angular.module('alertControllers', []) $scope.hideAlert(alert); }, alert.timeout); } - } + }; $scope.toHTML = function (msg) { return $sce.trustAsHtml($filter('translate')(msg)); } -}]) \ No newline at end of file +}]); \ No newline at end of file diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js index 1477c4b..a0fe4b7 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/favoriteListCtrl.js @@ -82,7 +82,7 @@ angular.module('favoriteListControllers', []) var getEmptyFavoriteList = function () { return {name:'', members: []}; - } + }; var initFavoriteList = function () { if ($routeParams.favoriteListId) { @@ -107,7 +107,7 @@ angular.module('favoriteListControllers', []) }); return deferred.promise; - } + }; $scope.addMember = function () { if (angular.isDefined($scope.data.favoriteListMemberPagination) && $scope.data.favoriteListMemberPagination.currentPage < $scope.data.favoriteListMemberPagination.lastPage) { @@ -121,7 +121,7 @@ angular.module('favoriteListControllers', []) $scope.saveFavoriteList = function () { var FavoriteListPromise; if (angular.isDefined($scope.data.favoriteList.id)) { // edit - FavoriteListPromise = FavoriteList.update({id:$scope.data.favoriteList.id, name:$scope.data.favoriteList.name}, function (data) { + FavoriteListPromise = FavoriteList.update({id:$scope.data.favoriteList.id, name:$scope.data.favoriteList.name}, function () { delete $scope.data.favoriteList.restError; }, function (error) { $scope.data.favoriteList.restError = error.data; @@ -130,9 +130,9 @@ angular.module('favoriteListControllers', []) FavoriteListPromise = FavoriteList.add({name:$scope.data.favoriteList.name}, function (data) { $scope.data.favoriteList.id = data.id; delete $scope.data.favoriteList.restError; - angular.forEach($scope.data.favoriteList.members, function (member, key) { + angular.forEach($scope.data.favoriteList.members, function (member) { $scope.saveMember(member); - }) + }); $location.url('/favoriteList/'+data.id); }, function (error) { $scope.data.favoriteList.restError = error.data; @@ -168,7 +168,7 @@ angular.module('favoriteListControllers', []) } } } - } + }; $scope.deleteFavoriteList = function () { if (angular.isDefined($scope.data.favoriteList.id)) { @@ -178,7 +178,7 @@ angular.module('favoriteListControllers', []) }).then( function () { var confirmDelete = confirm(confirmMessage); if (confirmDelete == true) { - FavoriteList.remove({favoriteListId:$scope.data.favoriteList.id}, function (data) { + FavoriteList.remove({favoriteListId:$scope.data.favoriteList.id}, function () { $location.url('/favoriteList'); }); } @@ -197,7 +197,7 @@ angular.module('favoriteListControllers', []) }).then( function () { var confirmDelete = confirm(confirmMessage); if (confirmDelete == true) { - FavoriteListMember.remove({favoriteListId:$scope.data.favoriteList.id, memberId:member.id}, function (data) { + FavoriteListMember.remove({favoriteListId:$scope.data.favoriteList.id, memberId:member.id}, function () { var index = $scope.data.favoriteList.members.indexOf(member); $scope.data.favoriteList.members.splice(index, 1); }); @@ -213,13 +213,13 @@ angular.module('favoriteListControllers', []) $scope.newFavoriteList = function () { $scope.data.favoriteList = getEmptyFavoriteList(); $location.url('/favoriteList/new'); - } + }; var lastRoute = $route.current; - $scope.$on('$locationChangeSuccess', function(event) { + $scope.$on('$locationChangeSuccess', function() { if (lastRoute.$$route.controller == $route.current.$$route.controller) { $route.current = lastRoute; } }); -}]) +}]); diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js index b8d1f35..a6ba707 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/localeCtrl.js @@ -38,7 +38,7 @@ angular.module('localeControllers', []) angular.copy(i18n_EN, $locale); moment.locale("en"); } - } + }; if (angular.isUndefined($scope.locale)) { // set locale with browser preference @@ -68,4 +68,4 @@ angular.module('localeControllers', []) } } -}]) +}]); diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js index aacd075..c945de4 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/mainCtrl.js @@ -31,5 +31,5 @@ angular.module('PollenMainControllers', ['pollenServices']) $scope.$on('titleChange', function () { $scope.title = Page.title(); }) -}]) +}]); 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 bc82cc7..29d2336 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -92,9 +92,9 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } $scope.toggleMinify = function () { - $scope.globalVariables.minify = ! $scope.globalVariables.minify + $scope.globalVariables.minify = ! $scope.globalVariables.minify; SessionStorage.save({'menuMinify': $scope.globalVariables.minify}); - } + }; var setDateFormat = function () { $scope.globalVariables.dateFormat = DateFormat.getDateFormat(); @@ -114,7 +114,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.pollDeferred.resolve(); }) }); - } + }; if (angular.isDefined($routeParams.pollId)) { var pollDeferred = $scope.pollDeferred; @@ -140,7 +140,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr pollDeferred.promise.then(function () { setVoteCountingType(); - }) + }); pollDeferred.promise.then(function () { var baseUrl = $scope.globalVariables.baseUrl; @@ -170,17 +170,17 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.toHTML = function (data) { return $sce.trustAsHtml(data); - } + }; $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)) { @@ -198,7 +198,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr var lastRoute = $route.current; $timeout(function() { - $scope.$on('$locationChangeSuccess', function(event) { + $scope.$on('$locationChangeSuccess', function() { if (lastRoute.$$route.controller == $route.current.$$route.controller) { $scope.tab = $scope.setTab(); $route.current = lastRoute; @@ -212,7 +212,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr return $scope.data.voteCountingType.renderType == 'checkbox'; } return false; - } + }; $scope.getVoteValue = function (voteValue) { if ($scope.voteCountingIsBoolean()) { @@ -229,7 +229,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr return voteValue; } } - } + }; $scope.preSendChoice = function (choice) { if (choice.choiceType == 'DATE') { @@ -249,7 +249,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } return choice; - } + }; $scope.postReceiveChoice = function (choice) { if (choice.choiceType == 'DATE') { @@ -264,7 +264,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } return choice; - } + }; $timeout(function () { $scope.$watch('data.poll.voteCountingType', function (newVal, oldVal) { @@ -273,17 +273,17 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } }); - $scope.$watch('data.voteCountingType.renderType', function (newVal, oldVal) { + $scope.$watch('data.voteCountingType.renderType', function (newVal) { if (newVal !== undefined) { - angular.forEach($scope.data.votants, function(votant, key) { + angular.forEach($scope.data.votants, function(votant) { angular.forEach(votant.choice, function (choice) { choice.voteValue = $scope.getVoteValue(choice.voteValue); }); }); } - }) + }); - $scope.$watch('data.poll.title', function (newVal) { + $scope.$watch('data.poll.title', function () { Page.setValue($scope.data.poll.title); }); }); @@ -362,8 +362,8 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr poll.beginChoiceDate = poll.beginDate; } - if (angular.isUndefined(poll.endChoiceDate)) { - poll.endChoiceDate = poll.endChoiceDate; + if (angular.isUndefined(poll.endChoiceDate) && angular.isUndefined(poll.endDate)) { + poll.endChoiceDate = poll.endDate; } $scope.timeToBeginAddChoice = moment(poll.beginChoiceDate).fromNow(); @@ -374,7 +374,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.timeToAddChoice.type = getType($scope.timeToAddChoice.value); $scope.now = now; - } + }; var getType = function (value) { var type; @@ -388,7 +388,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr type = 'danger'; } return type; - } + }; $interval(setPollInfo, 5000); @@ -421,7 +421,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr choiceValue : '', choiceIsDeletable: true }; - } + }; $scope.addChoice = function () { var index = $scope.data.choices.push(initChoice()); @@ -430,7 +430,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr delete $scope.restError.choice; } popupChoice(choice, 'Ajout d\'un Choix'); - } + }; $scope.editChoice = function (choice, e) { popupChoice(choice, 'Edition du Choix'); @@ -438,7 +438,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr e.stopPropagation(); e.preventDefault(); } - } + }; $scope.saveAddChoice = function (choice) { @@ -465,7 +465,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr choice.restError = error.data; }); } - } + }; $scope.saveEditChoice = function (choice) { if (angular.isDefined($routeParams.pollId)) { @@ -480,7 +480,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr choice.restError = error.data; }); } - } + }; $scope.deleteChoice = function (choice) { if (angular.isDefined($routeParams.pollId) && angular.isDefined(choice.id)) { @@ -508,7 +508,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr if (index > -1) { $scope.data.choices.splice(index,1); } - } + }; $scope.saveChoice = function (choice) { if (angular.isDefined(choice)) { @@ -519,7 +519,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.saveAddChoice(choice); } } - } + }; var popupChoice = function (choiceEdit, title) { var choice = angular.copy(choiceEdit); @@ -537,7 +537,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.saveChoice(choiceEdit); } - } + }; var modalInstance = $modal.open({ templateUrl : 'partials/poll-popupChoice.html', @@ -566,7 +566,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } }); - modalInstance.result.then(function (returnChoice) { + modalInstance.result.then(function () { $scope.deleteChoice(choiceEdit); }, function () { $scope.globalVariables.lastType = choice.choiceType; @@ -616,7 +616,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } } }); - } + }; var PollPopChoiceCtrl = function ($scope, $modalInstance, title, choice, dateFormat) { @@ -629,14 +629,14 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.saveChoice = function () { $modalInstance.dismiss(); - } + }; $scope.cancelChoice = function () { if (angular.isDefined(oldChoice)) { angular.copy(oldChoice, $scope.choice); } $modalInstance.dismiss(); - } + }; $scope.deleteChoice = function (ch) { $modalInstance.close(ch); @@ -669,7 +669,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr var newMember = function () { return {name:'', email:'', weight:1.0}; - } + }; var newGroup = function () { var members = []; @@ -677,7 +677,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr members.push(newMember()); } return {group:{name:'', weight:1.0}, members:members} - } + }; $scope.data.voterList = []; $scope.data.voterList.push(newGroup()); @@ -708,11 +708,11 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.addVoter = function (index) { $scope.data.voterList[index].members.push(newMember()); - } + }; $scope.addGroup = function () { $scope.data.voterList.push(newGroup()); - } + }; //////////////////////////////// //// VOTE COUNTING TYPE ///// @@ -740,7 +740,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }); $timeout(function () { - $scope.$watch('data.poll.voteCountingType', function (newVal) { + $scope.$watch('data.poll.voteCountingType', function () { setHelper(); }) }); @@ -764,14 +764,14 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr var initPoll = function () { Poll.skeletonNew(function (poll) { $scope.data.poll = poll; - }, function (error) { + }, function () { $scope.data.poll = {}; }); $scope.data.choices = []; $scope.data.vote = {}; $scope.data.vote.choices = $scope.data.choices; - } + }; initPoll(); $scope.savePoll = function () { @@ -806,7 +806,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr , -1); $rootScope.$broadcast('newSuccess', 'poll.saved'); if ($scope.data.poll.pollType != 'FREE') { - SessionStorage.save({'voterList':$scope.data.voterList}) + SessionStorage.save({'voterList':$scope.data.voterList}); $location.url('/poll/edit/'+data.id+'/'+data.permission); } else { @@ -828,7 +828,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $rootScope.$broadcast('newError', error.data.choice[0]); } }); - } + }; $scope.deletePoll = function () { $scope.data.poll = initPoll(); @@ -886,7 +886,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr catch (e) { } return isEmpty; - } + }; var initFavoriteList = function () { if (angular.isDefined(SessionStorage.get().user)) { @@ -922,7 +922,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.saveVoterList = function (voterList) { if (angular.isDefined(voterList.group.id)) { - PollVoterList.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId:voterList.group.id}, voterList.group, function (data) { + PollVoterList.update({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId:voterList.group.id}, voterList.group, function () { $rootScope.$broadcast('newSuccess', 'poll.saved'); delete voterList.group.restError; }, function (error) { @@ -950,7 +950,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr // Get member Id PollVoterListMember.query({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId: data.id}, function (voterListMember) { - angular.forEach(voterListMember, function(member, key) { + angular.forEach(voterListMember, function(member) { for (var i = 0; i < voterList.members.length; i++) { if (member.email == voterList.members[i].email) { voterList.members[i] = member; @@ -1017,7 +1017,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } } } - } + }; $scope.deleteVoterList = function (voterList) { if (angular.isDefined(voterList) && angular.isDefined(voterList.group.id)) { @@ -1054,7 +1054,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }).then( function () { var confirmDelete = confirm(confirmMessage); if (confirmDelete == true) { - member.$remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId:voterList.group.id}, function (data) { + member.$remove({pollId:$routeParams.pollId, permission:$scope.globalVariables.pollToken, voterListId:voterList.group.id}, function () { var index = voterList.members.indexOf(member); voterList.members.splice(index, 1); }); @@ -1078,7 +1078,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.data.choices = choices; angular.forEach(choices, function (ch) { ch = $scope.postReceiveChoice(ch); - }) + }); $scope.data.vote = {}; $scope.data.vote.choice = angular.copy($scope.data.choices); }); @@ -1090,7 +1090,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } else { $location.path('/'); } - }, function (error) { + }, function () { $location.path('/'); }); @@ -1123,7 +1123,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr savePoll.endChoiceDate = savePoll.endChoiceDate.getTime(); } - Poll.update({permission:$scope.globalVariables.pollToken}, savePoll, function (data) { + Poll.update({permission:$scope.globalVariables.pollToken}, savePoll, function () { $rootScope.$broadcast('newSuccess', 'poll.saved'); }, function (error) { angular.extend($scope.restError, error.data); @@ -1177,7 +1177,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr initVote(); $scope.pollDeferred.resolve(); }); - } + }; $scope.pollDeferred.promise.then(initPoll); var initAuthor = function () { @@ -1206,10 +1206,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.data.vote.choice.push({'choiceId':$scope.data.choices[i].id, 'voteValue': defaultValue}); } - }, function (error) { + }, function () { $scope.data.poll.canVote = false; }); - } + }; $scope.voter = function () { var sendVote = angular.copy($scope.data.vote); @@ -1232,9 +1232,9 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr PollVote.get({pollId:$routeParams.pollId, voteId:returnRequest.id, permission:returnRequest.permission}, function (newVote) { angular.forEach(newVote.choice, function (choice) { choice.voteValue = $scope.getVoteValue(choice.voteValue); - }) + }); $scope.data.votants.push(newVote); - }) + }); var redirect = '/poll/vote/' + $routeParams.pollId; if (angular.isDefined($scope.globalVariables.pollToken)) { @@ -1262,7 +1262,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $rootScope.$broadcast('newError', error.data["vote.totalVoteValue"][0]); } - angular.forEach($scope.data.vote.choice, function (choice, key) { + angular.forEach($scope.data.vote.choice, function (choice) { if (angular.isDefined(error.data["vote.voteValue["+choice.choiceId+"]"])) { choice.restError = error.data["vote.voteValue["+choice.choiceId+"]"]; } @@ -1271,9 +1271,9 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } }); }); - } + }; - var oldVote + var oldVote; $scope.editVote = function (vote) { if (angular.isDefined(oldVote)) { @@ -1286,7 +1286,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr oldVote = angular.copy(vote); vote.onEdit = true; - } + }; $scope.cancelVote = function (vote) { if (angular.isDefined(oldVote) && vote.id == oldVote.id) { @@ -1296,7 +1296,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr vote.choice[i].voteValue = oldVote.choice[i].voteValue; } } - } + }; $scope.saveVote = function (vote) { var sendVote = angular.copy(vote); @@ -1332,7 +1332,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }, function (error) { $scope.data.vote.restError = { voterName : error.data["voter.name"]}; }) - } + }; $scope.toggleVoteValue = function (choice, onEdit, event) { if (onEdit) { @@ -1348,7 +1348,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } } } - } + }; $scope.deleteVote = function (vote) { var confirmMessage; @@ -1363,13 +1363,12 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } var index = $scope.data.votants.indexOf(vote); - PollVote.remove({pollId:$routeParams.pollId}, vote, function (data) { + PollVote.remove({pollId:$routeParams.pollId}, vote, function () { $scope.data.votants.splice(index, 1); }) } }); - - } + }; $scope.toggleValue = function (choice, event) { if ($scope.voteCountingIsBoolean()) { @@ -1435,7 +1434,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr paginationParameter.pageNumber = $scope.data.commentsPagination.lastPage - $scope.data.commentsPagination.currentPage; } initComments(); - } + }; var paginationParameter = {pageSize: $scope.pageSize, order: 'postDate', desc: $scope.desc}; if (angular.isDefined($routeParams.page)) { @@ -1448,12 +1447,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr } var initComments = function () { - var commentPromise = PollComment.get({pollId:$routeParams.pollId, permission:$scope.commentToken, paginationParameter:paginationParameter}, function (data) { + return PollComment.get({pollId: $routeParams.pollId, permission: $scope.commentToken, paginationParameter: paginationParameter}, function (data) { $scope.data.comments = data.elements; $scope.data.commentsPagination = data.pagination; }).$promise; - - return commentPromise; }; initComments(); $timeout(function () { @@ -1469,10 +1466,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.postComment = function () { delete $scope.restError; - var commentPromise + var commentPromise; if (angular.isDefined($scope.comment.id)) { // edit - commentPromise = PollComment.update({pollId:$routeParams.pollId}, $scope.comment, function (data) { + commentPromise = PollComment.update({pollId:$routeParams.pollId}, $scope.comment, function () { paginationParameter.pageNumber = $scope.comment.page; initComments(); initAuthor(); @@ -1530,7 +1527,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.editPost = function (comment) { $scope.comment = angular.copy(comment); $scope.comment.page = paginationParameter.pageNumber; - } + }; $scope.deletePost = function (comment) { var confirmMessage; @@ -1548,7 +1545,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr delete $scope.comment.permission; } - PollComment.remove({pollId:$routeParams.pollId, commentId:comment.id}, function (data) { + PollComment.remove({pollId:$routeParams.pollId, commentId:comment.id}, function () { // reload comments initComments().then(function () { // if no comment then change page if it's possible @@ -1579,7 +1576,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.translateTitle = { '0' : "{{ 'poll.result.title.zero' | translate }}", 'one' : "{{ 'poll.result.title.one' | translate }}", - 'other' : "{{ 'poll.result.title.other' | translate:{nbVoter:data.result.nbVotant} }}", + 'other' : "{{ 'poll.result.title.other' | translate:{nbVoter:data.result.nbVotant} }}" }; $scope.plot = 'chart'; @@ -1642,7 +1639,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr i = $scope.data.choices.length; } } - }) + }); resultDeferred.resolve('result load'); votesDeferred.promise.then(function () { @@ -1666,7 +1663,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.toHTML = function (data) { return $sce.trustAsHtml(data); - } + }; $scope.toggleSelect = function (poll, event) { if (angular.isUndefined(poll.selected)) { @@ -1679,7 +1676,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr if (angular.isDefined(event)) { event.stopPropagation(); } - } + }; $scope.selectAll = function () { angular.forEach($scope.data.polls, function (poll) { @@ -1711,7 +1708,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }); } }) - } + }; Page.setTitle('title.poll.list'); @@ -1734,7 +1731,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr var initPolls = function () { Poll.get({paginationParameter:paginationParameter, cmd:$routeParams.cmd}, function (data) { - $scope.data.polls = data.elements + $scope.data.polls = data.elements; $scope.data.pollsPagination = data.pagination; // check if has elements @@ -1769,6 +1766,4 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr }); }) -}]) - -; \ No newline at end of file +}]); \ No newline at end of file diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js index 9e8984b..a0b8dd4 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js @@ -37,7 +37,7 @@ angular.module('userControllers', []) $scope.submit = function () { if ($scope.data.user.password == $scope.data.user.password2) { - User.add({}, $scope.data.user, function (data) { + User.add({}, $scope.data.user, function () { $rootScope.$broadcast('newSuccess', 'user.register.success'); $scope.data.user = {email:'', password:'', password2:''}; }, function (error) { @@ -59,10 +59,10 @@ angular.module('userControllers', []) $scope.email = ''; $scope.submit = function () { if ($scope.email != '') { - UserLostPassword.send({login:$scope.email}, function (data) { + UserLostPassword.send({login:$scope.email}, function () { $rootScope.$broadcast('newSuccess', 'user.forgotPassword.success'); $scope.email = ''; - }, function (error) { + }, function () { $translate('user.error.mail.notFound').then(function (error) { $scope.restError = {email: [error]}; }) @@ -105,17 +105,17 @@ angular.module('userControllers', []) }, function (error) { $scope.restError = error.data; }); - } + }; $scope.editPassword = function () { if ($scope.data.user.newPassword == $scope.data.user.newPassword2) { - User.editPassword($scope.data.user, function (data) { + User.editPassword($scope.data.user, function () { $rootScope.$broadcast('newSuccess', 'user.edit.success'); }, function (error) { $scope.restError = error.data; }); } - } + }; $scope.disableUser = function () { var confirmMessage; @@ -124,7 +124,7 @@ angular.module('userControllers', []) }).then( function () { var confirmDelete = confirm(confirmMessage); if (confirmDelete == true) { - User.ban({userId: $scope.data.user.id, anonymize:true}, function (data) { + User.ban({userId: $scope.data.user.id, anonymize:true}, function () { $rootScope.$broadcast('newSuccess', 'user.disableMe.success'); $rootScope.$broadcast('sessionExpired'); }) @@ -170,20 +170,20 @@ angular.module('userControllers', []) }); $scope.saveUser = function (user) { - User.admin(user, function(data) { + User.admin(user, function() { $rootScope.$broadcast('newSuccess', 'user.edit.success'); }); }; $scope.generatePassword = function (user) { - UserLostPassword.send({login: user.email}, function (data) { + UserLostPassword.send({login: user.email}, function () { $rootScope.$broadcast('newSuccess', 'user.generatePassword.success'); user.isDisabled = false; }); - } + }; $scope.deleteUser = function (user) { - User.remove({userId:user.id, anonymize:true}, function (data) { + User.remove({userId:user.id, anonymize:true}, function () { $rootScope.$broadcast('newSuccess', 'user.delete.success'); var userIndex = $scope.data.users.indexOf(user); if (userIndex >= 0) { @@ -193,7 +193,7 @@ angular.module('userControllers', []) }; $scope.banUser = function (user) { - User.ban({userId : user.id, anonymize:true}, function (data) { + User.ban({userId : user.id, anonymize:true}, function () { user.isDisabled = true; $rootScope.$broadcast('newSuccess', 'user.disableUser.success'); }); @@ -226,12 +226,12 @@ angular.module('userControllers', []) // reload page for right user $route.reload(); }) - }, function (error) { + }, function () { $translate('user.error.login').then(function (error) { $scope.restError = {connexion: error}; }) }); - } + }; $scope.logout = function () { UserLogout.logout(); @@ -244,4 +244,4 @@ angular.module('userControllers', []) //got to the home $route.reload(); } -}]) \ No newline at end of file +}]); \ No newline at end of file diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js index dd40593..8d32590 100644 --- a/pollen-ui-angular/src/main/webapp/js/directives.js +++ b/pollen-ui-angular/src/main/webapp/js/directives.js @@ -81,7 +81,7 @@ angular.module('pollenDirective', []) ck.setData(ngModel.$modelValue); }); - ngModel.$render = function(value) { + ngModel.$render = function() { ck.setData(ngModel.$modelValue); }; @@ -134,7 +134,7 @@ angular.module('pollenDirective', []) forData: '=data' }, template: '<span class="glyphicon glyphicon-exclamation-sign danger" tooltip="{{error}}" ng-if="error"></span>', - link: function (scope, element, attrs) { + link: function (scope) { scope.$watch('forData', function (newVal, oldVal) { if (newVal != oldVal) { delete scope.error; @@ -164,7 +164,7 @@ angular.module('pollenDirective', []) delete scope.error; } }); - scope.$watch('error', function (newVal, oldVal) { + scope.$watch('error', function (newVal) { attrs.tooltip = newVal; if (angular.isDefined(newVal)) { $(element[0]).addClass('has-error'); @@ -186,7 +186,7 @@ angular.module('pollenDirective', []) .directive('selectOnClick', [function () { return { restrict: 'A', - link: function (scope, element, attrs) { + link: function (scope, element) { element.on('click', function () { this.select(); }); @@ -204,15 +204,11 @@ angular.module('pollenDirective', []) link : function (scope, element, attrs) { scope.oldVal = {}; scope.change = false; - scope.timeout; + scope.timeout = null; $timeout(function () { scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel); - scope.$watch(attrs.ngModel, function (newVal, oldVal) { - if (scope.$eval(attrs.ngModel) != scope.oldVal[attrs.ngModel]) { - scope.change = true; - } else { - scope.change = false; - } + scope.$watch(attrs.ngModel, function () { + scope.change = scope.$eval(attrs.ngModel) != scope.oldVal[attrs.ngModel]; }, true); }); @@ -220,7 +216,7 @@ angular.module('pollenDirective', []) if (scope.change && !scope.lock) { scope.$apply(function () { scope.change = false; - scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel);; + scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel); scope.$eval(attrs.autoSave); }); } @@ -233,7 +229,7 @@ angular.module('pollenDirective', []) scope.timeout = $timeout(save,1000); }); - element.bind('dp.change', function(newDate) { + element.bind('dp.change', function() { try { scope.$digest(); } @@ -244,7 +240,7 @@ angular.module('pollenDirective', []) element.bind('dp.show', function() { scope.lock = true; - }) + }); element.bind('dp.hide', function () { scope.lock = false; @@ -253,7 +249,7 @@ angular.module('pollenDirective', []) } scope.timeout = $timeout(save, 100); - }) + }); element.bind('blur', function () { if (scope.timeout) { @@ -278,8 +274,8 @@ angular.module('pollenDirective', []) pageSize: '=' }, templateUrl: 'partials/pagination.html', - link: function (scope, element, attrs) { - var setNavPage = function (pageNumber) { + link: function (scope) { + var setNavPage = function () { if (scope.currentPage > 0) { scope.previousPage = scope.currentPage - 1; } else { @@ -291,7 +287,7 @@ angular.module('pollenDirective', []) } else { scope.nextPage = scope.lastPage; } - } + }; //set pageList scope.pageList = []; @@ -324,7 +320,7 @@ angular.module('pollenDirective', []) data:'=' }, template:'<div class="jqplot-target"></div>', - link: function(scope, element, attrs) { + link: function(scope, element) { var initChart = function () { if (angular.isDefined(scope.data)) { @@ -344,15 +340,15 @@ angular.module('pollenDirective', []) tickOptions: { showGridline: false, show:true, - showLabel: true, + showLabel: true } }, axes: { xaxis: { - renderer: $.jqplot.CategoryAxisRenderer, + renderer: $.jqplot.CategoryAxisRenderer }, yaxis: { - label:'Vote', + label:'Vote' } } }); @@ -384,10 +380,10 @@ angular.module('pollenDirective', []) return { restrict : 'E', scope : { - data:'=', + data:'=' }, template:'<div class="jqplot-target"></div>', - link: function(scope, element, attrs) { + link: function(scope, element) { var initChart = function () { if (angular.isDefined(scope.data)) { $.jqplot.config.enablePlugins = true; @@ -436,10 +432,10 @@ angular.module('pollenDirective', []) ngModel: "=" }, template:'<form><input type="file" name="resource" /></form>', - link: function (scope, element, attrs) { + link: function (scope, element) { element.bind("change", function (changeEvent) { var reader = new FileReader(); - reader.onload = function (loadEvent) { + reader.onload = function () { var formData = new FormData(element[0].firstChild); scope.$apply(function () { scope.ngModel = { meta: changeEvent.target.files[0] }; @@ -452,7 +448,7 @@ angular.module('pollenDirective', []) scope.ngModel.id = response.id; scope.ngModel.data = conf.restURL+'/resources/'+response.id; }); - } + }; reader.readAsDataURL( changeEvent.target.files[0] ); }); @@ -473,7 +469,7 @@ angular.module('pollenDirective', []) }, transclude : true, templateUrl : "partials/printResource.html", - link : function (scope, element, attrs) { + link : function (scope, element) { scope.showImage = false; $timeout(function () { @@ -501,7 +497,7 @@ angular.module('pollenDirective', []) }); }; - element.bind("click", function (event) { + element.bind("click", function () { toggleZoom(); }); } @@ -523,7 +519,7 @@ angular.module('pollenDirective', []) forId: '@' }, templateUrl:"partials/dateTimePicker.html", - link: function(scope, element, attrs) { + link: function(scope, element) { scope.dateTimePicker = $(element).find(".datetimepicker"); scope.dateTimePicker.datetimepicker({ language: SessionStorage.get().locale, @@ -548,7 +544,7 @@ angular.module('pollenDirective', []) language: SessionStorage.get().locale }); setDate(); - }) + }); var setMaxDate = function () { if (angular.isDefined(scope.maxDate)) { @@ -576,7 +572,7 @@ angular.module('pollenDirective', []) }); }); - scope.dateTimePicker.on("change", function(e) { + scope.dateTimePicker.on("change", function() { var newDate = scope.dateTimePicker.data("DateTimePicker").getDate(); if (newDate != null) { scope.ngModel = new Date(scope.dateTimePicker.data("DateTimePicker").getDate().format()).getTime(); @@ -590,7 +586,7 @@ angular.module('pollenDirective', []) var id = scope.dateTimePicker.data("DateTimePicker").id; var allDp = $('.datetimepicker'); for (var i = 0; i < allDp.length; i++) { - var dp = $(allDp[i]).data("DateTimePicker") + var dp = $(allDp[i]).data("DateTimePicker"); if (dp.id == id) { continue; } @@ -600,7 +596,7 @@ angular.module('pollenDirective', []) scope.exit = function() { element.trigger("blur"); - } + }; scope.remove = function () { scope.ngModel = null; @@ -609,4 +605,4 @@ angular.module('pollenDirective', []) } }; -}]) \ No newline at end of file +}]); \ No newline at end of file diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js index 6be865b..f7ab222 100644 --- a/pollen-ui-angular/src/main/webapp/js/services.js +++ b/pollen-ui-angular/src/main/webapp/js/services.js @@ -38,7 +38,7 @@ angular.module('pollenServices', ['ngResource']) }, 'add' : { method : 'POST', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { var poll = angular.copy(data); delete poll.choice; var choices = angular.copy(data.choice); @@ -47,7 +47,7 @@ angular.module('pollenServices', ['ngResource']) }, 'update' : { method : 'POST', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { return 'poll='+encodeURIComponent(JSON.stringify(data)); } }, @@ -80,14 +80,14 @@ angular.module('pollenServices', ['ngResource']) { 'add' : { method:'POST', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { return transformParam(data); } }, 'update' : { method:'POST', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { return transformParam(data); } } @@ -108,14 +108,14 @@ angular.module('pollenServices', ['ngResource']) }, 'add' : { method:'POST', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { return transformParam(data); } }, 'update' : { method:'POST', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { return transformParam(data); } } @@ -132,14 +132,14 @@ angular.module('pollenServices', ['ngResource']) { 'add' : { method:'POST', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { return transformParam(data); } }, 'update' : { method:'POST', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { return transformParam(data); } } @@ -153,13 +153,13 @@ angular.module('pollenServices', ['ngResource']) { 'add' : { method : 'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return 'voterList='+encodeURIComponent(JSON.stringify(data.group))+'&members='+encodeURIComponent(JSON.stringify(data.members)); } }, 'update' : { method : 'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return 'voterList='+encodeURIComponent(JSON.stringify(data)); } }, @@ -183,13 +183,13 @@ angular.module('pollenServices', ['ngResource']) { 'add' : { method : 'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return transformParam(data); } }, 'update' : { method : 'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return transformParam(data); } } @@ -205,33 +205,33 @@ angular.module('pollenServices', ['ngResource']) var transformParam = function (data) { var generatePassword = (data.password == ''); return 'user='+encodeURIComponent(JSON.stringify(data))+'&generatePassword='+generatePassword; - } + }; return $resource(conf.restURL+'/users/:userId', {userId : '@id'}, { 'add' : { method : 'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return transformParam(data); } }, 'admin': { method : 'POST', url: conf.restURL+'/users/:userId/admin', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return transformParam(data); } }, 'update' : { method:'POST', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { return transformParam(data); } }, 'editPassword' : { method:'POST', url: conf.restURL+'/users/:userId/password', - transformRequest : function (data, headersGetter) { + transformRequest : function (data) { return 'oldPassword='+encodeURIComponent(data.password)+ '&newPassword='+encodeURIComponent(data.newPassword); } @@ -255,12 +255,12 @@ angular.module('pollenServices', ['ngResource']) query += "false"; } return query; - } + }; return $resource(conf.restURL+'/login', {}, { 'login' : { method: 'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return transformParam(data); } } @@ -294,19 +294,19 @@ angular.module('pollenServices', ['ngResource']) .factory('FavoriteList', ['$resource', function ($resource) { var transformParam = function (data) { return 'favoriteList='+encodeURIComponent(JSON.stringify(data)); - } + }; return $resource(conf.restURL+'/favoriteLists/:favoriteListId', {favoriteListId:'@id'}, { 'add' : { method:'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return transformParam(data); } }, 'update' : { method:'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return transformParam(data); } } @@ -316,19 +316,19 @@ angular.module('pollenServices', ['ngResource']) .factory('FavoriteListMember', ['$resource', function ($resource) { var transformParam = function (data) { return 'member='+encodeURIComponent(JSON.stringify(data)); - } + }; return $resource(conf.restURL+'/favoriteLists/:favoriteListId/members/:memberId', {memberId:'@id'}, { 'add' : { method:'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return transformParam(data); } }, 'update' : { method:'POST', - transformRequest: function (data, headersGetter) { + transformRequest: function (data) { return transformParam(data); } } @@ -370,7 +370,7 @@ angular.module('pollenServices', ['ngResource']) save: function (data) { angular.forEach(data, function (value,key) { session[key] = value; - }) + }); localStorage.setItem(storageId, JSON.stringify(session)); }, append: function (data) { @@ -469,4 +469,4 @@ angular.module('pollenServices', ['ngResource']) $rootScope.$broadcast('titleChange'); } }; -}]) \ No newline at end of file +}]); \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.