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]. default is now disabled [#3400].
- Hide password in change password view [#3417]. - Hide password in change password view [#3417].
- Added a change presence view [#3496]. - 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]. - New admin user group [#3621].
Core: Core:

View File

@ -536,9 +536,7 @@ angular.module('OpenSlidesApp.users.site', [
.controller('UserListCtrl', [ .controller('UserListCtrl', [
'$scope', '$scope',
'$state',
'$http', '$http',
'$q',
'ngDialog', 'ngDialog',
'UserForm', 'UserForm',
'User', 'User',
@ -547,17 +545,17 @@ angular.module('OpenSlidesApp.users.site', [
'Projector', 'Projector',
'ProjectionDefault', 'ProjectionDefault',
'Config', 'Config',
'gettextCatalog',
'UserCsvExport', 'UserCsvExport',
'osTableFilter', 'osTableFilter',
'osTableSort', 'osTableSort',
'osTablePagination', 'osTablePagination',
'gettext', 'gettext',
'UserPdfExport', 'UserPdfExport',
'InvitationEmails',
'ErrorMessage', 'ErrorMessage',
function($scope, $state, $http, $q, ngDialog, UserForm, User, Group, PasswordGenerator, function($scope, $http, ngDialog, UserForm, User, Group, PasswordGenerator,
Projector, ProjectionDefault, Config, gettextCatalog, UserCsvExport, osTableFilter, Projector, ProjectionDefault, Config, UserCsvExport, osTableFilter, osTableSort,
osTableSort, osTablePagination, gettext, UserPdfExport, ErrorMessage) { osTablePagination, gettext, UserPdfExport, InvitationEmails, ErrorMessage) {
$scope.$watch(function () { $scope.$watch(function () {
return User.lastModified(); return User.lastModified();
}, function () { }, function () {
@ -757,8 +755,43 @@ angular.module('OpenSlidesApp.users.site', [
}; };
// Send invitation emails // Send invitation emails
$scope.sendInvitationEmails = function () { $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 = _ var user_ids = _
.chain($scope.usersFiltered) .chain(users)
.filter(function (user) { .filter(function (user) {
return user.selected; return user.selected;
}) })
@ -769,7 +802,7 @@ angular.module('OpenSlidesApp.users.site', [
var subject = gettextCatalog.getString(Config.get('users_email_subject').value); var subject = gettextCatalog.getString(Config.get('users_email_subject').value);
var message = gettextCatalog.getString(Config.get('users_email_body').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, user_ids: user_ids,
subject: subject, subject: subject,
message: message, message: message,
@ -819,30 +852,13 @@ angular.module('OpenSlidesApp.users.site', [
msg = msg.replace('%user%', userString); msg = msg.replace('%user%', userString);
} }
$scope.alert = { return {
msg: msg, msg: msg,
type: type, type: type,
show: true, 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);
}; };
} }
]) ])