From 491c65cf2417170cafb844dbc255ffb7bb28f56f Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 14 Apr 2012 11:18:47 +0200 Subject: [PATCH] use app name for projector category --- openslides/agenda/models.py | 5 +++-- openslides/application/models.py | 2 +- openslides/assignment/models.py | 4 +--- openslides/projector/api.py | 7 +++++-- openslides/projector/models.py | 2 +- .../projector/templates/projector/control.html | 14 +++++++------- openslides/projector/views.py | 10 +++++++++- 7 files changed, 27 insertions(+), 17 deletions(-) diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 482ad54e8..06add6519 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -27,6 +27,7 @@ from projector.api import register_slidemodel from agenda.api import is_summary from utils.translation_ext import xugettext as _ + class Item(MPTTModel, SlideMixin): """ An Agenda Item @@ -131,11 +132,11 @@ class Item(MPTTModel, SlideMixin): order_insertion_by = ['weight', 'title'] -register_slidemodel(Item, category=_('Agenda'), model_name=_('Agenda Item')) +register_slidemodel(Item, model_name=_('Agenda Item')) # TODO: put this in another file from projector.api import register_slidefunc from agenda.slides import agenda_show -register_slidefunc(_('Agenda'), agenda_show, category=_('Agenda')) +register_slidefunc(_('Agenda'), agenda_show) diff --git a/openslides/application/models.py b/openslides/application/models.py index 52bfa410b..4a31e17bf 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -494,7 +494,7 @@ class AVersion(models.Model): .filter(id__lte=self.id).count() return self._aid -register_slidemodel(Application, category=_('Applications')) +register_slidemodel(Application) class ApplicationOption(BaseOption): diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 831c7da78..c900ea8df 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -121,7 +121,7 @@ class Assignment(models.Model, SlideMixin): ('can_manage_assignment', _("Can manage assignment", fixstr=True)), ) -register_slidemodel(Assignment, category=_('Elections')) +register_slidemodel(Assignment) class AssignmentOption(BaseOption): @@ -144,5 +144,3 @@ class AssignmentPoll(BasePoll, CountInvalid, CountVotesCast, PublishPollMixin): CountInvalid.append_pollform_fields(self, fields) CountVotesCast.append_pollform_fields(self, fields) -#register_slidemodel(AssignmentPoll, category=_('Elections')) - diff --git a/openslides/projector/api.py b/openslides/projector/api.py index b21cdb09b..a3096d413 100644 --- a/openslides/projector/api.py +++ b/openslides/projector/api.py @@ -35,10 +35,12 @@ def set_active_slide(sid): config["presentation"] = sid -def register_slidemodel(model, category=None, model_name=None): +def register_slidemodel(model, model_name=None): #TODO: Warn if there already is a slide with this prefix if model_name is None: model_name = model.prefix + + category = model.__module__.split('.')[0] SLIDE[model.prefix] = Slide( model_slide=True, model=model, @@ -48,8 +50,9 @@ def register_slidemodel(model, category=None, model_name=None): ) -def register_slidefunc(key, func, category=None): +def register_slidefunc(key, func): #TODO: Warn if there already is a slide with this prefix + category = func.__module__.split('.')[0] SLIDE[key] = Slide( model_slide=False, func=func, diff --git a/openslides/projector/models.py b/openslides/projector/models.py index 150d3f3ba..4abf94518 100644 --- a/openslides/projector/models.py +++ b/openslides/projector/models.py @@ -31,5 +31,5 @@ class ProjectorMessage(models.Model): return self.def_name -register_slidemodel(ProjectorSlide, category=_('Projector'), model_name=_('Projector Slide')) +register_slidemodel(ProjectorSlide, model_name=_('Projector Slide')) diff --git a/openslides/projector/templates/projector/control.html b/openslides/projector/templates/projector/control.html index 612cbe015..1eebe4de2 100644 --- a/openslides/projector/templates/projector/control.html +++ b/openslides/projector/templates/projector/control.html @@ -77,14 +77,14 @@ {% for slide in slides %} {% if slide.model_slide %}