Improve ACL editor

This commit is contained in:
Francis Lachapelle
2016-06-20 16:11:05 -04:00
parent 6b5571ea2c
commit 66e1fbd556
5 changed files with 52 additions and 28 deletions
@@ -6,8 +6,8 @@
/**
* @ngInject
*/
AclController.$inject = ['$mdDialog', 'Dialog', 'usersWithACL', 'User', 'folder'];
function AclController($mdDialog, Dialog, usersWithACL, User, folder) {
AclController.$inject = ['$timeout', '$mdDialog', 'Dialog', 'usersWithACL', 'User', 'folder'];
function AclController($timeout, $mdDialog, Dialog, usersWithACL, User, folder) {
var vm = this;
vm.users = usersWithACL; // ACL users
@@ -21,8 +21,8 @@
vm.saveModal = saveModal;
vm.confirmChange = confirmChange;
vm.removeUser = removeUser;
vm.selectAllRights = selectAllRights;
vm.addUser = addUser;
vm.selectAllRights = selectAllRights;
vm.selectUser = selectUser;
vm.confirmation = { showing: false,
message: ''};
@@ -53,11 +53,9 @@
}
function removeUser(user) {
folder.$acl.$removeUser(user.uid);
}
function selectAllRights(user) {
folder.$acl.$selectAllRights(user);
$timeout(function() {
folder.$acl.$removeUser(user.uid);
}, 500); // wait for CSS transition to complete (see card.scss)
}
function addUser(data) {
@@ -68,13 +66,17 @@
vm.selectedUid = null;
if (user)
selectUser(user);
}, function(error) {
Dialog.alert(l('Warning'), error);
});
}
}
function selectUser(user) {
function selectAllRights(user) {
folder.$acl.$selectAllRights(user);
}
function selectUser(user, $event) {
if ($event && $event.target.parentNode.classList.contains('md-secondary'))
return false;
if (vm.selectedUid == user.uid) {
vm.selectedUid = null;
}