Automated merge with ssh://openslides.org/openslides

This commit is contained in:
Emanuel Schuetze 2012-05-18 23:25:51 +02:00
commit 2dc156ef74
6 changed files with 73 additions and 19 deletions

View File

@ -25,7 +25,7 @@ from utils.translation_ext import ugettext as _
class ProjectorSlide(models.Model, SlideMixin): class ProjectorSlide(models.Model, SlideMixin):
prefix = 'ProjectorSlide' prefix = 'ProjectorSlide'
title = models.CharField(max_length=100, verbose_name=_("Title")) title = models.CharField(max_length=256, verbose_name=_("Title"))
text = models.TextField(null=True, blank=True, verbose_name=_("Text")) text = models.TextField(null=True, blank=True, verbose_name=_("Text"))
#weight = models.IntegerField(default=0, verbose_name=_("Weight")) #weight = models.IntegerField(default=0, verbose_name=_("Weight"))
@ -36,6 +36,11 @@ class ProjectorSlide(models.Model, SlideMixin):
'template': 'projector/ProjectorSlide.html', 'template': 'projector/ProjectorSlide.html',
} }
@models.permalink
def get_absolute_url(self, link='delete'):
if link == 'delete':
return ('customslide_delete', [str(self.id)])
def __unicode__(self): def __unicode__(self):
return self.title return self.title
@ -57,7 +62,7 @@ class ProjectorOverlay(models.Model):
return self.def_name return self.def_name
register_slidemodel(ProjectorSlide, model_name='customslide') register_slidemodel(ProjectorSlide, control_template='projector/control_customslide.html')
@receiver(default_config_value, dispatch_uid="projector_default_config") @receiver(default_config_value, dispatch_uid="projector_default_config")

View File

@ -259,8 +259,8 @@
<hr> <hr>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<a href='{% url custom_slides_new %}'> <a href='{% url customslide_new %}'>
<button class="button" type="button" onclick="window.location='{% url custom_slides_new %}'"> <button class="button" type="button" onclick="window.location='{% url customslide_new %}'">
<span class="icon add">{%trans 'New slide' %}</span> <span class="icon add">{%trans 'New slide' %}</span>
</button> </button>
</a> </a>

View File

@ -3,10 +3,10 @@
{% load tags %} {% load tags %}
{% load i18n %} {% load i18n %}
{% block title %}{{ block.super }} {%trans "New custom slide" %}{% endblock %} {% block title %}{{ block.super }} {%trans "Custom slide" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans 'New custom slide' %}</h1> <h1>{% trans 'Custom slide' %}</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<button class="button" type="submit"> <button class="button" type="submit">
@ -15,11 +15,10 @@
<button class="button" type="submit" name="apply"> <button class="button" type="submit" name="apply">
<span class="icon apply">{%trans 'Apply' %}</span> <span class="icon apply">{%trans 'Apply' %}</span>
</button> </button>
<a href='{% url item_overview %}'> <a href='{% url projector_control %}'>
<button class="button" type="button" onclick="window.location='{% url item_overview %}'"> <button class="button" type="button" onclick="window.location='{% url projector_control %}'">
<span class="icon cancel">{%trans 'Cancel' %}</span> <span class="icon cancel">{%trans 'Cancel' %}</span>
</button> </button>
</a> </a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -14,7 +14,7 @@ from django.conf.urls.defaults import *
from utils.views import CreateView from utils.views import CreateView
from views import ControlView, ActivateView from views import ControlView, ActivateView, CustomSlideCreateView, CustomSlideUpdateView, CustomSlideDeleteView
from agenda.views import ItemUpdate from agenda.views import ItemUpdate
from models import ProjectorSlide from models import ProjectorSlide
@ -47,13 +47,18 @@ urlpatterns = patterns('projector.views',
), ),
url(r'^new/$', url(r'^new/$',
CreateView.as_view( CustomSlideCreateView.as_view(),
success_url='projector_control', name='customslide_new',
model=ProjectorSlide,
template_name='projector/new.html',
permission_required='projector.can_manage_projector'
), ),
name='custom_slides_new',
url(r'^(?P<pk>\d+)/edit/$',
CustomSlideUpdateView.as_view(),
name='customslide_edit',
),
url(r'^(?P<pk>\d+)/del/$',
CustomSlideDeleteView.as_view(),
name='customslide_delete',
), ),
url(r'^bigger/$', 'projector_edit', {'direction': 'bigger'}, url(r'^bigger/$', 'projector_edit', {'direction': 'bigger'},

View File

@ -13,6 +13,7 @@
from datetime import datetime from datetime import datetime
from time import time from time import time
from django.contrib import messages
from django.shortcuts import render_to_response, redirect from django.shortcuts import render_to_response, redirect
from django.template import RequestContext from django.template import RequestContext
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
@ -23,7 +24,7 @@ from django.template.loader import render_to_string
from django.db.models import Q from django.db.models import Q
from utils.views import TemplateView, RedirectView from utils.views import TemplateView, RedirectView, CreateView, UpdateView, DeleteView
from utils.utils import template, permission_required, \ from utils.utils import template, permission_required, \
del_confirm_form, ajax_request del_confirm_form, ajax_request
from utils.template import render_block_to_string from utils.template import render_block_to_string
@ -33,7 +34,7 @@ from config.models import config
from api import get_active_slide, set_active_slide, projector_message_set, projector_message_delete, get_slide_from_sid from api import get_active_slide, set_active_slide, projector_message_set, projector_message_delete, get_slide_from_sid
from projector import SLIDE from projector import SLIDE
from models import ProjectorOverlay from models import ProjectorOverlay, ProjectorSlide
from openslides.projector.signals import projector_overlays, projector_control_box from openslides.projector.signals import projector_overlays, projector_control_box
from openslides.utils.signals import template_manipulation from openslides.utils.signals import template_manipulation
@ -115,6 +116,47 @@ class ActivateView(RedirectView):
return context return context
class CustomSlideCreateView(CreateView):
permission_required = 'agenda.can_manage_agenda'
template_name = 'projector/new.html'
model = ProjectorSlide
context_object_name = 'customslide'
success_url = 'projector_control'
apply_url = 'customslide_edit'
def get_success_url(self):
messages.success(self.request, _("Custom slide <b>%s</b> was successfully created.") % self.request.POST['title'])
if 'apply' in self.request.POST:
return reverse(self.get_apply_url(), args=[self.object.id])
return reverse(super(CreateView, self).get_success_url())
class CustomSlideUpdateView(UpdateView):
permission_required = 'projector.can_manage_projector'
template_name = 'projector/new.html'
model = ProjectorSlide
context_object_name = 'customslide'
success_url = 'projector_control'
apply_url = 'customslide_edit'
def get_success_url(self):
messages.success(self.request, _("Custom slide <b>%s</b> was successfully modified.") % self.request.POST['title'])
if 'apply' in self.request.POST:
return ''
return reverse(super(UpdateView, self).get_success_url())
class CustomSlideDeleteView(DeleteView):
permission_required = 'projector.can_manage_projector'
model = ProjectorSlide
url = 'projector_control'
def pre_post_redirect(self, request, *args, **kwargs):
self.object = self.get_object()
self.object.delete()
messages.success(request, _("Custom slide <b>%s</b> was successfully deleted.") % self.object)
@permission_required('projector.can_see_projector') @permission_required('projector.can_see_projector')
def active_slide(request, sid=None): def active_slide(request, sid=None):
""" """

View File

@ -581,6 +581,9 @@ ul.results {
.preview { .preview {
background:url("../images/icons/preview.png") no-repeat 0px 0px; background:url("../images/icons/preview.png") no-repeat 0px 0px;
} }
.delete {
background:url("../images/icons/delete.png") no-repeat 0px 0px;
}