StartUp improvements

This commit is contained in:
FinnStutzenstein 2017-01-15 10:51:14 +01:00
parent e9e0280a13
commit bd0073d2f7
7 changed files with 45 additions and 27 deletions

View File

@ -195,7 +195,6 @@ OpenSlides uses the following projects or parts of them:
* `angular-formly <http://formly-js.github.io/angular-formly/>`_, License: MIT
* `angular-formly-templates-bootstrap <https://github.com/formly-js/angular-formly-templates-bootstrap>`_, License: MIT
* `angular-gettext <http://angular-gettext.rocketeer.be/>`_, License: MIT
* `angular-loading-bar <https://chieffancypants.github.io/angular-loading-bar>`_, License: MIT
* `angular-messages <http://angularjs.org>`_, License: MIT
* `pdfmake <https://github.com/bpampuch/pdfmake>`_, License: MIT
* `angular-pdf <http://github.com/sayanee/angularjs-pdf>`_, License: MIT

View File

@ -13,7 +13,6 @@
"angular-formly": "~8.4.0",
"angular-formly-templates-bootstrap": "~6.2.0",
"angular-gettext": "~2.3.7",
"angular-loading-bar": "~0.9.0",
"angular-messages": "~1.5.8",
"angular-pdf": "~1.3.0",
"angular-sanitize": "~1.5.8",

View File

@ -130,22 +130,31 @@ img {
}
#startup-overlay {
display: table;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #fff;
z-index: 900;
}
#spinner-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
max-height: 356px;
z-index: 1000;
}
#startup-overlay h1 {
#spinner-container div {
width: 100%;
position: absolute;
bottom: 0;
font-size: 56px;
text-align: center;
}
#startup-overlay > div {
display: table-cell;
vertical-align: middle;
color: #317796;
}
/** Header **/

View File

@ -8,7 +8,6 @@ angular.module('OpenSlidesApp.core.site', [
'OpenSlidesApp.core.start',
'OpenSlidesApp.poll.majority',
'ui.router',
'angular-loading-bar',
'colorpicker.module',
'formly',
'formlyBootstrap',

View File

@ -13,7 +13,7 @@ angular.module('OpenSlidesApp.core.start', [])
'Group',
'mainMenu',
function($http, $rootScope, $state, autoupdate, operator, Group, mainMenu) {
$rootScope.startupWaitingEnabled = true;
$rootScope.openslidesBootstrapDone = false;
$http.get('/users/whoami/').success(function(data) {
$rootScope.guest_enabled = data.guest_enabled;
if (data.user_id === null && !data.guest_enabled) {
@ -25,7 +25,7 @@ angular.module('OpenSlidesApp.core.start', [])
operator.setUser(data.user_id, data.user);
$rootScope.operator = operator;
mainMenu.updateMainMenu();
$rootScope.startupWaitingEnabled = false;
$rootScope.openslidesBootstrapDone = true;
});
}
});

View File

@ -18,11 +18,10 @@
<div id="wrapper" ng-cloak>
<!-- please wait -->
<div id="startup-overlay" ng-if="startupWaitingEnabled">
<div>
<h1><i class="fa fa-spinner fa-pulse"></i></h1>
</div>
<div id="spinner-container" ng-if="!openslidesBootstrapDone">
<div><i class="fa fa-spinner fa-pulse"></i></div>
</div>
<div id="startup-overlay" ng-if="!openslidesBootstrapDone"></div>
<!-- Header -->
<div id="header">
@ -177,7 +176,7 @@
<div class="containerOS">
<div class="col1" ng-class="isProjectorSidebar ? 'min' : 'max'">
<!-- dynamic views -->
<div ui-view></div>
<div ui-view ng-if="openslidesBootstrapDone"></div>
<!-- footer -->
<div id="footer">
&copy; Copyright by <a href="http://www.openslides.org" target="_blank">OpenSlides</a> |

View File

@ -116,7 +116,10 @@ angular.module('OpenSlidesApp.users.site', [
.state('login', {
template: null,
url: '/login',
params: { guest_enabled: false },
params: {
guest_enabled: false,
msg: null,
},
onEnter: ['$state', '$stateParams', 'ngDialog', function($state, $stateParams, ngDialog) {
ngDialog.open({
template: 'static/templates/core/login-form.html',
@ -1118,7 +1121,7 @@ angular.module('OpenSlidesApp.users.site', [
$scope.groups.forEach(function (group) {
if ((_.indexOf(group.permissions, 'users.can_see_name') > -1) &&
(_.indexOf(group.permissions, 'users.can_manage') > -1)){
if (!operator.user || operator.isInGroup(group)){
if (operator.isInGroup(group)){
groups_danger.push(group);
}
}
@ -1351,9 +1354,21 @@ angular.module('OpenSlidesApp.users.site', [
'autoupdate',
'mainMenu',
'DS',
function ($rootScope, $scope, $http, $state, $stateParams, $q, operator, gettext, autoupdate, mainMenu, DS) {
'ngDialog',
function ($rootScope, $scope, $http, $state, $stateParams, $q, operator, gettext,
autoupdate, mainMenu, DS, ngDialog) {
$scope.alerts = [];
if ($stateParams.msg) {
$scope.alerts.push({
type: 'danger',
msg: $stateParams.msg,
});
}
// check if guest login is allowed
$scope.guestAllowed = $rootScope.guest_enabled;
// get login info-text from server
$http.get('/users/login/').success(function(data) {
if(data.info_text) {
@ -1375,10 +1390,9 @@ angular.module('OpenSlidesApp.users.site', [
$scope.closeAlert = function(index) {
$scope.alerts.splice(index, 1);
};
// check if guest login is allowed
$scope.guestAllowed = $rootScope.guest_enabled;
// login
$scope.login = function () {
$scope.closeThisDialog();
$scope.alerts = [];
var data = { 'username': $scope.username, 'password': $scope.password };
if (!navigator.cookieEnabled) {
@ -1396,16 +1410,14 @@ angular.module('OpenSlidesApp.users.site', [
operator.setUser(response.data.user_id, response.data.user);
$rootScope.operator = operator;
mainMenu.updateMainMenu();
$scope.closeThisDialog();
$state.go('home');
$rootScope.startupWaitingEnabled = false;
$rootScope.openslidesBootstrapDone = true;
});
},
function (response) {
function (error) {
// Error: Username or password is not correct.
$scope.alerts.push({
type: 'danger',
msg: response.data.detail
$state.transitionTo($state.current, {msg: error.data.detail}, {
reload: true, inherit: false, notify: true
});
}
);
@ -1413,6 +1425,7 @@ angular.module('OpenSlidesApp.users.site', [
// guest login
$scope.guestLogin = function () {
$scope.closeThisDialog();
$state.go('home');
};
}
])