Show orange countdown in last x seconds of speaking time (add new config)

This commit is contained in:
Emanuel Schuetze 2016-02-21 19:46:38 +01:00
parent 647e62fb0d
commit ba49781b39
5 changed files with 67 additions and 36 deletions

View File

@ -20,45 +20,18 @@ def validate_start_time(value):
def setup_agenda_config(sender, **kwargs): def setup_agenda_config(sender, **kwargs):
""" """
Receiver function to setup all agenda config variables. They are not Receiver function to setup all agenda config variables.
grouped. This function connected to the signal This function connected to the signal openslides.core.signals.config_signal
openslides.core.signals.config_signal during app loading. 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( yield ConfigVariable(
name='agenda_number_prefix', name='agenda_number_prefix',
default_value='', default_value='',
label=ugettext_lazy('Numbering prefix for agenda items'), label=ugettext_lazy('Numbering prefix for agenda items'),
help_text=ugettext_lazy('This prefix will be set if you run the automatic agenda numbering.'), help_text=ugettext_lazy('This prefix will be set if you run the automatic agenda numbering.'),
weight=240, weight=210,
group=ugettext_lazy('Agenda'), group=ugettext_lazy('Agenda'),
subgroup=ugettext_lazy('General'),
validators=(MaxLengthValidator(20),)) validators=(MaxLengthValidator(20),))
yield ConfigVariable( yield ConfigVariable(
@ -69,8 +42,53 @@ def setup_agenda_config(sender, **kwargs):
choices=( choices=(
{'value': 'arabic', 'display_name': ugettext_lazy('Arabic')}, {'value': 'arabic', 'display_name': ugettext_lazy('Arabic')},
{'value': 'roman', 'display_name': ugettext_lazy('Roman')}), {'value': 'roman', 'display_name': ugettext_lazy('Roman')}),
weight=250, weight=215,
group=ugettext_lazy('Agenda')) 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): def listen_to_related_object_post_save(sender, instance, created, **kwargs):

View File

@ -466,6 +466,10 @@ img {
padding-right: 10px; padding-right: 10px;
} }
.col2 .countdown_timer.warning {
color: #ed940d;
}
.col2 .countdown_timer.negative { .col2 .countdown_timer.negative {
color: #CC0000; color: #CC0000;
} }

View File

@ -207,9 +207,13 @@ hr {
margin-top: 20px; margin-top: 20px;
padding-right: 5px; padding-right: 5px;
} }
.countdown.warning {
color: #ed940d;
}
.countdown.negative { .countdown.negative {
color: #CC0000; color: #CC0000;
} }
.message_background { .message_background {
background-color: #777777; background-color: #777777;
opacity: 0.8; opacity: 0.8;

View File

@ -122,7 +122,9 @@
<i class="fa fa-pause"></i> <i class="fa fa-pause"></i>
</a> </a>
<span ng-if="!editTime" class="countdown_timer vcenter" <span ng-if="!editTime" class="countdown_timer vcenter"
ng-class="{ 'negative': countdown.seconds < 0 }"> ng-class="{
'negative': countdown.seconds <= 0,
'warning': countdown.seconds <= config('agenda_countdown_warning_time') && countdown.seconds > 0 }">
{{ countdown.seconds | osSecondsToTime }} {{ countdown.seconds | osSecondsToTime }}
</span> </span>
<!-- edit countdown form --> <!-- edit countdown form -->

View File

@ -1,6 +1,9 @@
<div ng-controller="SlideCountdownCtrl"> <div ng-controller="SlideCountdownCtrl">
<div ng-if="visible"> <div ng-if="visible">
<div class="countdown well" style="margin-top: calc({{index}}*100px);" ng-class="{ 'negative': seconds < 0 }"> <div class="countdown well" style="margin-top: calc({{index}}*100px);"
ng-class="{
'negative': seconds <= 0,
'warning': seconds <= config('agenda_countdown_warning_time') && seconds > 0 }">
{{ seconds | osSecondsToTime}} {{ seconds | osSecondsToTime}}
<div class="description">{{ description }}</div> <div class="description">{{ description }}</div>
</div> </div>