From ba49781b39556a4bff96434264651fbb61ca9d6e Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sun, 21 Feb 2016 19:46:38 +0100 Subject: [PATCH] Show orange countdown in last x seconds of speaking time (add new config) --- openslides/agenda/signals.py | 86 +++++++++++-------- openslides/core/static/css/app.css | 4 + openslides/core/static/css/projector.css | 4 + .../templates/core/projector-controls.html | 4 +- .../templates/core/slide_countdown.html | 5 +- 5 files changed, 67 insertions(+), 36 deletions(-) diff --git a/openslides/agenda/signals.py b/openslides/agenda/signals.py index b91a5f8e1..63c309be3 100644 --- a/openslides/agenda/signals.py +++ b/openslides/agenda/signals.py @@ -20,45 +20,18 @@ def validate_start_time(value): def setup_agenda_config(sender, **kwargs): """ - Receiver function to setup all agenda config variables. They are not - grouped. This function connected to the signal - openslides.core.signals.config_signal during app loading. + Receiver function to setup all agenda config variables. + This function connected to the signal openslides.core.signals.config_signal + during app loading. """ - # TODO: Use an input type with generic datetime support. - yield ConfigVariable( - name='agenda_start_event_date_time', - default_value='', - label=ugettext_lazy('Begin of event'), - help_text=ugettext_lazy('Input format: DD.MM.YYYY HH:MM'), - weight=210, - group=ugettext_lazy('Agenda'), - validators=(validate_start_time,)) - - yield ConfigVariable( - name='agenda_show_last_speakers', - default_value=1, - input_type='integer', - label=ugettext_lazy('Number of last speakers to be shown on the projector'), - weight=220, - group=ugettext_lazy('Agenda'), - validators=(MinValueValidator(0),)) - - yield ConfigVariable( - name='agenda_couple_countdown_and_speakers', - default_value=False, - input_type='boolean', - label=ugettext_lazy('Couple countdown with the list of speakers'), - help_text=ugettext_lazy('[Begin speech] starts the countdown, [End speech] stops the countdown.'), - weight=230, - group=ugettext_lazy('Agenda')) - yield ConfigVariable( name='agenda_number_prefix', default_value='', label=ugettext_lazy('Numbering prefix for agenda items'), help_text=ugettext_lazy('This prefix will be set if you run the automatic agenda numbering.'), - weight=240, + weight=210, group=ugettext_lazy('Agenda'), + subgroup=ugettext_lazy('General'), validators=(MaxLengthValidator(20),)) yield ConfigVariable( @@ -69,8 +42,53 @@ def setup_agenda_config(sender, **kwargs): choices=( {'value': 'arabic', 'display_name': ugettext_lazy('Arabic')}, {'value': 'roman', 'display_name': ugettext_lazy('Roman')}), - weight=250, - group=ugettext_lazy('Agenda')) + weight=215, + group=ugettext_lazy('Agenda'), + subgroup=ugettext_lazy('General')) + + # TODO: Use an input type with generic datetime support. + yield ConfigVariable( + name='agenda_start_event_date_time', + default_value='', + label=ugettext_lazy('Begin of event'), + help_text=ugettext_lazy('Input format: DD.MM.YYYY HH:MM'), + weight=220, + group=ugettext_lazy('Agenda'), + subgroup=ugettext_lazy('General'), + validators=(validate_start_time,)) + + # List of speakers + + yield ConfigVariable( + name='agenda_show_last_speakers', + default_value=1, + input_type='integer', + label=ugettext_lazy('Number of last speakers to be shown on the projector'), + weight=230, + group=ugettext_lazy('Agenda'), + subgroup=ugettext_lazy('List of speakers'), + validators=(MinValueValidator(0),)) + + yield ConfigVariable( + name='agenda_countdown_warning_time', + default_value=0, + input_type='integer', + label=ugettext_lazy('Show orange countdown in the last x seconds of speaking time'), + help_text=ugettext_lazy('Enter duration in seconds. Choose 0 to disable warning color.'), + weight=235, + group=ugettext_lazy('Agenda'), + subgroup=ugettext_lazy('List of speakers'), + validators=(MinValueValidator(0),)) + + yield ConfigVariable( + name='agenda_couple_countdown_and_speakers', + default_value=False, + input_type='boolean', + label=ugettext_lazy('Couple countdown with the list of speakers'), + help_text=ugettext_lazy('[Begin speech] starts the countdown, [End speech] stops the countdown.'), + weight=240, + group=ugettext_lazy('Agenda'), + subgroup=ugettext_lazy('List of speakers')) def listen_to_related_object_post_save(sender, instance, created, **kwargs): diff --git a/openslides/core/static/css/app.css b/openslides/core/static/css/app.css index c229a6f9f..4bd284e9e 100644 --- a/openslides/core/static/css/app.css +++ b/openslides/core/static/css/app.css @@ -466,6 +466,10 @@ img { padding-right: 10px; } +.col2 .countdown_timer.warning { + color: #ed940d; +} + .col2 .countdown_timer.negative { color: #CC0000; } diff --git a/openslides/core/static/css/projector.css b/openslides/core/static/css/projector.css index ef187c35d..5b5abbc11 100644 --- a/openslides/core/static/css/projector.css +++ b/openslides/core/static/css/projector.css @@ -207,9 +207,13 @@ hr { margin-top: 20px; padding-right: 5px; } +.countdown.warning { + color: #ed940d; +} .countdown.negative { color: #CC0000; } + .message_background { background-color: #777777; opacity: 0.8; diff --git a/openslides/core/static/templates/core/projector-controls.html b/openslides/core/static/templates/core/projector-controls.html index edf860445..cebc7f7b6 100644 --- a/openslides/core/static/templates/core/projector-controls.html +++ b/openslides/core/static/templates/core/projector-controls.html @@ -122,7 +122,9 @@ + ng-class="{ + 'negative': countdown.seconds <= 0, + 'warning': countdown.seconds <= config('agenda_countdown_warning_time') && countdown.seconds > 0 }"> {{ countdown.seconds | osSecondsToTime }} diff --git a/openslides/core/static/templates/core/slide_countdown.html b/openslides/core/static/templates/core/slide_countdown.html index 6fcb54ad3..aa4dd5449 100644 --- a/openslides/core/static/templates/core/slide_countdown.html +++ b/openslides/core/static/templates/core/slide_countdown.html @@ -1,6 +1,9 @@
-
+
{{ seconds | osSecondsToTime}}
{{ description }}