#89: Edit custom slides.
This commit is contained in:
parent
ebe5381439
commit
90787b2597
@ -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"))
|
||||||
|
|
||||||
@ -57,7 +57,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")
|
||||||
|
@ -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>
|
||||||
|
@ -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 %}
|
||||||
|
@ -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
|
||||||
from agenda.views import ItemUpdate
|
from agenda.views import ItemUpdate
|
||||||
from models import ProjectorSlide
|
from models import ProjectorSlide
|
||||||
|
|
||||||
@ -47,13 +47,12 @@ 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',
|
url(r'^(?P<pk>\d+)/edit/$',
|
||||||
permission_required='projector.can_manage_projector'
|
CustomSlideUpdateView.as_view(),
|
||||||
),
|
name='customslide_edit',
|
||||||
name='custom_slides_new',
|
|
||||||
),
|
),
|
||||||
|
|
||||||
url(r'^bigger/$', 'projector_edit', {'direction': 'bigger'},
|
url(r'^bigger/$', 'projector_edit', {'direction': 'bigger'},
|
||||||
|
@ -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
|
||||||
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
|
||||||
|
|
||||||
@ -114,6 +115,33 @@ class ActivateView(RedirectView):
|
|||||||
config['bigger'] = 100
|
config['bigger'] = 100
|
||||||
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())
|
||||||
|
|
||||||
@permission_required('projector.can_see_projector')
|
@permission_required('projector.can_see_projector')
|
||||||
def active_slide(request, sid=None):
|
def active_slide(request, sid=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user