use app name for projector category

This commit is contained in:
Oskar Hahn 2012-04-14 11:18:47 +02:00
parent e8337278a1
commit 491c65cf24
7 changed files with 27 additions and 17 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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'))

View File

@ -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,

View File

@ -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'))

View File

@ -77,14 +77,14 @@
{% for slide in slides %}
{% if slide.model_slide %}
<ul style="line-height: 180%">
{% for item in slide.get_items %}
<li class="{% if item.active %}activeline{% endif %}"><a href="{% url projector_activate_slide item.sid %}"
class="activate_link {% if item.active %}active{% endif %}"
{% 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 item.get_ancestors %}&nbsp;&nbsp;&nbsp;{% endfor %}
<a href="{% url projector_edit_slide item.id %}">{{ item }}</a>
{% if item.children.exists %}
<a href="{% url projector_activate_summary item.sid %}"><img src="/static/images/icons/view-list-tree.png" title="{% trans 'Select item overview' %}"></a>
{% for i in slide.get_ancestors %}&nbsp;&nbsp;&nbsp;{% 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 %}

View File

@ -17,6 +17,7 @@ from django.template import RequestContext
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 utils.views import TemplateView, RedirectView
@ -32,6 +33,8 @@ from projector import SLIDE
from models import ProjectorMessage
from openslides.projector.signals import projector_messages
import settings
class ControlView(TemplateView):
template_name = 'projector/control.html'
@ -44,8 +47,13 @@ class ControlView(TemplateView):
if not categories.has_key(slide.category):
categories[slide.category] = []
categories[slide.category].append(slide)
ordered_categories = SortedDict()
for app in settings.INSTALLED_APPS:
if app in categories:
ordered_categories[app] = categories[app]
context.update({
'categories': categories,
'categories': ordered_categories,
'countdown_visible': config['countdown_visible'],
'countdown_time': config['agenda_countdown_time'],
})