Merge pull request #3496 from FinnStutzenstein/UserRegisterForm
Added presence view
This commit is contained in:
commit
21b652ec74
@ -67,6 +67,7 @@ Users:
|
|||||||
- Added option to enable updating the last_login field in the database. The
|
- Added option to enable updating the last_login field in the database. The
|
||||||
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].
|
||||||
|
|
||||||
Core:
|
Core:
|
||||||
- No reload on logoff. OpenSlides is now a full single page
|
- No reload on logoff. OpenSlides is now a full single page
|
||||||
|
@ -21,6 +21,15 @@ def get_config_variables():
|
|||||||
group='Participants',
|
group='Participants',
|
||||||
subgroup='General')
|
subgroup='General')
|
||||||
|
|
||||||
|
yield ConfigVariable(
|
||||||
|
name='users_enable_presence_view',
|
||||||
|
default_value=False,
|
||||||
|
input_type='boolean',
|
||||||
|
label='Enable participant presence view',
|
||||||
|
weight=511,
|
||||||
|
group='Participants',
|
||||||
|
subgroup='General')
|
||||||
|
|
||||||
# PDF
|
# PDF
|
||||||
|
|
||||||
yield ConfigVariable(
|
yield ConfigVariable(
|
||||||
|
@ -76,6 +76,10 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
url: '/import',
|
url: '/import',
|
||||||
controller: 'UserImportCtrl',
|
controller: 'UserImportCtrl',
|
||||||
})
|
})
|
||||||
|
.state('users.user.presence', {
|
||||||
|
url: '/presence',
|
||||||
|
controller: 'UserPresenceCtrl',
|
||||||
|
})
|
||||||
// groups
|
// groups
|
||||||
.state('users.group', {
|
.state('users.group', {
|
||||||
url: '/groups',
|
url: '/groups',
|
||||||
@ -432,7 +436,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
function (gettextCatalog, Editor, Mediafile) {
|
function (gettextCatalog, Editor, Mediafile) {
|
||||||
return {
|
return {
|
||||||
// ngDialog for user form
|
// ngDialog for user form
|
||||||
getDialog: function (user) {
|
getDialog: function () {
|
||||||
return {
|
return {
|
||||||
template: 'static/templates/users/profile-password-form.html',
|
template: 'static/templates/users/profile-password-form.html',
|
||||||
controller: 'UserProfileCtrl',
|
controller: 'UserProfileCtrl',
|
||||||
@ -474,7 +478,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
function (gettextCatalog) {
|
function (gettextCatalog) {
|
||||||
return {
|
return {
|
||||||
// ngDialog for user form
|
// ngDialog for user form
|
||||||
getDialog: function (user) {
|
getDialog: function () {
|
||||||
return {
|
return {
|
||||||
template: 'static/templates/users/profile-password-form.html',
|
template: 'static/templates/users/profile-password-form.html',
|
||||||
controller: 'UserPasswordCtrl',
|
controller: 'UserPasswordCtrl',
|
||||||
@ -536,8 +540,9 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
'gettext',
|
'gettext',
|
||||||
'UserPdfExport',
|
'UserPdfExport',
|
||||||
'ErrorMessage',
|
'ErrorMessage',
|
||||||
function($scope, $state, $http, $q, ngDialog, UserForm, User, Group, PasswordGenerator, Projector, ProjectionDefault,
|
function($scope, $state, $http, $q, ngDialog, UserForm, User, Group, PasswordGenerator,
|
||||||
Config, gettextCatalog, UserCsvExport, osTableFilter, osTableSort, gettext, UserPdfExport, ErrorMessage) {
|
Projector, ProjectionDefault, Config, gettextCatalog, UserCsvExport, osTableFilter,
|
||||||
|
osTableSort, gettext, UserPdfExport, ErrorMessage) {
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
return User.lastModified();
|
return User.lastModified();
|
||||||
}, function () {
|
}, function () {
|
||||||
@ -962,6 +967,49 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
.controller('UserPresenceCtrl', [
|
||||||
|
'$scope',
|
||||||
|
'User',
|
||||||
|
'gettextCatalog',
|
||||||
|
'ErrorMessage',
|
||||||
|
function ($scope, User, gettextCatalog, ErrorMessage) {
|
||||||
|
$scope.alert = {};
|
||||||
|
$('#userNumber').focus();
|
||||||
|
|
||||||
|
$scope.changeState = function () {
|
||||||
|
if (!$scope.number) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var enteredNumber = $scope.number.trim();
|
||||||
|
var user = _.find(User.getAll(), function (user) {
|
||||||
|
return user.number === enteredNumber;
|
||||||
|
});
|
||||||
|
if (user) {
|
||||||
|
user.is_present = !user.is_present;
|
||||||
|
User.save(user).then(function (success) {
|
||||||
|
var messageText = user.full_name + ' ' + gettextCatalog.getString('is now') + ' ';
|
||||||
|
messageText += gettextCatalog.getString(user.is_present ? 'present' : 'not present') + '.';
|
||||||
|
$scope.alert = {
|
||||||
|
msg: messageText,
|
||||||
|
show: true,
|
||||||
|
type: 'success',
|
||||||
|
};
|
||||||
|
$scope.number = '';
|
||||||
|
}, function (error) {
|
||||||
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$scope.alert = {
|
||||||
|
msg: gettextCatalog.getString('Cannot find the participant with the participant number') + ' "' + enteredNumber + '".',
|
||||||
|
show: true,
|
||||||
|
type: 'danger',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
$('#userNumber').focus();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
.controller('UserImportCtrl', [
|
.controller('UserImportCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'$http',
|
'$http',
|
||||||
@ -1653,6 +1701,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
// config strings in users/config_variables.py
|
// config strings in users/config_variables.py
|
||||||
gettext('General');
|
gettext('General');
|
||||||
gettext('Sort name of participants by');
|
gettext('Sort name of participants by');
|
||||||
|
gettext('Enable participant presence view');
|
||||||
gettext('Participants');
|
gettext('Participants');
|
||||||
gettext('Given name');
|
gettext('Given name');
|
||||||
gettext('Surname');
|
gettext('Surname');
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
<i class="fa fa-plus fa-lg"></i>
|
<i class="fa fa-plus fa-lg"></i>
|
||||||
<translate>New</translate>
|
<translate>New</translate>
|
||||||
</a>
|
</a>
|
||||||
|
<span ng-if="config('users_enable_presence_view')">
|
||||||
|
<a ui-sref="users.user.presence" os-perms="users.can_manage" class="btn btn-default btn-sm">
|
||||||
|
<i class="fa fa-barcode fa-lg"></i>
|
||||||
|
<translate>Presence</translate>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
<a ui-sref="users.group.list" os-perms="users.can_manage" class="btn btn-default btn-sm">
|
<a ui-sref="users.group.list" os-perms="users.can_manage" class="btn btn-default btn-sm">
|
||||||
<i class="fa fa-group fa-lg"></i>
|
<i class="fa fa-group fa-lg"></i>
|
||||||
<translate>Groups</translate>
|
<translate>Groups</translate>
|
||||||
|
31
openslides/users/static/templates/users/user-presence.html
Normal file
31
openslides/users/static/templates/users/user-presence.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<div class="header">
|
||||||
|
<div class="title">
|
||||||
|
<div class="submenu">
|
||||||
|
<a ui-sref="users.user.list" class="btn btn-sm btn-default">
|
||||||
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
||||||
|
<translate>Back to overview</translate>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<h1 translate>Presence</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="details">
|
||||||
|
|
||||||
|
<div uib-alert ng-show="alert.show" ng-class="'alert-' + (alert.type || 'warning')" close="alert={}">
|
||||||
|
{{ alert.msg }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form ng-submit="changeState()" class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="userNumber" translate>Enter participant number</label>
|
||||||
|
<input type="text" class="form-control" id="userNumber"
|
||||||
|
ng-model="number" ng-change="updateSuggestions()">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary" translate>
|
||||||
|
Change presence
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user