Merge pull request #2797 from FinnStutzenstein/Issue2653

projector language (closes #2653)
This commit is contained in:
Norman Jäckel 2016-12-21 11:55:49 +01:00 committed by GitHub
commit 286643ddd2
7 changed files with 47 additions and 8 deletions

View File

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

View File

@ -107,6 +107,22 @@ def get_config_variables():
# 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(
name='projector_enable_logo',
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
.controller('ProjectorContainerCtrl', [
'$scope',
@ -63,11 +86,8 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
'gettext',
'loadGlobalData',
'Projector',
'ProjectorID',
function($scope, $location, gettext, loadGlobalData, Projector, ProjectorID) {
function($scope, $location, gettext, loadGlobalData, Projector) {
loadGlobalData();
$scope.projectorId = ProjectorID();
$scope.error = '';
// watch for changes in Projector

View File

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

View File

@ -1,5 +1,5 @@
<!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 http-equiv="X-UA-Compatible" content="IE=edge">
<base href="/">
@ -13,7 +13,7 @@
<script src="static/js/openslides.js"></script>
<script src="static/js/openslides-templates.js"></script>
<div class="pContainer">
<div class="pContainer" ng-controller="ProjectorContainerCtrl">
<div>
<style>
.pContainer #iframe {

View File

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

View File

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