Automated merge with ssh://openslides.de/openslides
This commit is contained in:
commit
500b418f91
@ -139,7 +139,7 @@ register_slidemodel(Item, model_name=_('Agenda Item'))
|
||||
from projector.api import register_slidefunc
|
||||
from agenda.slides import agenda_show
|
||||
|
||||
register_slidefunc(_('Agenda'), agenda_show)
|
||||
register_slidefunc(_('Agenda'), agenda_show, weight=-1)
|
||||
|
||||
|
||||
from django.dispatch import receiver
|
||||
|
@ -1,5 +1,6 @@
|
||||
from config.models import config
|
||||
from projector import SLIDE, Slide
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
|
||||
def get_slide_from_sid(sid):
|
||||
@ -35,31 +36,36 @@ def set_active_slide(sid):
|
||||
config["presentation"] = sid
|
||||
|
||||
|
||||
def register_slidemodel(model, model_name=None):
|
||||
def register_slidemodel(model, model_name=None, control_template=None, weight=0):
|
||||
#TODO: Warn if there already is a slide with this prefix
|
||||
if model_name is None:
|
||||
model_name = model.prefix
|
||||
|
||||
if control_template is None:
|
||||
control_template = 'projector/default_control_slidemodel.html'
|
||||
|
||||
category = model.__module__.split('.')[0]
|
||||
SLIDE[model.prefix] = Slide(
|
||||
SLIDE[model_name] = Slide(
|
||||
model_slide=True,
|
||||
model=model,
|
||||
category=category,
|
||||
key=model.prefix,
|
||||
model_name=model_name,
|
||||
control_template=control_template,
|
||||
weight=weight,
|
||||
)
|
||||
|
||||
|
||||
def register_slidefunc(key, func):
|
||||
def register_slidefunc(key, func, control_template=None, weight=0):
|
||||
#TODO: Warn if there already is a slide with this prefix
|
||||
if control_template is None:
|
||||
control_template = 'projector/default_control_slidefunc.html'
|
||||
category = func.__module__.split('.')[0]
|
||||
SLIDE[key] = Slide(
|
||||
model_slide=False,
|
||||
func=func,
|
||||
category=category,
|
||||
key=key,
|
||||
control_template=control_template,
|
||||
weight=weight,
|
||||
)
|
||||
|
||||
|
||||
#def get_possible_slides():
|
||||
|
||||
|
@ -48,14 +48,15 @@ class SlideMixin(object):
|
||||
|
||||
|
||||
class Slide(object):
|
||||
def __init__(self, model_slide=False, func=None, model=None, category=None, key=None, model_name=''):
|
||||
def __init__(self, model_slide=False, func=None, model=None, category=None,
|
||||
key=None, model_name='', control_template='', weight=0):
|
||||
"""
|
||||
model_slide: Boolean if the value is a Model.
|
||||
func: The function to call. Only if modelslide is False.
|
||||
model: The model. Only if modelslide is True.
|
||||
model_name: The name shown for the model.
|
||||
category: The category to show this Slide.
|
||||
key: the key in the slide object to find myself.
|
||||
key: the key in the slide object to find itself.
|
||||
"""
|
||||
self.model_slide = model_slide
|
||||
self.func = func
|
||||
@ -63,9 +64,14 @@ class Slide(object):
|
||||
self.model_name = model_name
|
||||
self.category = category
|
||||
self.key = key
|
||||
self.control_template = control_template
|
||||
self.weight = weight
|
||||
|
||||
def get_items(self):
|
||||
return self.model.objects.all()
|
||||
try:
|
||||
return self.model.objects.all()
|
||||
except AttributeError:
|
||||
return 'No Model'
|
||||
|
||||
|
||||
@receiver(projector_messages, dispatch_uid="projector_countdown")
|
||||
|
@ -13,3 +13,5 @@
|
||||
from django.dispatch import Signal
|
||||
|
||||
projector_messages = Signal(providing_args=['register', 'call'])
|
||||
|
||||
projector_control_box = Signal()
|
||||
|
@ -55,33 +55,19 @@
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
{% for category, slides in categories.items %}
|
||||
{% for category, group in categories.items %}
|
||||
{% if category != 'projector' %}
|
||||
<div class="portlet">
|
||||
<div class="portlet-header">{{ category }}</div>
|
||||
{% with category_big=category|capfirst %}
|
||||
<div class="portlet-header">{% trans category_big %}</div>
|
||||
{% endwith %}
|
||||
<div class="portlet-content">
|
||||
{% for slide in slides %}
|
||||
{% if slide.model_slide %}
|
||||
<ul style="line-height: 180%">
|
||||
{% for slide in slide.get_items %}
|
||||
<li class="{% if slide.active %}activeline{% endif %}"><a href="{% url projector_activate_slide slide.sid %}"
|
||||
class="activate_link {% if slide.active %}active{% endif %}"
|
||||
><div></div></a>
|
||||
{% for i in slide.get_ancestors %} {% endfor %}
|
||||
<a href="{% url projector_edit_slide slide.id %}">{{ slide }}</a>
|
||||
{% if slide.children.exists %}
|
||||
<a href="{% url projector_activate_summary slide.sid %}"><img src="{% static 'images/icons/view-list-tree.png' %}" title="{% trans 'Select item overview' %}"></a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<hr>
|
||||
<ul style="line-height: 180%">
|
||||
<li><a href="{% url projector_activate_slide slide.key %}"
|
||||
class="activate_link {% if slide.active %}active{% endif %}"
|
||||
><div></div></a>{{ slide.key }}</li>
|
||||
</ul>
|
||||
{% for slides in group %}
|
||||
{% if slides.control_template %}
|
||||
{% include slides.control_template %}
|
||||
{% endif %}
|
||||
{% if not forloop.last %}
|
||||
<hr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -0,0 +1,12 @@
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
|
||||
<ul style="line-height: 180%">
|
||||
<li>
|
||||
<a href="{% url projector_activate_slide slide.key %}" class="activate_link {% if slide.active %}active{% endif %}">
|
||||
<div></div>
|
||||
</a>
|
||||
{{ slides.key }}
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -0,0 +1,14 @@
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
|
||||
<ul style="line-height: 180%">
|
||||
{% for slide in slides.get_items %}
|
||||
<li class="{% if slide.active %}activeline{% endif %}">
|
||||
<a href="{% url projector_activate_slide slide.sid %}" class="activate_link {% if slide.active %}active{% endif %}">
|
||||
<div></div>
|
||||
</a>
|
||||
<a href="{% url projector_edit_slide slide.id %}">{{ slide }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
@ -18,6 +18,8 @@ from django.core.urlresolvers import reverse
|
||||
from django.contrib import messages
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.datastructures import SortedDict
|
||||
from django.dispatch import receiver
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
|
||||
from utils.views import TemplateView, RedirectView
|
||||
@ -31,8 +33,9 @@ from config.models import config
|
||||
from api import get_active_slide, set_active_slide
|
||||
from projector import SLIDE
|
||||
from models import ProjectorMessage
|
||||
from openslides.projector.signals import projector_messages
|
||||
from openslides.projector.signals import projector_messages, projector_control_box
|
||||
|
||||
from django.utils.importlib import import_module
|
||||
import settings
|
||||
|
||||
|
||||
@ -69,12 +72,20 @@ class ControlView(TemplateView):
|
||||
categories[slide.category] = []
|
||||
categories[slide.category].append(slide)
|
||||
|
||||
ordered_categories = SortedDict()
|
||||
tmp_categories = categories
|
||||
categories = SortedDict()
|
||||
for app in settings.INSTALLED_APPS:
|
||||
if app in categories:
|
||||
ordered_categories[app] = categories[app]
|
||||
if app in tmp_categories:
|
||||
tmp_categories[app].sort(key=lambda slide: slide.weight)
|
||||
categories[app] = tmp_categories[app]
|
||||
|
||||
|
||||
## for receiver, response in projector_control_box.send(sender='ControllView'):
|
||||
## if response is not None:
|
||||
## categories[response[0]] = response[1]
|
||||
|
||||
context.update({
|
||||
'categories': ordered_categories,
|
||||
'categories': categories,
|
||||
'countdown_visible': config['countdown_visible'],
|
||||
'countdown_time': config['agenda_countdown_time'],
|
||||
'projector_messages': self.get_projector_messages(),
|
||||
@ -195,3 +206,7 @@ def register_tab(request):
|
||||
selected=selected,
|
||||
)
|
||||
|
||||
|
||||
## @receiver(projector_control_box, dispatch_uid="openslides.projector.views.projector_box")
|
||||
## def projector_box(sender, **kwargs):
|
||||
## return ('header', 'text')
|
||||
|
@ -258,9 +258,6 @@ def server_error(request, template_name='500.html'):
|
||||
|
||||
@receiver(template_manipulation, dispatch_uid="send_register_tab")
|
||||
def send_register_tab(sender, request, context, **kwargs):
|
||||
#del kwargs['signal']
|
||||
#register_tab.send(sender='register', request=request, context=context, **kwargs)
|
||||
|
||||
tabs = []
|
||||
for app in settings.INSTALLED_APPS:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user