projector language (closes #2653)

This commit is contained in:
FinnStutzenstein 2016-12-19 13:26:07 +01:00
parent c6fb710fb9
commit f9f64b3e31
7 changed files with 47 additions and 8 deletions

View File

@ -15,6 +15,7 @@ Agenda:
Core: Core:
- Added support for multiple projectors. - Added support for multiple projectors.
- Added control for the resolution of the projectors. - Added control for the resolution of the projectors.
- Set the projector language in the settings.
- Used pdfMake for clientside generation of PDFs. - Used pdfMake for clientside generation of PDFs.
- Introduced new table design for list views with serveral filters and - Introduced new table design for list views with serveral filters and
CSV export. CSV export.

View File

@ -107,6 +107,22 @@ def get_config_variables():
# Projector # Projector
yield ConfigVariable(
name='projector_language',
default_value='browser',
input_type='choice',
label='Projector language',
choices=(
{'value': 'browser', 'display_name': 'Current browser language'},
{'value': 'en', 'display_name': 'English'},
{'value': 'de', 'display_name': 'Deutsch'},
{'value': 'fr', 'display_name': 'Français'},
{'value': 'es', 'display_name': 'Español'},
{'value': 'pt', 'display_name': 'Português'},
{'value': 'cs', 'display_name': 'Čeština'}),
weight=148,
group='Projector')
yield ConfigVariable( yield ConfigVariable(
name='projector_enable_logo', name='projector_enable_logo',
default_value=True, default_value=True,

View File

@ -56,6 +56,29 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
} }
]) ])
.controller('LanguageCtrl', [
'$scope',
'Languages',
'Config',
'ProjectorID',
function ($scope, Languages, Config, ProjectorID) {
// for the dynamic title
$scope.projectorId = ProjectorID();
$scope.$watch(function () {
return Config.lastModified('projector_language');
}, function () {
var lang = Config.get('projector_language');
if (!lang || lang.value == 'browser') {
$scope.selectedLanguage = Languages.getBrowserLanguage();
} else {
$scope.selectedLanguage = lang.value;
}
Languages.setCurrentLanguage($scope.selectedLanguage);
});
}
])
// Projector Container Controller // Projector Container Controller
.controller('ProjectorContainerCtrl', [ .controller('ProjectorContainerCtrl', [
'$scope', '$scope',
@ -63,11 +86,8 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
'gettext', 'gettext',
'loadGlobalData', 'loadGlobalData',
'Projector', 'Projector',
'ProjectorID', function($scope, $location, gettext, loadGlobalData, Projector) {
function($scope, $location, gettext, loadGlobalData, Projector, ProjectorID) {
loadGlobalData(); loadGlobalData();
$scope.projectorId = ProjectorID();
$scope.error = ''; $scope.error = '';
// watch for changes in Projector // watch for changes in Projector

View File

@ -1473,6 +1473,8 @@ angular.module('OpenSlidesApp.core.site', [
'"static/img/logo-projector.png" in your OpenSlides data ' + '"static/img/logo-projector.png" in your OpenSlides data ' +
'path.'); 'path.');
gettext('Projector'); gettext('Projector');
gettext('Projector language');
gettext('Current browser language');
gettext('Show title and description of event on projector'); gettext('Show title and description of event on projector');
gettext('Background color of projector header and footer'); gettext('Background color of projector header and footer');
gettext('Font color of projector header and footer'); gettext('Font color of projector header and footer');

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html ng-controller="ProjectorContainerCtrl" lang="en" class="no-js"> <html lang="{{ selectedLanguage }}" ng-controller="LanguageCtrl" class="no-js">
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<base href="/"> <base href="/">
@ -13,7 +13,7 @@
<script src="static/js/openslides.js"></script> <script src="static/js/openslides.js"></script>
<script src="static/js/openslides-templates.js"></script> <script src="static/js/openslides-templates.js"></script>
<div class="pContainer"> <div class="pContainer" ng-controller="ProjectorContainerCtrl">
<div> <div>
<style> <style>
.pContainer #iframe { .pContainer #iframe {

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="no-js"> <html lang="{{ selectedLanguage }}" ng-controller="LanguageCtrl" class="no-js">
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<base href="/"> <base href="/">

View File

@ -144,7 +144,7 @@ class TestConfigDBQueries(TestCase):
TODO: The last 57 requests are a bug. TODO: The last 57 requests are a bug.
""" """
with self.assertNumQueries(62): with self.assertNumQueries(63):
self.client.get(reverse('config-list')) self.client.get(reverse('config-list'))