Automated merge with ssh://openslides.org/openslides
This commit is contained in:
commit
2dc156ef74
@ -25,7 +25,7 @@ from utils.translation_ext import ugettext as _
|
||||
class ProjectorSlide(models.Model, SlideMixin):
|
||||
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"))
|
||||
#weight = models.IntegerField(default=0, verbose_name=_("Weight"))
|
||||
|
||||
@ -36,6 +36,11 @@ class ProjectorSlide(models.Model, SlideMixin):
|
||||
'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):
|
||||
return self.title
|
||||
|
||||
@ -57,7 +62,7 @@ class ProjectorOverlay(models.Model):
|
||||
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")
|
||||
|
@ -259,8 +259,8 @@
|
||||
<hr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<a href='{% url custom_slides_new %}'>
|
||||
<button class="button" type="button" onclick="window.location='{% url custom_slides_new %}'">
|
||||
<a href='{% url customslide_new %}'>
|
||||
<button class="button" type="button" onclick="window.location='{% url customslide_new %}'">
|
||||
<span class="icon add">{%trans 'New slide' %}</span>
|
||||
</button>
|
||||
</a>
|
||||
|
@ -3,10 +3,10 @@
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{{ block.super }} – {%trans "New custom slide" %}{% endblock %}
|
||||
{% block title %}{{ block.super }} – {%trans "Custom slide" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{% trans 'New custom slide' %}</h1>
|
||||
<h1>{% trans 'Custom slide' %}</h1>
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button class="button" type="submit">
|
||||
@ -15,11 +15,10 @@
|
||||
<button class="button" type="submit" name="apply">
|
||||
<span class="icon apply">{%trans 'Apply' %}</span>
|
||||
</button>
|
||||
<a href='{% url item_overview %}'>
|
||||
<button class="button" type="button" onclick="window.location='{% url item_overview %}'">
|
||||
<a href='{% url projector_control %}'>
|
||||
<button class="button" type="button" onclick="window.location='{% url projector_control %}'">
|
||||
<span class="icon cancel">{%trans 'Cancel' %}</span>
|
||||
</button>
|
||||
</a>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -14,7 +14,7 @@ from django.conf.urls.defaults import *
|
||||
|
||||
from utils.views import CreateView
|
||||
|
||||
from views import ControlView, ActivateView
|
||||
from views import ControlView, ActivateView, CustomSlideCreateView, CustomSlideUpdateView, CustomSlideDeleteView
|
||||
from agenda.views import ItemUpdate
|
||||
from models import ProjectorSlide
|
||||
|
||||
@ -47,13 +47,18 @@ urlpatterns = patterns('projector.views',
|
||||
),
|
||||
|
||||
url(r'^new/$',
|
||||
CreateView.as_view(
|
||||
success_url='projector_control',
|
||||
model=ProjectorSlide,
|
||||
template_name='projector/new.html',
|
||||
permission_required='projector.can_manage_projector'
|
||||
),
|
||||
name='custom_slides_new',
|
||||
CustomSlideCreateView.as_view(),
|
||||
name='customslide_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'},
|
||||
|
@ -13,6 +13,7 @@
|
||||
from datetime import datetime
|
||||
from time import time
|
||||
|
||||
from django.contrib import messages
|
||||
from django.shortcuts import render_to_response, redirect
|
||||
from django.template import RequestContext
|
||||
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 utils.views import TemplateView, RedirectView
|
||||
from utils.views import TemplateView, RedirectView, CreateView, UpdateView, DeleteView
|
||||
from utils.utils import template, permission_required, \
|
||||
del_confirm_form, ajax_request
|
||||
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 projector import SLIDE
|
||||
from models import ProjectorOverlay
|
||||
from models import ProjectorOverlay, ProjectorSlide
|
||||
from openslides.projector.signals import projector_overlays, projector_control_box
|
||||
from openslides.utils.signals import template_manipulation
|
||||
|
||||
@ -115,6 +116,47 @@ class ActivateView(RedirectView):
|
||||
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')
|
||||
def active_slide(request, sid=None):
|
||||
"""
|
||||
|
@ -581,6 +581,9 @@ ul.results {
|
||||
.preview {
|
||||
background:url("../images/icons/preview.png") no-repeat 0px 0px;
|
||||
}
|
||||
.delete {
|
||||
background:url("../images/icons/delete.png") no-repeat 0px 0px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user