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 092d492afc495971dcc644c03fb61f5d605e8743 Author: Yannick Martel <martel@©odelutin.com> Date: Fri Jan 16 18:07:24 2015 +0100 fixes #6429 review initial load off referential page --- .../src/main/webapp/js/coselmar-controllers.js | 54 +++++++++++++--------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 75c9906..849873f 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -914,28 +914,8 @@ coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $mo coselmarControllers.controller("ReferentialCtrl", ['$scope', '$routeParams', '$location', 'questionsService', 'documentService', function($scope, $routeParams, $location, questionsService, documentService){ - //manage keywords if given - $scope.search = { keywords : [], onDocuments: false, onQuestions: false }; $scope.result = { questions : [], documents : []}; - var keywords = $routeParams.keywords; - console.log(keywords); - if (Array.isArray(keywords)) { - $scope.search.keywords = keywords; - } else if (keywords) { - $scope.search.keywords.push(keywords); - } - - var onQuestions = $routeParams.onQuestions; - if (onQuestions) { - $scope.search.onQuestions = onQuestions; - } - - var onDocuments = $routeParams.onDocuments; - if (onDocuments) { - $scope.search.onDocuments = onDocuments; - } - var remoteSearchInReferential = function() { if ($scope.search.onQuestions && $scope.search.keywords.length > 0) { var questionSearchOptions = { 'privacy' : '', 'status' : '', 'keywords' : $scope.search.keywords}; @@ -952,11 +932,41 @@ coselmarControllers.controller("ReferentialCtrl", ['$scope', '$routeParams', '$l }; - remoteSearchInReferential(); + //init scope : if routeParams, use values + if ($routeParams && + ($routeParams.keywords + || $routeParams.onDocuments + || $routeParams.onQuestions)) { + + $scope.search = { keywords : [], onDocuments: false, onQuestions: false }; + + var keywords = $routeParams.keywords; + if (Array.isArray(keywords)) { + $scope.search.keywords = keywords; + } else if (keywords) { + $scope.search.keywords.push(keywords); + } + + var onQuestions = $routeParams.onQuestions; + if (onQuestions) { + $scope.search.onQuestions = onQuestions; + } + + var onDocuments = $routeParams.onDocuments; + if (onDocuments) { + $scope.search.onDocuments = onDocuments; + } + + // Launch search + remoteSearchInReferential(); + + } else { + // else, default values for screen init, no search is done + $scope.search = { keywords : [], onDocuments: true, onQuestions: true }; + } $scope.searchInReferential = function(){ - console.log($scope.search.keywords); if ($scope.search.keywords) { $location.search('keywords', $scope.search.keywords); } else { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.