Merge pull request #2820 from FinnStutzenstein/Issue2667

Change user import table
This commit is contained in:
Emanuel Schütze 2017-01-10 21:22:39 +01:00 committed by GitHub
commit 962c06c85f
3 changed files with 110 additions and 102 deletions

View File

@ -1249,6 +1249,10 @@ img {
padding-right: 0 !important;
}
.scroll-x-container {
overflow-x: auto;
}
/* user details */
.user_details fieldset {
margin-bottom: 10px;

View File

@ -963,6 +963,7 @@ angular.module('OpenSlidesApp.users.site', [
$scope.duplicates = 0;
var quotionRe = /^"(.*)"$/;
angular.forEach($scope.csv.result, function (user) {
user.selected = true;
// title
if (user.title) {
user.title = user.title.replace(quotionRe, '$1');
@ -1098,7 +1099,7 @@ angular.module('OpenSlidesApp.users.site', [
$scope.usersWillBeImported = 0;
$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++;
} else {
$scope.usersWillBeImported++;
@ -1121,7 +1122,7 @@ angular.module('OpenSlidesApp.users.site', [
// collect all needed groups and create non existing groups
var groupsToCreate = [];
_.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.
if (_.indexOf(groupsToCreate, group) == -1) {
groupsToCreate.push(group);
@ -1147,7 +1148,7 @@ angular.module('OpenSlidesApp.users.site', [
var existingUsers = User.getAll();
_.forEach($scope.users, function (user) {
if (!user.importerror) {
if (user.selected && !user.importerror) {
// Assign all groups
_.forEach(user.groups, function(csvGroup) {
allGroups.forEach(function (allGroup) {

View File

@ -77,6 +77,7 @@
<div ng-show="csv.result">
<h3 translate>Preview</h3>
<div class="scroll-x-container">
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
@ -118,13 +119,14 @@
<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 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>
<td class="nobr">
{{ (currentPage - 1) * itemsPerPage + $index + 1 }}
<td>
{{ user.title }}
@ -179,6 +181,7 @@
</li>
</ul>
</table>
</div>
<ul uib-pagination
ng-show="users.length > itemsPerPage"
total-items="users.length"