Show a defined value of last speakers
Some work on the design of the speaker-list on the projector
This commit is contained in:
parent
0b85164b84
commit
52e16d2e34
@ -161,17 +161,24 @@ class Item(MPTTModel, SlideMixin):
|
||||
speaker_query = Speaker.objects.filter(item=self)
|
||||
|
||||
coming_speakers = speaker_query.filter(begin_time=None).order_by('weight')
|
||||
old_speakers = speaker_query.exclude(begin_time=None).exclude(end_time=None).order_by('end_time')
|
||||
|
||||
old_speakers_count = config['agenda_show_last_speakers']
|
||||
if old_speakers_count > 0:
|
||||
old_speakers = speaker_query.exclude(end_time=None)
|
||||
old_speakers = old_speakers[max(0, old_speakers.count()) - old_speakers_count:]
|
||||
else:
|
||||
old_speakers = speaker_query.none()
|
||||
|
||||
try:
|
||||
actual_speaker = speaker_query.filter(end_time=None).exclude(begin_time=None).get()
|
||||
except Speaker.DoesNotExist:
|
||||
actual_speaker = None
|
||||
slice_items = max(0, old_speakers.count()-2)
|
||||
speakers = list(old_speakers) + [actual_speaker] + list(coming_speakers)
|
||||
data = {'title': self.get_title(),
|
||||
'template': 'projector/agenda_list_of_speaker.html',
|
||||
'coming_speakers': coming_speakers,
|
||||
'old_speakers': old_speakers[slice_items:],
|
||||
'actual_speaker': actual_speaker}
|
||||
'speakers': speakers,
|
||||
'actual_speaker': actual_speaker,
|
||||
'old_speakers_count': -(old_speakers_count + 1)}
|
||||
elif self.related_sid:
|
||||
data = self.get_related_slide().slide()
|
||||
else:
|
||||
|
@ -12,11 +12,11 @@
|
||||
|
||||
from django.dispatch import receiver
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||
from django.utils.translation import ugettext_lazy, ugettext_noop, ugettext as _
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
from openslides.config.signals import config_signal
|
||||
from openslides.config.api import ConfigVariable, ConfigPage
|
||||
from openslides.config.api import ConfigVariable, ConfigPage, config
|
||||
|
||||
from openslides.projector.signals import projector_overlays
|
||||
from openslides.projector.projector import Overlay
|
||||
@ -40,8 +40,15 @@ def setup_agenda_config_page(sender, **kwargs):
|
||||
form_field=forms.CharField(
|
||||
widget=forms.DateTimeInput(format='%d.%m.%Y %H:%M'),
|
||||
required=False,
|
||||
label=ugettext_lazy('Begin of event'),
|
||||
help_text=ugettext_lazy('Input format: DD.MM.YYYY HH:MM')))
|
||||
label=_('Begin of event'),
|
||||
help_text=_('Input format: DD.MM.YYYY HH:MM')))
|
||||
|
||||
agenda_show_last_speakers = ConfigVariable(
|
||||
name='agenda_show_last_speakers',
|
||||
default_value=0,
|
||||
form_field=forms.IntegerField(
|
||||
min_value=0,
|
||||
label=_('Number of last speakers, to show on the projector')))
|
||||
|
||||
extra_stylefiles = ['styles/timepicker.css', 'styles/jquery-ui/jquery-ui.custom.min.css']
|
||||
extra_javascript = ['javascript/jquery-ui.custom.min.js',
|
||||
@ -53,7 +60,7 @@ def setup_agenda_config_page(sender, **kwargs):
|
||||
url='agenda',
|
||||
required_permission='config.can_manage',
|
||||
weight=20,
|
||||
variables=(agenda_start_event_date_time,),
|
||||
variables=(agenda_start_event_date_time, agenda_show_last_speakers),
|
||||
extra_context={'extra_stylefiles': extra_stylefiles,
|
||||
'extra_javascript': extra_javascript})
|
||||
|
||||
@ -80,8 +87,27 @@ def agenda_list_of_speakers(sender, **kwargs):
|
||||
# Only show list of speakers on Agenda-Items
|
||||
return None
|
||||
clear_projector_cache()
|
||||
speakers = Speaker.objects.filter(begin_time=None, item=slide)[:5]
|
||||
context = {'speakers': speakers}
|
||||
|
||||
speaker_query = Speaker.objects.filter(item=slide)
|
||||
try:
|
||||
actual_speaker = speaker_query.filter(end_time=None).exclude(begin_time=None).get()
|
||||
except Speaker.DoesNotExist:
|
||||
actual_speaker = None
|
||||
|
||||
coming_speakers = speaker_query.filter(begin_time=None)[:5]
|
||||
|
||||
old_speakers_count = config['agenda_show_last_speakers']
|
||||
if old_speakers_count > 0:
|
||||
old_speakers = speaker_query.exclude(end_time=None)
|
||||
old_speakers = old_speakers[max(0, old_speakers.count()) - old_speakers_count:]
|
||||
else:
|
||||
old_speakers = speaker_query.none()
|
||||
|
||||
speakers = list(old_speakers) + [actual_speaker] + list(coming_speakers)
|
||||
context = {
|
||||
'actual_speaker': actual_speaker,
|
||||
'speakers': speakers,
|
||||
'old_speakers_count': -(old_speakers_count + 1)}
|
||||
return render_to_string('agenda/overlay_speaker_projector.html', context)
|
||||
|
||||
return Overlay(name, get_widget_html, get_projector_html)
|
||||
|
@ -1,13 +1,57 @@
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
<style type="text/css">
|
||||
#overlay_list_of_speaker_box {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border-radius: 0.4em;
|
||||
border: 0.1em solid #777777;
|
||||
background-color: #cccccc;
|
||||
opacity: 0.9;
|
||||
padding: 0 .5em;
|
||||
margin: 1em;
|
||||
z-index: 2;
|
||||
width: 30%;
|
||||
min-width: 200px;
|
||||
}
|
||||
#overlay_list_of_speaker_box h3 {
|
||||
margin: 5px;
|
||||
}
|
||||
#overlay_list_of_speaker_box ul {
|
||||
list-style-type: None;
|
||||
padding-left: 0;
|
||||
margin: 5px;
|
||||
}
|
||||
#overlay_list_of_speaker_box li {
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
#overlay_list_of_speaker_box li span.number {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 1.3em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="overlay_list_of_speaker_box">
|
||||
{% if speakers %}
|
||||
<h3>{% trans "List of speakers" %}:</h3>
|
||||
<ol>
|
||||
<ul>
|
||||
{% for speaker in speakers %}
|
||||
<li>{{ speaker }}</li>
|
||||
<li>
|
||||
{% if speaker == actual_speaker %}
|
||||
<span class="number">→</span><strong>
|
||||
{% else %}
|
||||
<span class="number">{{ forloop.counter|addition:old_speakers_count }}</span>
|
||||
{% endif %}
|
||||
<span class="name">{{ speaker }}</span>
|
||||
{% if speaker == actual_speaker %}
|
||||
</strong>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</ul>
|
||||
{% else %}
|
||||
<i>{% trans 'The list of speakers is empty.' %}</i>
|
||||
{% endif %}
|
||||
|
@ -1,6 +1,7 @@
|
||||
{% extends 'base-projector.html' %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
{% block title %}{{ block.super }} – {{ item }}{% endblock %}
|
||||
|
||||
@ -10,22 +11,36 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block scrollcontent %}
|
||||
{% if old_speakers|length > 0 or actual_speaker %}
|
||||
<ul class="list_of_speakers last_speakers">
|
||||
{% for speaker in old_speakers %}
|
||||
<li>{{ speaker }}</li>
|
||||
{% endfor %}
|
||||
<li>{{ actual_speaker }} – {% trans 'Actual Speaker' %}</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if coming_speakers %}
|
||||
<ol class="list_of_speakers">
|
||||
{% for speaker in coming_speakers %}
|
||||
<li>{{ speaker }}</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<style type="text/css">
|
||||
ul#list_of_speakers {
|
||||
list-style-type: None;
|
||||
}
|
||||
#overlay_list_of_speaker_box li {
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
#overlay_list_of_speaker_box li span.number {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 1.3em;
|
||||
}
|
||||
</style>
|
||||
{% if speakers %}
|
||||
<ul id="list_of_speakers">
|
||||
{% for speaker in speakers %}
|
||||
<li>
|
||||
{% if speaker == actual_speaker %}
|
||||
<span class="number">→</span><strong>
|
||||
{% else %}
|
||||
<p><i>{% trans 'The list of speakers is empty.' %}</i></p>
|
||||
<span class="number">{{ forloop.counter|addition:old_speakers_count }}</span>
|
||||
{% endif %}
|
||||
<span class="name">{{ speaker }}</span>
|
||||
{% if speaker == actual_speaker %}
|
||||
</strong>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<i>{% trans 'The list of speakers is empty.' %}</i>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -73,19 +73,6 @@ body{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#overlay_list_of_speaker_box {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border-radius: 0.4em;
|
||||
border: 0.1em solid #777777;
|
||||
background-color: #cccccc;
|
||||
opacity: 0.9;
|
||||
padding: 0 1em;
|
||||
margin: 1em;
|
||||
z-index: 2;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
/*** CONTENT ***/
|
||||
#contentwrapper {
|
||||
|
@ -27,6 +27,11 @@ def get_config(key):
|
||||
return config[key]
|
||||
|
||||
|
||||
@register.filter
|
||||
def addition(value, add):
|
||||
return int(value) + int(add)
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def active(request, pattern):
|
||||
if request.path.startswith(pattern):
|
||||
|
Loading…
Reference in New Issue
Block a user