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 bf95eedb671d81b69b86a81f6d955949db9b4503 Author: Yannick Martel <martel@©odelutin.com> Date: Mon Jan 5 11:34:57 2015 +0100 show only active user by default --- .../src/main/webapp/js/coselmar-controllers.js | 19 ++++++++++++------- .../src/main/webapp/js/coselmar-user-services.js | 15 +++------------ coselmar-ui/src/main/webapp/views/users/users.html | 4 ++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index d5d2306..2e82b34 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -203,19 +203,24 @@ coselmarControllers.directive('ngFileModel', ['$parse', function ($parse) { coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', '$location', 'userService', function($scope, $route, $routeParams, $location, userService){ //manage keywords if given - $scope.search = { searchKeyword : '', onlyActive : false }; + $scope.search = { searchKeyword : ''}; var keywords = $routeParams.keywords; if (Array.isArray(keywords)) { $scope.search.searchKeyword = keywords[0]; } else if (keywords) { $scope.search.searchKeyword = keywords; } - var onlyActive = $routeParams.onlyActive; - if (onlyActive) { - $scope.search.onlyActive = onlyActive; + var showDisable = $routeParams.showDisable; + if (showDisable) { + $scope.search.showDisable = showDisable; + } else { + $scope.search.showDisable = false; } + console.log($scope.search.showDisable); - userService.getUsers($scope); + userService.getUsers($scope.search.searchKeywords, $scope.search.showDisable, function(users) { + $scope.users = users; + }); $scope.deleteUser = function(userId){ @@ -247,7 +252,7 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', $scope.searchUsers = function(){ $location.search('keywords', $scope.search.searchKeyword); - $location.search('onlyActive', $scope.search.onlyActive); + $location.search('showDisable', $scope.search.showDisable); } }]); @@ -255,7 +260,7 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', // Controller for new user View coselmarControllers.controller("NewUserCtrl", ['$scope', '$route', '$location', 'userService', function($scope, $route, $location, userService){ - $scope.user = {'role' : 'expert'}; + $scope.user = {'role' : 'EXPERT'}; $scope.saveUser = function(isValidForm){ diff --git a/coselmar-ui/src/main/webapp/js/coselmar-user-services.js b/coselmar-ui/src/main/webapp/js/coselmar-user-services.js index dbd0707..437bff1 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-user-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-user-services.js @@ -68,20 +68,11 @@ function User(resource, config){ userResource.delete({userId:id}, successFunction); } - this.getUsers = function(scope){ + this.getUsers = function(searchKeywords, showDisable, successFunction){ // Load all users - var userResource = resource(baseURL, scope.search); - userResource.query(function(users){ - scope.users = users; - }, function(errorResult) { - // let's log errors - if(errorResult.status === 404) { - console.log("Service unreachable, deal it boy!"); - } else { - console.log("WTF ?!?"); - } - }); + var userResource = resource(baseURL, {'searchKeywords' : searchKeywords, 'onlyActive' : !showDisable}); + userResource.query(successFunction); } this.login = function(mail, password, successFunction, failFunction){ diff --git a/coselmar-ui/src/main/webapp/views/users/users.html b/coselmar-ui/src/main/webapp/views/users/users.html index ffc1889..ab0a4de 100644 --- a/coselmar-ui/src/main/webapp/views/users/users.html +++ b/coselmar-ui/src/main/webapp/views/users/users.html @@ -36,8 +36,8 @@ </div> <form class="form-inline pull-right" role="userOptions" ng-submit="searchUsers()"> <div class="form-group"> - <input type="checkbox" class="form-control" ng-model="search.onlyActive" /> - <span>Only Active</span> + <input type="checkbox" class="form-control" ng-model="search.showDisable" /> + <span>Show Disable</span> </div> <div class="form-group"> <input type="search" class="form-control" placeholder="Search an user" ng-model="search.searchKeyword" /> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.