From 49e2f73df4e1d1ece1961f4d63d57cb1f4dc7c1b Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Wed, 18 Apr 2012 15:47:51 +0200 Subject: [PATCH] #92 preview for slides --- .../agenda/templates/agenda/control_item.html | 1 + openslides/config/models.py | 2 -- openslides/projector/api.py | 2 +- .../projector/default_control_slidefunc.html | 1 + .../projector/default_control_slidemodel.html | 1 + openslides/projector/urls.py | 11 +++++++++-- openslides/projector/views.py | 19 +++++++++++-------- 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/openslides/agenda/templates/agenda/control_item.html b/openslides/agenda/templates/agenda/control_item.html index 8e75bebdb..aa4d2e6c0 100644 --- a/openslides/agenda/templates/agenda/control_item.html +++ b/openslides/agenda/templates/agenda/control_item.html @@ -7,6 +7,7 @@
+ preview {% for p in slide.get_ancestors %}   {% endfor %} diff --git a/openslides/config/models.py b/openslides/config/models.py index 69cfdc2c0..f1f30ea5d 100644 --- a/openslides/config/models.py +++ b/openslides/config/models.py @@ -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 diff --git a/openslides/projector/api.py b/openslides/projector/api.py index f07d60a49..354754e07 100644 --- a/openslides/projector/api.py +++ b/openslides/projector/api.py @@ -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 diff --git a/openslides/projector/templates/projector/default_control_slidefunc.html b/openslides/projector/templates/projector/default_control_slidefunc.html index f5bab98a3..9ba95cde5 100644 --- a/openslides/projector/templates/projector/default_control_slidefunc.html +++ b/openslides/projector/templates/projector/default_control_slidefunc.html @@ -6,6 +6,7 @@
+ preview {{ slides.name }} diff --git a/openslides/projector/templates/projector/default_control_slidemodel.html b/openslides/projector/templates/projector/default_control_slidemodel.html index ff875557d..8e8e4ec37 100644 --- a/openslides/projector/templates/projector/default_control_slidemodel.html +++ b/openslides/projector/templates/projector/default_control_slidemodel.html @@ -7,6 +7,7 @@
+ preview {{ slide }} {% endfor %} diff --git a/openslides/projector/urls.py b/openslides/projector/urls.py index 04bb39708..68f00d1f6 100644 --- a/openslides/projector/urls.py +++ b/openslides/projector/urls.py @@ -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[^/]*)/$', + 'active_slide', + name='projctor_preview_slide', + ), + + url(r'^control/$', ControlView.as_view(), name='projector_control', ), diff --git a/openslides/projector/views.py b/openslides/projector/views.py index e78f09d51..5eae7293b 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -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'] = ''