From a69ddffea593718d6f9492a37e77f54f5b8cd2f0 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 3 Mar 2012 10:47:32 +0100 Subject: [PATCH] put links in projector settings in categories --- openslides/agenda/models.py | 4 ++-- openslides/projector/models.py | 10 ++++++++ .../templates/projector/settings.html | 23 +++++++++++++++++++ openslides/projector/views.py | 7 +++++- 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 openslides/projector/templates/projector/settings.html diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 09c62c53f..65616a8dc 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -133,13 +133,13 @@ class Item(MPTTModel, SlideMixin): order_insertion_by = ['weight', 'title'] -register_slidemodel(Item) +register_slidemodel(Item, category=_('Agenda')) # TODO: put this in another file from projector.api import register_slidefunc from agenda.slides import agenda_show -register_slidefunc('agenda_show', agenda_show) +register_slidefunc('agenda_show', agenda_show, category=_('Agenda')) diff --git a/openslides/projector/models.py b/openslides/projector/models.py index b705b0473..b1c7f37fe 100644 --- a/openslides/projector/models.py +++ b/openslides/projector/models.py @@ -58,3 +58,13 @@ class Slide(object): def get_items(self): return self.model.objects.all() + + def get_dict(self): + return { + 'key': self.key, + 'category': self.category, + 'model_slide': self.model_slide, + 'func': self.func, + 'model': self.model, + 'self': self, + } diff --git a/openslides/projector/templates/projector/settings.html b/openslides/projector/templates/projector/settings.html new file mode 100644 index 000000000..83d8a5dc0 --- /dev/null +++ b/openslides/projector/templates/projector/settings.html @@ -0,0 +1,23 @@ +{% extends "base.html" %} + +{% load tags %} +{% load i18n %} + +{% block content %} +

{% trans 'Projector' %}

+ + +{% endblock %} diff --git a/openslides/projector/views.py b/openslides/projector/views.py index 44eb2a39f..47c4f9e6a 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -34,8 +34,13 @@ class SettingView(TemplateView): def get_context_data(self, **kwargs): context = super(SettingView, self).get_context_data(**kwargs) + categories = {} + for slide in SLIDE.values(): + if not categories.has_key(slide.category): + categories[slide.category] = [] + categories[slide.category].append(slide) context.update({ - 'slides': SLIDE.values(), + 'categories': categories, }) return context