Fixed #403: Moved projector control icons into projector live widget (Added RequestContext to check perms in template.)

This commit is contained in:
Emanuel Schuetze 2012-11-17 20:59:30 +01:00
parent f1fb68a569
commit 71eb529adf
3 changed files with 31 additions and 21 deletions

View File

@ -15,27 +15,6 @@
{% block content %} {% block content %}
<h1>{% trans 'Dashboard' %}</h1> <h1>{% trans 'Dashboard' %}</h1>
{% if perms.projector.can_manage_projector %}
<div style="text-align: right; padding: 0 10px 5px 0; margin-top:-20px;">
<!-- control projector view -->
{% trans "Adjust projector view" %}:
<a class="projector_edit" href="{% url projector_bigger %}" title="{% trans 'Zoom in' %}">
<img src="{% static 'images/icons/zoom-in.png' %}" />
</a>
<a class="projector_edit" href="{% url projector_smaller %}" title="{% trans 'Zoom out' %}">
<img src="{% static 'images/icons/zoom-out.png' %}" />
</a>
<a class="projector_edit" href="{% url projector_up %}" title="{% trans 'Scroll text up' %}">
<img src="{% static 'images/icons/go-up.png' %}" />
</a>
<a class="projector_edit" href="{% url projector_down %}" title="{% trans 'Scroll text down' %}">
<img src="{% static 'images/icons/go-down.png' %}" />
</a>
<a class="projector_edit" href="{% url projector_clean %}" title="{% trans 'Reset projector view' %}">
<img src="{% static 'images/icons/view-reset.png' %}" />
</a>
</div>
{% endif %}
<div class="column" id="col1"> <div class="column" id="col1">
{% for name, widget in widgets.items %} {% for name, widget in widgets.items %}

View File

@ -1,7 +1,36 @@
{% load i18n %} {% load i18n %}
{% load tags %} {% load tags %}
{% load staticfiles %}
<!-- projector control buttons -->
{% if perms.projector.can_manage_projector %}
<div style="float: right;">
<p>
<a class="projector_edit" href="{% url projector_bigger %}" title="{% trans 'Zoom in' %}">
<img src="{% static 'images/icons/zoom-in.png' %}" />
</a><br>
<a class="projector_edit" href="{% url projector_smaller %}" title="{% trans 'Zoom out' %}">
<img src="{% static 'images/icons/zoom-out.png' %}" />
</a>
</p>
<p>
<a class="projector_edit" href="{% url projector_up %}" title="{% trans 'Scroll text up' %}">
<img src="{% static 'images/icons/go-up.png' %}" />
</a><br>
<a class="projector_edit" href="{% url projector_down %}" title="{% trans 'Scroll text down' %}">
<img src="{% static 'images/icons/go-down.png' %}" />
</a>
</p>
<p>
<a class="projector_edit" href="{% url projector_clean %}" title="{% trans 'Reset projector view' %}">
<img src="{% static 'images/icons/view-reset.png' %}" />
</a>
</p>
</div>
{% endif %}
<!-- projector view -->
<a href="{% url projector_show %}" target="_blank"> <a href="{% url projector_show %}" target="_blank">
<div id="iframewrapper"> <div id="iframewrapper">
<iframe id="iframe" src="{% url projector_show %}" frameborder="0"></iframe> <iframe id="iframe" src="{% url projector_show %}" frameborder="0"></iframe>

View File

@ -22,6 +22,7 @@ from django.db import transaction
from django.db.models import Q from django.db.models import Q
from django.dispatch import receiver from django.dispatch import receiver
from django.shortcuts import redirect from django.shortcuts import redirect
from django.template import RequestContext
from django.utils.datastructures import SortedDict from django.utils.datastructures import SortedDict
from django.utils.importlib import import_module from django.utils.importlib import import_module
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -410,6 +411,7 @@ def get_widgets(request):
name='live_view', name='live_view',
display_name=_('Projector live view'), display_name=_('Projector live view'),
template='projector/live_view_widget.html', template='projector/live_view_widget.html',
context = RequestContext(request, {}),
permission_required='projector.can_see_projector', permission_required='projector.can_see_projector',
default_column=2)) default_column=2))