#92 preview for slides

This commit is contained in:
Oskar Hahn 2012-04-18 15:47:51 +02:00
parent 6798050ded
commit 49e2f73df4
7 changed files with 24 additions and 13 deletions

View File

@ -7,6 +7,7 @@
<a href="{% url projector_activate_slide slide.sid %}" class="activate_link {% if slide.active %}active{% endif %}">
<div></div>
</a>
<a href="{% url projctor_preview_slide slide.sid %}">preview</a>
{% for p in slide.get_ancestors %}
<span class="indentation">&nbsp;</span>
{% endfor %}

View File

@ -88,8 +88,6 @@ def default_config(sender, key, **kwargs):
}.get(key)
from django.dispatch import receiver
from django.core.urlresolvers import reverse
from django.utils.importlib import import_module

View File

@ -14,7 +14,7 @@ def split_sid(sid):
return (model, id)
if len(data) == 1:
try:
return (SLIDE[data[0]].func(), None)
return (SLIDE[data[0]].key, None)
except KeyError:
return None
return None

View File

@ -6,6 +6,7 @@
<a href="{% url projector_activate_slide slides.key %}" class="activate_link {% if slides.active %}active{% endif %}">
<div></div>
</a>
<a href="{% url projctor_preview_slide slides.key %}">preview</a>
{{ slides.name }}
</li>
</ul>

View File

@ -7,6 +7,7 @@
<a href="{% url projector_activate_slide slide.sid %}" class="activate_link {% if slide.active %}active{% endif %}">
<div></div>
</a>
<a href="{% url projctor_preview_slide slide.sid %}">preview</a>
<a href="{{ slide.get_absolute_url }}">{{ slide }}</a>
</li>
{% endfor %}

View File

@ -21,9 +21,16 @@ from models import ProjectorSlide
urlpatterns = patterns('projector.views',
url(r'^$', 'active_slide',
name='projector_show'),
{'sid': None},
name='projector_show',
),
url(r'^control$',
url(r'^preview/(?P<sid>[^/]*)/$',
'active_slide',
name='projctor_preview_slide',
),
url(r'^control/$',
ControlView.as_view(),
name='projector_control',
),

View File

@ -30,7 +30,7 @@ from utils.template import Tab
from config.models import config
from api import get_active_slide, set_active_slide, projector_message_set, projector_message_delete
from api import get_active_slide, set_active_slide, projector_message_set, projector_message_delete, get_slide_from_sid
from projector import SLIDE
from models import ProjectorOverlay
from openslides.projector.signals import projector_overlays, projector_control_box
@ -112,22 +112,25 @@ class ActivateView(RedirectView):
@permission_required('projector.can_see_projector')
def active_slide(request):
def active_slide(request, sid=None):
"""
Shows the active Slide.
"""
try:
data = get_active_slide()
except AttributeError: #TODO: It has to be an Slide.DoesNotExist
data = None
if sid is None:
try:
data = get_active_slide()
except AttributeError: #TODO: It has to be an Slide.DoesNotExist
data = None
data['ajax'] = 'on'
else:
data = get_slide_from_sid(sid)
data['ajax'] = 'off'
if data is None:
data = {
'title': config['event_name'],
'template': 'projector/default.html',
}
data['ajax'] = 'on'
data['overlays'] = []
data['overlay'] = ''