Merge pull request #2820 from FinnStutzenstein/Issue2667
Change user import table
This commit is contained in:
commit
962c06c85f
@ -1249,6 +1249,10 @@ img {
|
|||||||
padding-right: 0 !important;
|
padding-right: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scroll-x-container {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
/* user details */
|
/* user details */
|
||||||
.user_details fieldset {
|
.user_details fieldset {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
@ -963,6 +963,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
$scope.duplicates = 0;
|
$scope.duplicates = 0;
|
||||||
var quotionRe = /^"(.*)"$/;
|
var quotionRe = /^"(.*)"$/;
|
||||||
angular.forEach($scope.csv.result, function (user) {
|
angular.forEach($scope.csv.result, function (user) {
|
||||||
|
user.selected = true;
|
||||||
// title
|
// title
|
||||||
if (user.title) {
|
if (user.title) {
|
||||||
user.title = user.title.replace(quotionRe, '$1');
|
user.title = user.title.replace(quotionRe, '$1');
|
||||||
@ -1098,7 +1099,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
$scope.usersWillBeImported = 0;
|
$scope.usersWillBeImported = 0;
|
||||||
|
|
||||||
$scope.users.forEach(function(user) {
|
$scope.users.forEach(function(user) {
|
||||||
if (user.importerror || (user.duplicate && user.duplicateAction == $scope.duplicateActions[0])) {
|
if (!user.selected || user.importerror || (user.duplicate && user.duplicateAction == $scope.duplicateActions[0])) {
|
||||||
$scope.usersWillNotBeImported++;
|
$scope.usersWillNotBeImported++;
|
||||||
} else {
|
} else {
|
||||||
$scope.usersWillBeImported++;
|
$scope.usersWillBeImported++;
|
||||||
@ -1121,7 +1122,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
// collect all needed groups and create non existing groups
|
// collect all needed groups and create non existing groups
|
||||||
var groupsToCreate = [];
|
var groupsToCreate = [];
|
||||||
_.forEach($scope.users, function (user) {
|
_.forEach($scope.users, function (user) {
|
||||||
if (!user.importerror && user.groups.length) {
|
if (user.selected && !user.importerror && user.groups.length) {
|
||||||
_.forEach(user.groupsToCreate, function (group) { // Just append groups, that are not listed yet.
|
_.forEach(user.groupsToCreate, function (group) { // Just append groups, that are not listed yet.
|
||||||
if (_.indexOf(groupsToCreate, group) == -1) {
|
if (_.indexOf(groupsToCreate, group) == -1) {
|
||||||
groupsToCreate.push(group);
|
groupsToCreate.push(group);
|
||||||
@ -1147,7 +1148,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
var existingUsers = User.getAll();
|
var existingUsers = User.getAll();
|
||||||
|
|
||||||
_.forEach($scope.users, function (user) {
|
_.forEach($scope.users, function (user) {
|
||||||
if (!user.importerror) {
|
if (user.selected && !user.importerror) {
|
||||||
// Assign all groups
|
// Assign all groups
|
||||||
_.forEach(user.groups, function(csvGroup) {
|
_.forEach(user.groups, function(csvGroup) {
|
||||||
allGroups.forEach(function (allGroup) {
|
allGroups.forEach(function (allGroup) {
|
||||||
|
@ -77,108 +77,111 @@
|
|||||||
|
|
||||||
<div ng-show="csv.result">
|
<div ng-show="csv.result">
|
||||||
<h3 translate>Preview</h3>
|
<h3 translate>Preview</h3>
|
||||||
<table class="table table-striped table-bordered table-condensed">
|
<div class="scroll-x-container">
|
||||||
<thead>
|
<table class="table table-striped table-bordered table-condensed">
|
||||||
<tr>
|
<thead>
|
||||||
<th>
|
<tr>
|
||||||
<th>#
|
<th>
|
||||||
<th translate>Title
|
<th>#
|
||||||
<th translate>Given name
|
<th translate>Title
|
||||||
<th translate>Surname
|
<th translate>Given name
|
||||||
<th translate>Structure level
|
<th translate>Surname
|
||||||
<th translate>Participant number
|
<th translate>Structure level
|
||||||
<th translate>Groups
|
<th translate>Participant number
|
||||||
<th translate>Comment
|
<th translate>Groups
|
||||||
<th translate>Is active
|
<th translate>Comment
|
||||||
<th translate>Is present
|
<th translate>Is active
|
||||||
<th translate>Is committee</th>
|
<th translate>Is present
|
||||||
<th ng-if="duplicates > 0">
|
<th translate>Is committee</th>
|
||||||
<i class="fa fa-exclamation-triangle text-danger"></i>
|
<th ng-if="duplicates > 0">
|
||||||
<strong class="text-danger" ng-if="duplicates == 1">1 <translate>duplicate</translate></strong>
|
<i class="fa fa-exclamation-triangle text-danger"></i>
|
||||||
<strong class="text-danger" ng-if="duplicates > 1">{{ duplicates }} <translate>duplicates</translate></strong>
|
<strong class="text-danger" ng-if="duplicates == 1">1 <translate>duplicate</translate></strong>
|
||||||
|
<strong class="text-danger" ng-if="duplicates > 1">{{ duplicates }} <translate>duplicates</translate></strong>
|
||||||
|
|
||||||
<div uib-dropdown>
|
<div uib-dropdown>
|
||||||
<button id="GlobalAction" type="button" class="btn btn-default btn-danger btn-sm" uib-dropdown-toggle>
|
<button id="GlobalAction" type="button" class="btn btn-default btn-danger btn-sm" uib-dropdown-toggle>
|
||||||
<translate>Set global action</translate>
|
<translate>Set global action</translate>
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" aria-labelledby="GlobalAction">
|
<ul class="dropdown-menu" aria-labelledby="GlobalAction">
|
||||||
<li ng-repeat="action in duplicateActions">
|
<li ng-repeat="action in duplicateActions">
|
||||||
<a href ng-click="setGlobalAction(action)">
|
<a href ng-click="setGlobalAction(action)">
|
||||||
{{ action | translate }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
<tbody>
|
|
||||||
<tr ng-repeat="user in users | limitTo : itemsPerPage : limitBegin">
|
|
||||||
<td class="minimum"
|
|
||||||
ng-class="{ 'text-danger': (user.importerror || user.duplicateAction == duplicateActions[0]), 'text-success': user.imported }">
|
|
||||||
<span ng-if="user.importerror || user.duplicateAction == duplicateActions[0]">
|
|
||||||
<i class="fa fa-exclamation-triangle fa-lg"></i>
|
|
||||||
</span>
|
|
||||||
<span ng-if="!user.importerror && !user.imported && user.duplicateAction != duplicateActions[0]">
|
|
||||||
<i class="fa fa-check-circle-o fa-lg"></i>
|
|
||||||
</span>
|
|
||||||
<span ng-if="user.imported">
|
|
||||||
<i class="fa fa-check-circle fa-lg"></i>
|
|
||||||
</span>
|
|
||||||
<td>
|
|
||||||
{{ (currentPage - 1) * itemsPerPage + $index + 1 }}
|
|
||||||
<td>
|
|
||||||
{{ user.title }}
|
|
||||||
<td ng-class="{ 'text-danger': user.name_error }">
|
|
||||||
<span ng-if="!user.first_name && user.name_error" title="{{ user.name_error | translate }}">
|
|
||||||
<i class="fa fa-exclamation-triangle"></i>
|
|
||||||
</span>
|
|
||||||
{{ user.first_name }}
|
|
||||||
<td ng-class="{ 'text-danger': user.name_error }">
|
|
||||||
<span ng-if="!user.last_name && user.name_error" title="{{ user.name_error | translate }}">
|
|
||||||
<i class="fa fa-exclamation-triangle"></i>
|
|
||||||
</span>
|
|
||||||
{{ user.last_name }}
|
|
||||||
<td>
|
|
||||||
{{ user.structure_level }}
|
|
||||||
<td>
|
|
||||||
{{ user.number }}
|
|
||||||
<td>
|
|
||||||
<div ng-repeat="groupname in user.groupsNotToCreate">
|
|
||||||
{{ groupname | translate }}
|
|
||||||
</div>
|
|
||||||
<div ng-repeat="groupname in user.groupsToCreate" class="text-warning">
|
|
||||||
<i class="fa fa-plus-circle"></i>
|
|
||||||
{{ groupname | translate }}
|
|
||||||
</div>
|
|
||||||
<td style="max-width: 130px;">
|
|
||||||
<span uib-tooltip="{{ user.comment }}">
|
|
||||||
{{ user.comment | limitTo: 30 }}{{ user.comment.length > 30 ? '...' : '' }}
|
|
||||||
</span>
|
|
||||||
<td>
|
|
||||||
<i class="fa pointer" ng-class="user.is_active ? 'fa-check-square-o' : 'fa-square-o'"
|
|
||||||
ng-click="user.is_active = !user.is_active"></i>
|
|
||||||
<td>
|
|
||||||
<i class="fa pointer" ng-class="user.is_present ? 'fa-check-square-o' : 'fa-square-o'"
|
|
||||||
ng-click="user.is_present = !user.is_present"></i>
|
|
||||||
<td>
|
|
||||||
<i class="fa pointer" ng-class="user.is_committee ? 'fa-check-square-o' : 'fa-square-o'"
|
|
||||||
ng-click="user.is_committee = !user.is_committee"></i>
|
|
||||||
<td ng-if="duplicates > 0">
|
|
||||||
<div ng-if="user.duplicate" uib-tooltip="{{ user.duplicate_info }}" uib-dropdown>
|
|
||||||
<button id="UserAction{{ $index }}" type="button" class="btn btn-default btn-sm"
|
|
||||||
uib-dropdown-toggle ng-class="user.duplicateAction == duplicateActions[0] ? 'btn-warning' : (user.duplicateAction == duplicateActions[1] ? 'btn-danger' : 'btn-success')">
|
|
||||||
{{ user.duplicateAction | translate }}
|
|
||||||
<span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu" aria-labelledby="UserAction{{ $index }}">
|
|
||||||
<li ng-repeat="action in duplicateActions">
|
|
||||||
<a href ng-click="user.duplicateAction = action; calcStats()">
|
|
||||||
<i class="fa fa-check" ng-if="user.duplicateAction == action"></i>
|
|
||||||
{{ action | translate }}
|
{{ action | translate }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</table>
|
</div>
|
||||||
|
</th>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="user in users | limitTo : itemsPerPage : limitBegin">
|
||||||
|
<td class="minimum"
|
||||||
|
ng-class="{ 'text-danger': (user.importerror || user.duplicateAction == duplicateActions[0]), 'text-success': user.imported }">
|
||||||
|
<span ng-if="user.importerror || user.duplicateAction == duplicateActions[0]">
|
||||||
|
<i class="fa fa-exclamation-triangle fa-lg"></i>
|
||||||
|
</span>
|
||||||
|
<span ng-if="!user.importerror && !user.imported && user.duplicateAction != duplicateActions[0]" class="pointer">
|
||||||
|
<i class="fa fa-check-circle-o fa-lg" ng-if="user.selected" ng-click="user.selected=false; calcStats();"></i>
|
||||||
|
<i class="fa fa-circle-o fa-lg" ng-if="!user.selected" ng-click="user.selected=true; calcStats();"></i>
|
||||||
|
</span>
|
||||||
|
<span ng-if="user.imported">
|
||||||
|
<i class="fa fa-check-circle fa-lg"></i>
|
||||||
|
</span>
|
||||||
|
<td class="nobr">
|
||||||
|
{{ (currentPage - 1) * itemsPerPage + $index + 1 }}
|
||||||
|
<td>
|
||||||
|
{{ user.title }}
|
||||||
|
<td ng-class="{ 'text-danger': user.name_error }">
|
||||||
|
<span ng-if="!user.first_name && user.name_error" title="{{ user.name_error | translate }}">
|
||||||
|
<i class="fa fa-exclamation-triangle"></i>
|
||||||
|
</span>
|
||||||
|
{{ user.first_name }}
|
||||||
|
<td ng-class="{ 'text-danger': user.name_error }">
|
||||||
|
<span ng-if="!user.last_name && user.name_error" title="{{ user.name_error | translate }}">
|
||||||
|
<i class="fa fa-exclamation-triangle"></i>
|
||||||
|
</span>
|
||||||
|
{{ user.last_name }}
|
||||||
|
<td>
|
||||||
|
{{ user.structure_level }}
|
||||||
|
<td>
|
||||||
|
{{ user.number }}
|
||||||
|
<td>
|
||||||
|
<div ng-repeat="groupname in user.groupsNotToCreate">
|
||||||
|
{{ groupname | translate }}
|
||||||
|
</div>
|
||||||
|
<div ng-repeat="groupname in user.groupsToCreate" class="text-warning">
|
||||||
|
<i class="fa fa-plus-circle"></i>
|
||||||
|
{{ groupname | translate }}
|
||||||
|
</div>
|
||||||
|
<td style="max-width: 130px;">
|
||||||
|
<span uib-tooltip="{{ user.comment }}">
|
||||||
|
{{ user.comment | limitTo: 30 }}{{ user.comment.length > 30 ? '...' : '' }}
|
||||||
|
</span>
|
||||||
|
<td>
|
||||||
|
<i class="fa pointer" ng-class="user.is_active ? 'fa-check-square-o' : 'fa-square-o'"
|
||||||
|
ng-click="user.is_active = !user.is_active"></i>
|
||||||
|
<td>
|
||||||
|
<i class="fa pointer" ng-class="user.is_present ? 'fa-check-square-o' : 'fa-square-o'"
|
||||||
|
ng-click="user.is_present = !user.is_present"></i>
|
||||||
|
<td>
|
||||||
|
<i class="fa pointer" ng-class="user.is_committee ? 'fa-check-square-o' : 'fa-square-o'"
|
||||||
|
ng-click="user.is_committee = !user.is_committee"></i>
|
||||||
|
<td ng-if="duplicates > 0">
|
||||||
|
<div ng-if="user.duplicate" uib-tooltip="{{ user.duplicate_info }}" uib-dropdown>
|
||||||
|
<button id="UserAction{{ $index }}" type="button" class="btn btn-default btn-sm"
|
||||||
|
uib-dropdown-toggle ng-class="user.duplicateAction == duplicateActions[0] ? 'btn-warning' : (user.duplicateAction == duplicateActions[1] ? 'btn-danger' : 'btn-success')">
|
||||||
|
{{ user.duplicateAction | translate }}
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu" aria-labelledby="UserAction{{ $index }}">
|
||||||
|
<li ng-repeat="action in duplicateActions">
|
||||||
|
<a href ng-click="user.duplicateAction = action; calcStats()">
|
||||||
|
<i class="fa fa-check" ng-if="user.duplicateAction == action"></i>
|
||||||
|
{{ action | translate }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
<ul uib-pagination
|
<ul uib-pagination
|
||||||
ng-show="users.length > itemsPerPage"
|
ng-show="users.length > itemsPerPage"
|
||||||
total-items="users.length"
|
total-items="users.length"
|
||||||
|
Loading…
Reference in New Issue
Block a user