Merge pull request #3695 from FinnStutzenstein/fixRemarks

fixed remarks from #3525 (closes #3681)
This commit is contained in:
Emanuel Schütze 2018-04-13 15:07:05 +02:00 committed by GitHub
commit a6537fb919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 90 additions and 74 deletions

View File

@ -88,7 +88,7 @@ Users:
default is now disabled [#3400].
- Hide password in change password view [#3417].
- Added a change presence view [#3496].
- New feature to send invitation emails with OpenSlides login [#3503].
- New feature to send invitation emails with OpenSlides login [#3503, #3525].
- New admin user group [#3621].
Core:

View File

@ -536,9 +536,7 @@ angular.module('OpenSlidesApp.users.site', [
.controller('UserListCtrl', [
'$scope',
'$state',
'$http',
'$q',
'ngDialog',
'UserForm',
'User',
@ -547,17 +545,17 @@ angular.module('OpenSlidesApp.users.site', [
'Projector',
'ProjectionDefault',
'Config',
'gettextCatalog',
'UserCsvExport',
'osTableFilter',
'osTableSort',
'osTablePagination',
'gettext',
'UserPdfExport',
'InvitationEmails',
'ErrorMessage',
function($scope, $state, $http, $q, ngDialog, UserForm, User, Group, PasswordGenerator,
Projector, ProjectionDefault, Config, gettextCatalog, UserCsvExport, osTableFilter,
osTableSort, osTablePagination, gettext, UserPdfExport, ErrorMessage) {
function($scope, $http, ngDialog, UserForm, User, Group, PasswordGenerator,
Projector, ProjectionDefault, Config, UserCsvExport, osTableFilter, osTableSort,
osTablePagination, gettext, UserPdfExport, InvitationEmails, ErrorMessage) {
$scope.$watch(function () {
return User.lastModified();
}, function () {
@ -757,8 +755,43 @@ angular.module('OpenSlidesApp.users.site', [
};
// Send invitation emails
$scope.sendInvitationEmails = function () {
InvitationEmails.send($scope.usersFiltered).then(function (success) {
$scope.alert = success;
$scope.isSelectMode = false;
$scope.uncheckAll();
}, function (error) {
$scope.alert = ErrorMessage.forAlert(error);
$scope.isSelectMode = false;
$scope.uncheckAll();
});
};
// Export as PDF
$scope.pdfExportUserList = function () {
UserPdfExport.exportUserList($scope.usersFiltered);
};
$scope.pdfExportUserAccessDataList = function () {
UserPdfExport.exportUserAccessDataList($scope.usersFiltered);
};
// Export as a csv file
$scope.csvExport = function () {
UserCsvExport.export($scope.usersFiltered);
};
}
])
.factory('InvitationEmails', [
'$http',
'User',
'Config',
'gettextCatalog',
function ($http, User, Config, gettextCatalog) {
return {
// Returns the request promise. If it was successfull, a nice message for
// an alert is generated and the alert-object is returned.
send: function (users) {
var user_ids = _
.chain($scope.usersFiltered)
.chain(users)
.filter(function (user) {
return user.selected;
})
@ -769,7 +802,7 @@ angular.module('OpenSlidesApp.users.site', [
var subject = gettextCatalog.getString(Config.get('users_email_subject').value);
var message = gettextCatalog.getString(Config.get('users_email_body').value);
$http.post('/rest/users/user/mass_invite_email/', {
return $http.post('/rest/users/user/mass_invite_email/', {
user_ids: user_ids,
subject: subject,
message: message,
@ -819,30 +852,13 @@ angular.module('OpenSlidesApp.users.site', [
msg = msg.replace('%user%', userString);
}
$scope.alert = {
return {
msg: msg,
type: type,
show: true,
};
$scope.isSelectMode = false;
$scope.uncheckAll();
}, function (error) {
$scope.alert = ErrorMessage.forAlert(error);
$scope.isSelectMode = false;
$scope.uncheckAll();
});
};
// Export as PDF
$scope.pdfExportUserList = function () {
UserPdfExport.exportUserList($scope.usersFiltered);
};
$scope.pdfExportUserAccessDataList = function () {
UserPdfExport.exportUserAccessDataList($scope.usersFiltered);
};
// Export as a csv file
$scope.csvExport = function () {
UserCsvExport.export($scope.usersFiltered);
},
};
}
])