This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit f6cffe19cbfb692db35d75b35c66100d6f3ade2b Author: Yannick Martel <martel@©odelutin.com> Date: Mon Jan 18 11:45:03 2016 +0100 fixes #7906 add loading on projects --- .../src/main/webapp/js/coselmar-controllers.js | 40 +++++++++++++++++----- .../main/webapp/js/coselmar-questions-services.js | 12 +++---- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index a14cbdd..76b6688 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -964,6 +964,7 @@ coselmarControllers.directive('identicalCheck', [function () { // Controller for All Question View coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routeParams', '$location', 'questionsService', 'notify', 'errorService', function($scope, $route, $routeParams, $location, questionsService, notify, errorService){ + $scope.$emit('dataLoading'); $scope.searchOptions = { 'privacy' : '', 'status' : '', 'fullTextSearch' : []}; @@ -978,12 +979,17 @@ coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routePara // success : just get the questions $scope.questions = questions; - }, errorService.defaultFailOnCall); + }, errorService.defaultFailOnCall, function() { + $scope.$emit('dataLoaded'); + }); $scope.searchQuestions = function() { + $scope.$emit('dataLoading'); questionsService.getQuestions($scope.searchOptions, function(questions) { $scope.questions = questions; - }, errorService.defaultFailOnCall); + }, errorService.defaultFailOnCall, function() { + $scope.$emit('dataLoaded'); + }); }; @@ -998,6 +1004,7 @@ coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routePara }; $scope.advancedSearchQuestions = function() { + $scope.$emit('dataLoading'); //Convert Dates to timestamp if (angular.isDate($scope.searchOptions.submissionAfterDate)) { @@ -1018,7 +1025,9 @@ coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routePara questionsService.getQuestions($scope.searchOptions, function(questions){ $scope.questions = questions; - }, errorService.defaultFailOnCall); + }, errorService.defaultFailOnCall, function() { + $scope.$emit('dataLoaded'); + }); }; @@ -1177,6 +1186,7 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam }; if ($routeParams.questionId) { + $scope.$emit('dataLoading'); questionsService.getQuestion($routeParams.questionId, function(question) { // success : just get the questions @@ -1219,7 +1229,9 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam $scope.question.links = []; } - }, errorService.defaultFailOnCall); + }, errorService.defaultFailOnCall, function() { + $scope.$emit('dataLoaded'); + }); }; //Deletion @@ -1246,6 +1258,7 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam if (!$scope.question.themes || $scope.question.themes.length == 0) { $scope.themesError = true; } else { + $scope.$emit('dataLoading'); // Call service to create a new question questionsService.saveQuestion($scope.question, function() { // Notification @@ -1260,7 +1273,9 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam } else { $location.path("/questions"); } - }, errorService.defaultFailOnCall); + }, errorService.defaultFailOnCall, function() { + $scope.$emit('dataLoaded'); + }); } }; @@ -1272,6 +1287,7 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam $scope.question.deadline = $scope.question.deadline.getTime(); } + $scope.$emit('dataLoading'); questionsService.saveQuestion($scope.question, function() { // Notification notify({ @@ -1281,7 +1297,9 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam templateUrl: "views/notificationTemplate.html" }); $route.reload(); - },errorService.defaultFailOnCall); + },errorService.defaultFailOnCall, function() { + $scope.$emit('dataLoaded'); + }); }; $scope.openCloseQuestionSession = function(){ @@ -1300,6 +1318,7 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam $scope.question.deadline = $scope.question.deadline.getTime(); } + $scope.$emit('dataLoading'); questionsService.saveQuestion($scope.question, function() { // Notification notify({ @@ -1309,7 +1328,9 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam templateUrl: "views/notificationTemplate.html" }); $route.reload(); - },errorService.defaultFailOnCall); + },errorService.defaultFailOnCall, function() { + $scope.$emit('dataLoaded'); + }); }; $scope.adjournQuestion = function(){ @@ -1320,6 +1341,7 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam $scope.question.deadline = $scope.question.deadline.getTime(); } + $scope.$emit('dataLoading'); questionsService.saveQuestion($scope.question, function() { // Notification notify({ @@ -1329,7 +1351,9 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam templateUrl: "views/notificationTemplate.html" }); $route.reload(); - },errorService.defaultFailOnCall); + },errorService.defaultFailOnCall, function() { + $scope.$emit('dataLoaded'); + }); }; // New documents added diff --git a/coselmar-ui/src/main/webapp/js/coselmar-questions-services.js b/coselmar-ui/src/main/webapp/js/coselmar-questions-services.js index 3b60067..5f1217f 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-questions-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-questions-services.js @@ -34,7 +34,7 @@ function Question(resource, http, config){ var exportURL = config.BASE_URL + "/export/questions"; var usersURL = config.BASE_URL + "/users"; - this.saveQuestion = function(question, successFunction, failFunction){ + this.saveQuestion = function(question, successFunction, failFunction, finallyFunction){ var formData = new FormData(); formData.append("question", JSON.stringify(question)); @@ -50,7 +50,7 @@ function Question(resource, http, config){ method:'POST', } }); - questionResource.save(null, questionParam, successFunction, failFunction); + questionResource.save(null, questionParam, successFunction, failFunction).$promise.finally(finallyFunction); }; this.findUsers = function(example, successFunction) { @@ -59,7 +59,7 @@ function Question(resource, http, config){ }; - this.getQuestions = function(searchOptions, successFunction, failFunction) { + this.getQuestions = function(searchOptions, successFunction, failFunction, finallyFunction) { if (searchOptions.privacy && searchOptions.privacy.toUpperCase() != "PRIVATE" @@ -76,7 +76,7 @@ function Question(resource, http, config){ } var questionResource = resource(baseURL, {'searchOption' : searchOptions}); - questionResource.query().$promise.then(successFunction, failFunction); + questionResource.query().$promise.then(successFunction, failFunction).finally(finallyFunction); }; this.exportSearchResult = function(searchOptions, successFunction, failFunction) { @@ -110,9 +110,9 @@ function Question(resource, http, config){ questionResource.delete().$promise.then(successFunction, failFunction); }; - this.getQuestion = function(questionId, successFunction, failFunction) { + this.getQuestion = function(questionId, successFunction, failFunction, finallyFunction) { var questionResource = resource(baseURL + "/" + questionId); - questionResource.get().$promise.then(successFunction, failFunction); + questionResource.get().$promise.then(successFunction, failFunction).finally(finallyFunction); }; this.addNewDocuments = function(questionId, documents, successFunction, failFunction) { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.