branch develop updated (65748fb -> d2cf910)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git from 65748fb fixes #6301 add a dialog to confirm delete new d2cf910 fixes #6354 on user distinguish deletion and deactivation, and can enable user The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit d2cf9108992c93e9ff86cf29e6531da5d8c6541f Author: Yannick Martel <martel@©odelutin.com> Date: Fri Dec 19 18:02:44 2014 +0100 fixes #6354 on user distinguish deletion and deactivation, and can enable user Summary of changes: .../coselmar/services/v1/UsersWebService.java | 6 ++- .../src/main/webapp/js/coselmar-controllers.js | 49 ++++++++++++++++++++-- coselmar-ui/src/main/webapp/views/users/user.html | 12 ++++-- coselmar-ui/src/main/webapp/views/users/users.html | 6 ++- 4 files changed, 64 insertions(+), 9 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 d2cf9108992c93e9ff86cf29e6531da5d8c6541f Author: Yannick Martel <martel@©odelutin.com> Date: Fri Dec 19 18:02:44 2014 +0100 fixes #6354 on user distinguish deletion and deactivation, and can enable user --- .../coselmar/services/v1/UsersWebService.java | 6 ++- .../src/main/webapp/js/coselmar-controllers.js | 49 ++++++++++++++++++++-- coselmar-ui/src/main/webapp/views/users/user.html | 12 ++++-- coselmar-ui/src/main/webapp/views/users/users.html | 6 ++- 4 files changed, 64 insertions(+), 9 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java index cd9c84d..e95711e 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java @@ -275,6 +275,9 @@ public class UsersWebService extends CoselmarWebServiceSupport { } } + boolean active = user.isActive(); + coselmarUser.setActive(active); + commit(); } @@ -327,8 +330,7 @@ public class UsersWebService extends CoselmarWebServiceSupport { CoselmarUser user = getCoselmarUserDao().forTopiaIdEquals(fullId).findUnique(); - // User is not really deleted : only disable. - user.setActive(false); + getCoselmarUserDao().delete(user); commit(); } diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index b8a6d63..90be132 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -225,6 +225,26 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', }); }; + $scope.disableUser = function(user){ + + user.active = false; + userService.saveUser(user, function() { + // Go back to users list + $location.path("/users"); + }); + + }; + + $scope.enableUser = function(user){ + + user.active = true; + userService.saveUser(user, function() { + // Go back to users list + $location.path("/users"); + }); + + }; + $scope.searchUsers = function(){ $location.search('keywords', $scope.search.searchKeyword); $location.search('onlyActive', $scope.search.onlyActive); @@ -273,6 +293,28 @@ coselmarControllers.controller("UserViewCtrl", }; + $scope.disableUser = function(){ + + var user = $scope.user; + user.active = false; + userService.saveUser(user, function() { + // Go back to users list + $route.reload(); + }); + + }; + + $scope.enableUser = function(){ + + var user = $scope.user; + user.active = true; + userService.saveUser(user, function() { + // Go back to users list + $route.reload(); + }); + + }; + $scope.modifyUser = function(){ $location.search("edit"); }; @@ -863,8 +905,9 @@ coselmarControllers.filter('propsFilter', function() { /** - * A generic confirmation for risky actions. - * Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function + * A generic confirmation modal for risky actions such delete. + * + * Usage: Add attributes: ng-confirm-message="Are you sure"? ng-confirm-click="riskyAction()" */ coselmarControllers.directive('ngConfirmClick', ['$modal', function($modal) { @@ -888,7 +931,7 @@ coselmarControllers.directive('ngConfirmClick', ['$modal', function($modal) { element.bind('click', function() { var message = attrs.ngConfirmMessage || "Are you sure ?"; - var modalHtml = '<div class="modal-title"><h2>Confirm Delete</h2></div>'; + var modalHtml = '<div class="modal-title"><h2>Confirm Action</h2></div>'; modalHtml += '<div class="modal-body">' + message + '</div>'; modalHtml += '<div class="modal-footer"><button class="btn btn-primary" ng-click="ok()">OK</button><button class="btn btn-warning" ng-click="cancel()">Cancel</button></div>'; diff --git a/coselmar-ui/src/main/webapp/views/users/user.html b/coselmar-ui/src/main/webapp/views/users/user.html index 09d245d..c3c87ab 100644 --- a/coselmar-ui/src/main/webapp/views/users/user.html +++ b/coselmar-ui/src/main/webapp/views/users/user.html @@ -56,11 +56,17 @@ </tr> </table> <div class="float-right"> - <a class="btn btn-warning" ng-click="modifyUser()" ng-if="user.active">Modify</a> - <a class="btn btn-danger" + <a class="btn btn-action btn-edit" ng-click="modifyUser()" ng-if="user.active">Modify</a> + <a class="btn btn-action btn-edit" ng-confirm-message="Do you really want to disable this user ?" - ng-confirm-click="deleteUser(user.id)" + ng-confirm-click="disableUser()" ng-if="currentUser.role == 'ADMIN' && user.active">Disable</a> + <a class="btn btn-action" ng-click="enableUser()" + ng-if="currentUser.role == 'ADMIN' && !user.active">Enable</a> + <a class="btn btn-action btn-disable" + ng-confirm-message="Do you really want to delete this user ?" + ng-confirm-click="deleteUser(user.id)" + ng-if="currentUser.role == 'ADMIN'">Delete</a> </div> </div> diff --git a/coselmar-ui/src/main/webapp/views/users/users.html b/coselmar-ui/src/main/webapp/views/users/users.html index ef909cd..ffc1889 100644 --- a/coselmar-ui/src/main/webapp/views/users/users.html +++ b/coselmar-ui/src/main/webapp/views/users/users.html @@ -73,9 +73,13 @@ </a> <a class="btn btn-action btn-disable" ng-if="user.active" ng-confirm-message="Do you really want to disable this user ?" - ng-confirm-click="deleteUser(user.id)"> + ng-confirm-click="disableUser(user)"> <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>Disable </a> + <a class="btn btn-action" ng-if="!user.active" + ng-click="enableUser(user)"> + <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>Enable + </a> <!--<a class="btn btn-primary" ng-if="!user.active" ng-click="enableUser(user.id)">Enable</a>--> </td> </tr> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm