Merge pull request #2086 from emanuelschuetze/fixGroups

Use group_id instead of group in User form views
This commit is contained in:
Norman Jäckel 2016-04-17 22:48:46 +02:00
commit 5e487d2f16

View File

@ -479,7 +479,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
$scope.addGroupMultiple = function (group) {
angular.forEach($scope.users, function (user) {
if (user.selected) {
user.groups.push(group);
user.groups_id.push(group);
User.save(user);
}
});
@ -490,9 +490,9 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
$scope.removeGroupMultiple = function (group) {
angular.forEach($scope.users, function (user) {
if (user.selected) {
var groupIndex = user.groups.indexOf(parseInt(group));
var groupIndex = user.groups_id.indexOf(parseInt(group));
if (groupIndex > -1) {
user.groups.splice(groupIndex, 1);
user.groups_id.splice(groupIndex, 1);
User.save(user);
}
}
@ -535,8 +535,8 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
// save user
$scope.save = function (user) {
if (!user.groups) {
user.groups = [];
if (!user.groups_id) {
user.groups_id = [];
}
User.create(user).then(
function(success) {
@ -574,8 +574,8 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
// save user
$scope.save = function (user) {
if (!user.groups) {
user.groups = [];
if (!user.groups_id) {
user.groups_id = [];
}
// inject the changed user (copy) object back into DS store
User.inject(user);