Added multiselection delete mode for users list view.
Fix users import: Allows multiple groups.
This commit is contained in:
parent
69268f0cc7
commit
fac45fbf2a
@ -222,7 +222,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
|
|||||||
// open detail view link
|
// open detail view link
|
||||||
$scope.openDetail = function (id) {
|
$scope.openDetail = function (id) {
|
||||||
$state.go('agenda.item.detail', {id: id});
|
$state.go('agenda.item.detail', {id: id});
|
||||||
}
|
};
|
||||||
|
|
||||||
// save changed item
|
// save changed item
|
||||||
$scope.save = function (item) {
|
$scope.save = function (item) {
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
<!-- projector column -->
|
<!-- projector column -->
|
||||||
<th ng-show="!isDeleteMode" os-perms="core.can_manage_projector" class="firstColumn">
|
<th ng-show="!isDeleteMode" os-perms="core.can_manage_projector" class="firstColumn">
|
||||||
<!-- delete selection column -->
|
<!-- delete selection column -->
|
||||||
<th ng-show="isDeleteMode" os-perms="agenda.can_manage" class="firstColumn deleteColumn"
|
<th ng-show="isDeleteMode" os-perms-lite="agenda.can_manage" class="firstColumn deleteColumn"
|
||||||
ng-click="$event.stopPropagation();">
|
ng-click="$event.stopPropagation();">
|
||||||
<input type="checkbox" ng-model="selectedAll" ng-change="checkAll()">
|
<input type="checkbox" ng-model="selectedAll" ng-change="checkAll()">
|
||||||
<!-- agenda item column -->
|
<!-- agenda item column -->
|
||||||
@ -100,7 +100,7 @@
|
|||||||
<td ng-show="isDeleteMode" os-perms="agenda.can_manage" class="deleteColumn"
|
<td ng-show="isDeleteMode" os-perms="agenda.can_manage" class="deleteColumn"
|
||||||
ng-click="$event.stopPropagation();">
|
ng-click="$event.stopPropagation();">
|
||||||
<input type="checkbox" ng-model="item.selected">
|
<input type="checkbox" ng-model="item.selected">
|
||||||
<!-- agenda item column -->
|
<!-- agenda data columns -->
|
||||||
<td>
|
<td>
|
||||||
<span ng-repeat="n in [].constructor(item.parentCount) track by $index">–</span>
|
<span ng-repeat="n in [].constructor(item.parentCount) track by $index">–</span>
|
||||||
{{ item.item_number }} {{ item.title }}
|
{{ item.item_number }} {{ item.title }}
|
||||||
|
@ -350,7 +350,12 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
.controller('UserListCtrl', function($scope, User, Group) {
|
.controller('UserListCtrl', [
|
||||||
|
'$scope',
|
||||||
|
'$state',
|
||||||
|
'User',
|
||||||
|
'Group',
|
||||||
|
function($scope, $state, User, Group) {
|
||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
Group.bindAll({}, $scope, 'groups');
|
Group.bindAll({}, $scope, 'groups');
|
||||||
|
|
||||||
@ -366,17 +371,45 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
$scope.sortColumn = column;
|
$scope.sortColumn = column;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// open detail view link
|
||||||
|
$scope.openDetail = function (id) {
|
||||||
|
$state.go('users.user.detail', {id: id});
|
||||||
|
};
|
||||||
|
|
||||||
// save changed user
|
// save changed user
|
||||||
$scope.togglePresent = function (user) {
|
$scope.togglePresent = function (user) {
|
||||||
//the value was changed by the template (checkbox)
|
//the value was changed by the template (checkbox)
|
||||||
User.save(user);
|
User.save(user);
|
||||||
};
|
};
|
||||||
|
|
||||||
// delete selected user
|
// *** delete mode functions ***
|
||||||
$scope.delete = function (user) {
|
$scope.isDeleteMode = false;
|
||||||
User.destroy(user.id);
|
// check all checkboxes
|
||||||
|
$scope.checkAll = function () {
|
||||||
|
angular.forEach($scope.users, function (user) {
|
||||||
|
user.selected = $scope.selectedAll;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
})
|
// uncheck all checkboxes if isDeleteMode is closed
|
||||||
|
$scope.uncheckAll = function () {
|
||||||
|
if (!$scope.isDeleteMode) {
|
||||||
|
$scope.selectedAll = false;
|
||||||
|
angular.forEach($scope.users, function (user) {
|
||||||
|
user.selected = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// delete selected user
|
||||||
|
$scope.delete = function () {
|
||||||
|
angular.forEach($scope.users, function (user) {
|
||||||
|
if (user.selected)
|
||||||
|
User.destroy(user.id);
|
||||||
|
});
|
||||||
|
$scope.isDeleteMode = false;
|
||||||
|
$scope.uncheckAll();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
.controller('UserDetailCtrl', function($scope, User, user, Group) {
|
.controller('UserDetailCtrl', function($scope, User, user, Group) {
|
||||||
User.bindOne(user.id, $scope, 'user');
|
User.bindOne(user.id, $scope, 'user');
|
||||||
@ -469,7 +502,14 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
user.first_name = obj[i].first_name;
|
user.first_name = obj[i].first_name;
|
||||||
user.last_name = obj[i].last_name;
|
user.last_name = obj[i].last_name;
|
||||||
user.structure_level = obj[i].structure_level;
|
user.structure_level = obj[i].structure_level;
|
||||||
user.groups = obj[i].groups;
|
user.groups = [];
|
||||||
|
if (obj[i].groups != '') {
|
||||||
|
var groups = obj[i].groups.replace('"','').split(",");
|
||||||
|
groups.forEach(function(group) {
|
||||||
|
user.groups.push(group);
|
||||||
|
console.log(group);
|
||||||
|
});
|
||||||
|
}
|
||||||
user.comment = obj[i].comment;
|
user.comment = obj[i].comment;
|
||||||
User.create(user).then(
|
User.create(user).then(
|
||||||
function(success) {
|
function(success) {
|
||||||
|
@ -86,7 +86,7 @@ Keep each person in a single line.</p>
|
|||||||
</div>
|
</div>
|
||||||
<a ng-if="csvimported" ui-sref="users.user.list" class="btn btn-sm btn-default">
|
<a ng-if="csvimported" ui-sref="users.user.list" class="btn btn-sm btn-default">
|
||||||
<i class="fa fa-angle-double-left fa-lg"></i>
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
||||||
<translate>Back to agenda overview</translate>
|
<translate>Back to users overview</translate>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
|
@ -38,23 +38,45 @@
|
|||||||
|
|
||||||
<div class="row form-group">
|
<div class="row form-group">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
<form class="form-inline">
|
||||||
|
<!-- delete mode -->
|
||||||
|
<div os-perms-lite="agenda.can_manage" class="form-group">
|
||||||
|
<label for="deleteSwitcher" translate>Delete mode</label>
|
||||||
|
<switch id="deleteSwitcher" ng-model="isDeleteMode" ng-change="uncheckAll()"
|
||||||
|
on="{{'On'|translate}}" off="{{'Off'|translate}}"
|
||||||
|
class="green wide form-control">
|
||||||
|
</switch>
|
||||||
|
</div>
|
||||||
|
<!-- delete button -->
|
||||||
|
<a ng-show="isDeleteMode && (users|filter:{selected:true}).length > 0"
|
||||||
|
os-perms="users.can_manage" ng-click="delete()"
|
||||||
|
class="btn btn-primary btn-sm form-control">
|
||||||
|
<i class="fa fa-trash fa-lg"></i>
|
||||||
|
<translate>Delete selected users</translate>
|
||||||
|
</a>
|
||||||
|
<!-- isPresent filter -->
|
||||||
<input type="checkbox" ng-model="filterPresent" ng-false-value="''">
|
<input type="checkbox" ng-model="filterPresent" ng-false-value="''">
|
||||||
<translate>Is present</translate>
|
<translate>Is present</translate>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-addon"><i class="fa fa-filter"></i></div>
|
||||||
<input type="text" os-focus-me ng-model="filter.search" class="form-control"
|
<input type="text" os-focus-me ng-model="filter.search" class="form-control"
|
||||||
placeholder="{{ 'Filter' | translate}}">
|
placeholder="{{ 'Filter' | translate}}">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="table table-striped table-bordered table-hover">
|
<table class="table table-striped table-bordered table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th ng-click="toggleSort('is_present')" class="sortable minimum">
|
<!-- projector column -->
|
||||||
<translate>Present</translate>
|
<th ng-show="!isDeleteMode" os-perms="core.can_manage_projector" class="firstColumn">
|
||||||
<i class="pull-right fa" ng-show="sortColumn === 'is_present' && header.sortable != false"
|
<!-- delete selection column -->
|
||||||
ng-class="reverse ? 'fa-sort-desc' : 'fa-sort-asc'">
|
<th ng-show="isDeleteMode" os-perms-lite="users.can_manage" class="firstColumn deleteColumn"
|
||||||
</i>
|
ng-click="$event.stopPropagation();">
|
||||||
|
<input type="checkbox" ng-model="selectedAll" ng-change="checkAll()">
|
||||||
<th ng-click="toggleSort('first_name')" class="sortable">
|
<th ng-click="toggleSort('first_name')" class="sortable">
|
||||||
<translate>Name</translate>
|
<translate>Name</translate>
|
||||||
<!-- TODO: sort by first OR last name -->
|
<!-- TODO: sort by first OR last name -->
|
||||||
@ -71,37 +93,38 @@
|
|||||||
<i class="pull-right fa" ng-show="sortColumn === 'groups' && header.sortable != false"
|
<i class="pull-right fa" ng-show="sortColumn === 'groups' && header.sortable != false"
|
||||||
ng-class="reverse ? 'fa-sort-desc' : 'fa-sort-asc'">
|
ng-class="reverse ? 'fa-sort-desc' : 'fa-sort-asc'">
|
||||||
</i>
|
</i>
|
||||||
<th os-perms="users.can_manage core.can_manage_projector" class="minimum">
|
<th ng-click="toggleSort('is_present')" class="sortable minimum">
|
||||||
<translate>Actions</translate>
|
<translate>Present</translate>
|
||||||
|
<i class="pull-right fa" ng-show="sortColumn === 'is_present' && header.sortable != false"
|
||||||
|
ng-class="reverse ? 'fa-sort-desc' : 'fa-sort-asc'">
|
||||||
|
</i>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="user in users | filter: filter.search | filter: {is_present: filterPresent} |
|
<tr ng-repeat="user in users | filter: filter.search | filter: {is_present: filterPresent} |
|
||||||
orderBy: sortColumn:reverse" ng-class="{ 'activeline': user.isProjected() }">
|
orderBy: sortColumn:reverse"
|
||||||
<td><input type="checkbox" ng-model="user.is_present" ng-click="togglePresent(user)">
|
ng-click="openDetail(user.id)"
|
||||||
<td><a ui-sref="users.user.detail({id: user.id})">{{ user.get_short_name() }}</a>
|
ng-class="{ 'activeline': user.isProjected() }"
|
||||||
<div ng-if="user.comment"><small><i class="fa fa-info-circle"></i> {{ user.comment }}</small></div>
|
class="pointer">
|
||||||
|
<!-- projector column -->
|
||||||
|
<td ng-show="!isDeleteMode" os-perms="core.can_manage_projector">
|
||||||
|
<a class="btn btn-default btn-sm"
|
||||||
|
ng-class="{ 'btn-primary': user.isProjected() }"
|
||||||
|
ng-click="user.project(); $event.stopPropagation();"
|
||||||
|
title="{{ 'Project user' | translate }}">
|
||||||
|
<i class="fa fa-video-camera"></i>
|
||||||
|
</a>
|
||||||
|
<!-- delete selection column -->
|
||||||
|
<td ng-show="isDeleteMode" os-perms="users.can_manage" class="deleteColumn"
|
||||||
|
ng-click="$event.stopPropagation();">
|
||||||
|
<input type="checkbox" ng-model="user.selected">
|
||||||
|
<!-- user data colums -->
|
||||||
|
<td>{{ user.get_short_name() }}
|
||||||
|
<div ng-if="user.comment">
|
||||||
|
<small><i class="fa fa-info-circle"></i> {{ user.comment }}</small>
|
||||||
|
</div>
|
||||||
<td class="optional">{{ user.structure_level }}
|
<td class="optional">{{ user.structure_level }}
|
||||||
<td class="optional">
|
<td class="optional">
|
||||||
<div ng-repeat="group in user.groups">
|
<div ng-repeat="group in user.groups">
|
||||||
{{ (groups | filter: {id: group})[0].name }}
|
{{ (groups | filter: {id: group})[0].name }}
|
||||||
</div>
|
</div>
|
||||||
<td os-perms="users.can_manage core.can_manage_projector" class="nobr">
|
<td><input type="checkbox" ng-model="user.is_present" ng-click="togglePresent(user)">
|
||||||
<!-- project -->
|
|
||||||
<a os-perms="core.can_manage_projector" class="btn btn-default btn-sm" ng-class="{ 'btn-primary': user.isProjected() }"
|
|
||||||
ng-click="user.project()"
|
|
||||||
title="{{ 'Project user' | translate }}">
|
|
||||||
<i class="fa fa-video-camera"></i>
|
|
||||||
</a>
|
|
||||||
<!-- edit -->
|
|
||||||
<a ui-sref="users.user.detail.update({id: user.id})" os-perms="users.can_manage"
|
|
||||||
class="btn btn-default btn-sm"
|
|
||||||
title="{{ 'Edit' | translate}}">
|
|
||||||
<i class="fa fa-pencil"></i>
|
|
||||||
</a>
|
|
||||||
<!-- delete -->
|
|
||||||
<a os-perms="users.can_manage" class="btn btn-danger btn-sm"
|
|
||||||
ng-bootbox-confirm="Are you sure you want to delete <b>{{ user.get_short_name() }}</b>?"
|
|
||||||
ng-bootbox-confirm-action="delete(user)"
|
|
||||||
title="{{ 'Delete' | translate }}">
|
|
||||||
<i class="fa fa-trash-o"></i>
|
|
||||||
</a>
|
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user