Change user import table

This commit is contained in:
FinnStutzenstein 2017-01-06 15:08:51 +01:00
parent 6502f36a90
commit a9fbbb522e
3 changed files with 110 additions and 102 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -77,6 +77,7 @@
<div ng-show="csv.result"> <div ng-show="csv.result">
<h3 translate>Preview</h3> <h3 translate>Preview</h3>
<div class="scroll-x-container">
<table class="table table-striped table-bordered table-condensed"> <table class="table table-striped table-bordered table-condensed">
<thead> <thead>
<tr> <tr>
@ -118,13 +119,14 @@
<span ng-if="user.importerror || user.duplicateAction == duplicateActions[0]"> <span ng-if="user.importerror || user.duplicateAction == duplicateActions[0]">
<i class="fa fa-exclamation-triangle fa-lg"></i> <i class="fa fa-exclamation-triangle fa-lg"></i>
</span> </span>
<span ng-if="!user.importerror && !user.imported && user.duplicateAction != duplicateActions[0]"> <span ng-if="!user.importerror && !user.imported && user.duplicateAction != duplicateActions[0]" class="pointer">
<i class="fa fa-check-circle-o fa-lg"></i> <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>
<span ng-if="user.imported"> <span ng-if="user.imported">
<i class="fa fa-check-circle fa-lg"></i> <i class="fa fa-check-circle fa-lg"></i>
</span> </span>
<td> <td class="nobr">
{{ (currentPage - 1) * itemsPerPage + $index + 1 }} {{ (currentPage - 1) * itemsPerPage + $index + 1 }}
<td> <td>
{{ user.title }} {{ user.title }}
@ -179,6 +181,7 @@
</li> </li>
</ul> </ul>
</table> </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"