Added motion widget and deletion of motions
This commit is contained in:
parent
0f7d0e349c
commit
1518543a9a
@ -1 +1,3 @@
|
||||
import openslides.motion.signals
|
||||
import openslides.motion.slides
|
||||
|
||||
|
@ -54,7 +54,7 @@ class Motion(SlideMixin, models.Model):
|
||||
"""
|
||||
The Motion-Model.
|
||||
"""
|
||||
prefix = "motion" # Rename this in the slide-system
|
||||
prefix = "motion"
|
||||
|
||||
# TODO: Use this attribute for the default_version, if the permission system
|
||||
# is deactivated. Maybe it has to be renamed.
|
||||
@ -278,7 +278,10 @@ class Motion(SlideMixin, models.Model):
|
||||
"""
|
||||
Get the state of this motion. Return a State object.
|
||||
"""
|
||||
return get_state(self.state_id)
|
||||
try:
|
||||
return get_state(self.state_id)
|
||||
except WorkflowError:
|
||||
return None
|
||||
|
||||
def set_state(self, next_state):
|
||||
"""
|
||||
|
4
openslides/motion/slides.py
Normal file
4
openslides/motion/slides.py
Normal file
@ -0,0 +1,4 @@
|
||||
from openslides.projector.api import register_slidemodel
|
||||
from .models import Motion
|
||||
|
||||
register_slidemodel(Motion)
|
34
openslides/motion/templates/motion/widget.html
Normal file
34
openslides/motion/templates/motion/widget.html
Normal file
@ -0,0 +1,34 @@
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
<ul style="line-height: 180%">
|
||||
{% for motion in motions %}
|
||||
<li class="{% if motion.active %}activeline{% endif %}">
|
||||
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link {% if motion.active %}active{% endif %}">
|
||||
<div></div>
|
||||
</a>
|
||||
<a href="{% model_url motion 'delete' %}" title="{% trans 'Delete' %}" class="icon delete right">
|
||||
<span></span>
|
||||
</a>
|
||||
<a href="{% model_url motion 'edit' %}" title="{% trans 'Edit' %}" class="icon edit right">
|
||||
<span></span>
|
||||
</a>
|
||||
<a href="{% url 'projctor_preview_slide' motion.sid %}" title="{% trans 'Preview' %}" class="icon preview right">
|
||||
<span></span>
|
||||
</a>
|
||||
<a href="{% model_url motion 'view' %}">
|
||||
{{ motion.public_version.title }}
|
||||
</a>
|
||||
({% trans "motion" %}
|
||||
{% if motion.number %}
|
||||
{{ motion.number }})
|
||||
{% else %}
|
||||
<i>[{% trans "no number" %}]</i>)
|
||||
{% endif %}
|
||||
</li>
|
||||
{% empty %}
|
||||
<li>{% trans 'No motion available.' %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
@ -33,6 +33,11 @@ urlpatterns = patterns('openslides.motion.views',
|
||||
name='motion_edit',
|
||||
),
|
||||
|
||||
url(r'^(?P<pk>\d+)/del/$',
|
||||
'motion_delete',
|
||||
name='motion_delete',
|
||||
),
|
||||
|
||||
url(r'^(?P<pk>\d+)/version/(?P<version_id>[1-9]\d*)/$',
|
||||
'motion_detail',
|
||||
name='motion_version_detail',
|
||||
|
@ -125,6 +125,17 @@ class MotionUpdateView(MotionMixin, UpdateView):
|
||||
motion_edit = MotionUpdateView.as_view()
|
||||
|
||||
|
||||
class MotionDeleteView(DeleteView):
|
||||
"""
|
||||
Delete one Motion.
|
||||
"""
|
||||
model = Motion
|
||||
success_url_name = 'motion_list'
|
||||
# TODO: Check permissions
|
||||
|
||||
motion_delete = MotionDeleteView.as_view()
|
||||
|
||||
|
||||
class SupportView(SingleObjectMixin, QuestionMixin, RedirectView):
|
||||
"""
|
||||
Classed based view to support or unsupport a motion. Use
|
||||
@ -304,3 +315,11 @@ def register_tab(request):
|
||||
permission=request.user.has_perm('motion.can_see_motion'),
|
||||
selected=selected,
|
||||
)
|
||||
|
||||
def get_widgets(request):
|
||||
return [Widget(
|
||||
name='motions',
|
||||
display_name=_('Motions'),
|
||||
template='motion/widget.html',
|
||||
context={'motions': Motion.objects.all()},
|
||||
permission_required='projector.can_manage_projector')]
|
||||
|
Loading…
Reference in New Issue
Block a user