From 8560509aceeca8924d65829bacdc05883e5d655d Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Wed, 26 Jul 2017 14:30:43 +0200 Subject: [PATCH] Delay the projector not loaded error. --- CHANGELOG | 2 ++ openslides/core/static/js/core/projector.js | 17 +++++++++++++---- .../static/templates/projector-container.html | 4 ++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index efe9150ba..352733277 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -56,6 +56,8 @@ Core: - Highlight list entries in a light blue, if a related object is projected (e. g. a list of speakers of a motion) [#3301]. - Select the projector resolution with a slider and an aspect ratio [#3311]. +- Delay the 'could not load projector' error 3 seconds to not irritate users + with a slow internet connection [#3323] Mediafiles: - Fixed reloading of PDF on page change [#3274]. diff --git a/openslides/core/static/js/core/projector.js b/openslides/core/static/js/core/projector.js index 5b4600a29..d12459208 100644 --- a/openslides/core/static/js/core/projector.js +++ b/openslides/core/static/js/core/projector.js @@ -104,11 +104,12 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core']) // Projector Container Controller .controller('ProjectorContainerCtrl', [ '$scope', + '$timeout', '$location', 'gettext', 'Projector', - function($scope, $location, gettext, Projector) { - $scope.error = ''; + function($scope, $timeout, $location, gettext, Projector) { + $scope.showError = true; // watch for changes in Projector $scope.$watch(function () { @@ -116,12 +117,20 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core']) }, function () { var projector = Projector.get($scope.projectorId); if (projector) { - $scope.error = ''; + $scope.showError = false; $scope.projectorWidth = projector.width; $scope.projectorHeight = projector.height; $scope.recalculateIframe(); } else { - $scope.error = gettext('Can not open the projector.'); + $scope.showError = true; + // delay displaying the error message, because with a slow internet + // connection, the autoupdate with the projector may be delayed. We + // de not want to irritate the user by showing this error to early. + $timeout(function () { + if ($scope.showError) { + $scope.error = gettext('Can not open the projector.'); + } + }, 3000); } }); diff --git a/openslides/core/static/templates/projector-container.html b/openslides/core/static/templates/projector-container.html index 50c274b19..c8e917122 100644 --- a/openslides/core/static/templates/projector-container.html +++ b/openslides/core/static/templates/projector-container.html @@ -38,12 +38,12 @@ } -
+
-
+

{{ error | translate }}