#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 %}"> <a href="{% url projector_activate_slide slide.sid %}" class="activate_link {% if slide.active %}active{% endif %}">
<div></div> <div></div>
</a> </a>
<a href="{% url projctor_preview_slide slide.sid %}">preview</a>
{% for p in slide.get_ancestors %} {% for p in slide.get_ancestors %}
<span class="indentation">&nbsp;</span> <span class="indentation">&nbsp;</span>
{% endfor %} {% endfor %}

View File

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

View File

@ -14,7 +14,7 @@ def split_sid(sid):
return (model, id) return (model, id)
if len(data) == 1: if len(data) == 1:
try: try:
return (SLIDE[data[0]].func(), None) return (SLIDE[data[0]].key, None)
except KeyError: except KeyError:
return None return None
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 %}"> <a href="{% url projector_activate_slide slides.key %}" class="activate_link {% if slides.active %}active{% endif %}">
<div></div> <div></div>
</a> </a>
<a href="{% url projctor_preview_slide slides.key %}">preview</a>
{{ slides.name }} {{ slides.name }}
</li> </li>
</ul> </ul>

View File

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

View File

@ -21,9 +21,16 @@ from models import ProjectorSlide
urlpatterns = patterns('projector.views', urlpatterns = patterns('projector.views',
url(r'^$', 'active_slide', 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(), ControlView.as_view(),
name='projector_control', name='projector_control',
), ),

View File

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