diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 62448e8b8..ca4a6d081 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -421,17 +421,17 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) $scope.alert = { type: 'danger', msg: message, show: true }; }); }; - // *** delete mode functions *** - $scope.isDeleteMode = false; + // *** select mode functions *** + $scope.isSelectMode = false; // check all checkboxes $scope.checkAll = function () { angular.forEach($scope.users, function (user) { user.selected = $scope.selectedAll; }); }; - // uncheck all checkboxes if isDeleteMode is closed + // uncheck all checkboxes if isSelectMode is closed $scope.uncheckAll = function () { - if (!$scope.isDeleteMode) { + if (!$scope.isSelectMode) { $scope.selectedAll = false; angular.forEach($scope.users, function (user) { user.selected = false; @@ -441,16 +441,42 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) // delete all selected users $scope.deleteMultiple = function () { angular.forEach($scope.users, function (user) { - if (user.selected) + if (user.selected) { User.destroy(user.id); + } }); - $scope.isDeleteMode = false; + $scope.isSelectMode = false; $scope.uncheckAll(); }; // delete single user $scope.delete = function (user) { User.destroy(user.id); }; + // add group for selected users + $scope.addGroupMultiple = function (group) { + angular.forEach($scope.users, function (user) { + if (user.selected) { + user.groups.push(group); + User.save(user); + } + }); + $scope.isSelectMode = false; + $scope.uncheckAll(); + }; + // remove group for selected users + $scope.removeGroupMultiple = function (group) { + angular.forEach($scope.users, function (user) { + if (user.selected) { + var groupIndex = user.groups.indexOf(parseInt(group)); + if (groupIndex > -1) { + user.groups.splice(groupIndex, 1); + User.save(user); + } + } + }); + $scope.isSelectMode = false; + $scope.uncheckAll(); + }; } ]) diff --git a/openslides/users/static/templates/users/user-list.html b/openslides/users/static/templates/users/user-list.html index 5b31c64cf..8ed04db42 100644 --- a/openslides/users/static/templates/users/user-list.html +++ b/openslides/users/static/templates/users/user-list.html @@ -39,10 +39,10 @@
- + @@ -77,15 +77,40 @@ Is present
-
-
+
+
+ + - + Delete selected participants + + + + + + Add group + + + + + Remove group +
@@ -106,9 +131,9 @@ - - - + + + Name @@ -135,15 +160,15 @@ - + - - + +