Merge branch 'master' of github.com:OpenSlides/OpenSlides
This commit is contained in:
commit
c46ec570bf
@ -49,9 +49,9 @@ class Motion(SlideMixin, models.Model):
|
|||||||
related_name="active_version")
|
related_name="active_version")
|
||||||
"""Points to a specific version.
|
"""Points to a specific version.
|
||||||
|
|
||||||
Used be the permitted-version-system to deside witch version is the active
|
Used be the permitted-version-system to deside which version is the active
|
||||||
Version. Could also be used to only choose a specific version as a default
|
version. Could also be used to only choose a specific version as a default
|
||||||
version. Like the Sighted versions on Wikipedia.
|
version. Like the sighted versions on Wikipedia.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
state = models.ForeignKey('State', null=True) # TODO: Check whether null=True is necessary.
|
state = models.ForeignKey('State', null=True) # TODO: Check whether null=True is necessary.
|
||||||
@ -574,7 +574,7 @@ class Category(models.Model):
|
|||||||
name = models.CharField(max_length=255, verbose_name=ugettext_lazy("Category name"))
|
name = models.CharField(max_length=255, verbose_name=ugettext_lazy("Category name"))
|
||||||
"""Name of the category."""
|
"""Name of the category."""
|
||||||
|
|
||||||
prefix = models.CharField(blank=True, max_length=32, verbose_name=ugettext_lazy("Category prefix"))
|
prefix = models.CharField(blank=True, max_length=32, verbose_name=ugettext_lazy("Prefix"))
|
||||||
"""Prefix of the category.
|
"""Prefix of the category.
|
||||||
|
|
||||||
Used to build the identifier of a motion.
|
Used to build the identifier of a motion.
|
||||||
@ -589,6 +589,8 @@ class Category(models.Model):
|
|||||||
if link == 'delete':
|
if link == 'delete':
|
||||||
return reverse('motion_category_delete', args=[str(self.id)])
|
return reverse('motion_category_delete', args=[str(self.id)])
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['prefix']
|
||||||
|
|
||||||
## class Comment(models.Model):
|
## class Comment(models.Model):
|
||||||
## motion_version = models.ForeignKey(MotionVersion)
|
## motion_version = models.ForeignKey(MotionVersion)
|
||||||
|
41
openslides/motion/static/styles/motion.css
Normal file
41
openslides/motion/static/styles/motion.css
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* OpenSlides motion style
|
||||||
|
*
|
||||||
|
* :copyright: 2013 by OpenSlides team, see AUTHORS.
|
||||||
|
* :license: GNU GPL, see LICENSE for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* motion version diff table */
|
||||||
|
table.diff, .diff_row {
|
||||||
|
font-size: 12px;
|
||||||
|
width: 100%;
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
table.diff[rules][rules="groups"] > colgroup, table[rules][rules="groups"] > tfoot, table[rules][rules="groups"] > thead, table[rules][rules="groups"] > tbody {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
table.diff td {
|
||||||
|
padding: 0 !important;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.diff_header {
|
||||||
|
background-color:#e0e0e0;
|
||||||
|
}
|
||||||
|
td.diff_header {
|
||||||
|
text-align:right;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.diff_next {
|
||||||
|
background-color:#c0c0c0;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.diff_add {
|
||||||
|
background-color:#aaffaa;
|
||||||
|
}
|
||||||
|
.diff_chg {
|
||||||
|
background-color:#ffff77;
|
||||||
|
}
|
||||||
|
.diff_sub {
|
||||||
|
background-color:#ffaaaa;
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ block.super }} –
|
{{ block.super }} –
|
||||||
{% if motion %}
|
{% if category %}
|
||||||
{% trans "Edit category" %}
|
{% trans "Edit category" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans "New category" %}
|
{% trans "New category" %}
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>
|
<h1>
|
||||||
{% if motion %}
|
{% if category %}
|
||||||
{% trans "Edit category" %}
|
{% trans "Edit category" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans "New category" %}
|
{% trans "New category" %}
|
||||||
@ -24,7 +24,7 @@
|
|||||||
{% include "form.html" %}
|
{% include "form.html" %}
|
||||||
<p>
|
<p>
|
||||||
{% include "formbuttons_saveapply.html" %}
|
{% include "formbuttons_saveapply.html" %}
|
||||||
<a href='{% url 'motion_list' %}' class="btn">
|
<a href='{% url 'motion_category_list' %}' class="btn">
|
||||||
{% trans 'Cancel' %}
|
{% trans 'Cancel' %}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -6,11 +6,40 @@
|
|||||||
{% block title %}{{ block.super }} – {% trans "Motions" %}{% endblock %}
|
{% block title %}{{ block.super }} – {% trans "Motions" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{% trans "Categories" %}</h1>
|
<h1>
|
||||||
|
{% trans "Categories" %}
|
||||||
|
<small class="pull-right">
|
||||||
|
{% if perms.motion.can_manage_motion %}
|
||||||
|
<a href="{% url 'motion_category_create' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New motion' %}"><i class="icon-plus icon-white"></i> {% trans 'New' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
<a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
|
||||||
|
</small>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th class="mini_width">{% trans "Prefix" %}</th>
|
||||||
|
<th>{% trans "Category name" %}</th>
|
||||||
|
<th class="mini_width">{% trans "Actions" %}</th>
|
||||||
|
</tr>
|
||||||
{% for category in category_list %}
|
{% for category in category_list %}
|
||||||
<p><a href="{% model_url category 'update' %}">{{ category }}</a></p>
|
<tr>
|
||||||
|
<td>{{ category.prefix }}</td>
|
||||||
|
<td><a href="{% model_url category 'update' %}">{{ category }}</a></td>
|
||||||
|
<td><span style="width: 1px; white-space: nowrap;">
|
||||||
|
<a href="{% model_url category 'update' %}" title="{% trans 'Edit' %}" class="btn btn-mini">
|
||||||
|
<i class="icon-pencil"></i>
|
||||||
|
</a>
|
||||||
|
<a href="{% model_url category 'delete' %}" title="{% trans 'Delete' %}" class="btn btn-mini">
|
||||||
|
<i class="icon-remove"></i>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<p>No Categories</p>
|
<tr>
|
||||||
|
<td colspan="3"><i>{% trans "No categories available." %}</i></td>
|
||||||
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -4,18 +4,19 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load staticfiles %}
|
{% load staticfiles %}
|
||||||
|
|
||||||
{% block title %}{{ block.super }} – {% trans "Motion" %} {{ motion.number }}{% endblock %}
|
{% block title %}{{ block.super }} – {% trans "Motion" %} {{ motion.identifier }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>
|
<h1>
|
||||||
{{ motion.title }} {{ motion.category }}
|
{{ motion.title }} {{ motion.category }}
|
||||||
<br>
|
<br>
|
||||||
<small>
|
<small>
|
||||||
{% if motion.identifier != None %}
|
{% if motion.identifier %}
|
||||||
{% trans "Motion" %} {{ motion.identifier }},
|
{% trans "Motion" %} {{ motion.identifier }},
|
||||||
{% else %}
|
{% else %}
|
||||||
<i>[{% trans "no number" %}]</i>,
|
<i>[{% trans "no number" %}]</i>,
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{# TODO: show only for complex workflow #}
|
||||||
{% trans "Version" %} {{ motion.version.version_number }}
|
{% trans "Version" %} {{ motion.version.version_number }}
|
||||||
</small>
|
</small>
|
||||||
<small class="pull-right">
|
<small class="pull-right">
|
||||||
@ -56,13 +57,20 @@
|
|||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span8">
|
<div class="span8">
|
||||||
{% if motion.active_version.id != motion.version.id %}
|
{# TODO: show only for complex workflow #}
|
||||||
<span class="label label-warning"><i class="icon-warning-sign icon-white"></i>
|
{% if motion.version.version_number < motion.last_version.version_number %}
|
||||||
{% if motion.version == motion.public_version %}
|
<span class="label label-warning">
|
||||||
{% trans "This is not the newest version." %}</span> <a href="{% url 'motion_version_detail' motion.id motion.last_version.id %}">{% trans "Go to version" %} {{ motion.last_version.version_number }}.</a>
|
<i class="icon-warning-sign icon-white"></i> {% trans "This is not the newest version." %}
|
||||||
{% else %}
|
</span>
|
||||||
{% trans "This is not the authorized version." %}</span> <a href="{% url 'motion_view' motion.id %}">{% trans "Go to version" %} {{ motion.public_version.aid }}.</a>
|
<a href="{% model_url motion.last_version %}" class="btn btn-small">{% trans "Go to last version" %}
|
||||||
|
(#{{ motion.last_version.version_number }})</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if motion.version.version_number > motion.active_version.version_number %}
|
||||||
|
<span class="label label-warning">
|
||||||
|
<i class="icon-warning-sign icon-white"></i> {% trans "This version is not yet authorized." %}
|
||||||
|
</span>
|
||||||
|
<a href="{% model_url motion.active_version %}" class="btn btn-small">{% trans "Go to last authorized version" %}
|
||||||
|
(#{{ motion.active_version.version_number }})</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Text -->
|
<!-- Text -->
|
||||||
@ -80,84 +88,60 @@
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<!-- Version history -->
|
<!-- Version history -->
|
||||||
{% for version in motion.versions.all %}
|
{% with versions=motion.versions.all %}
|
||||||
|
{% if versions|length > 1 %}
|
||||||
|
{% for version in versions %}
|
||||||
{% if forloop.first %}
|
{% if forloop.first %}
|
||||||
<h4>{% trans "Version history" %}:</h4>
|
<h4>{% trans "Version history" %}:</h4>
|
||||||
|
<form action="{% url 'motion_version_diff' motion.pk %}" method="get">
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th>{% trans "Version" %}</th>
|
<th>#</th>
|
||||||
<th>{% trans "Time" %}</th>
|
<th>{% trans "Time" %}</th>
|
||||||
<th>{% trans "Title" %}</th>
|
<th><button class="btn btn-small" type="submit">{% trans 'Difference' %}</button></th>
|
||||||
<th>{% trans "Text" %}</th>
|
<th>{% trans "Actions" %}</th>
|
||||||
<th>{% trans "Reason" %}</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr>
|
<tr {% if version == motion.version %}class="offline"{%endif %}>
|
||||||
<td class="nobr">
|
<td class="nobr">
|
||||||
{% if version == motion.active_version %}
|
{% if version == motion.active_version %}
|
||||||
<span class="badge badge-success" title="{% trans 'This version is authorized' %}"><i class="icon-ok icon-white"></i></span>
|
<span class="badge badge-success" title="{% trans 'This version is authorized' %}"><i class="icon-ok icon-white"></i></span>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if perms.motion.can_manage_motion %}
|
{% if perms.motion.can_manage_motion %}
|
||||||
<a class="btn btn-mini" href="{% url 'motion_version_permit' motion.id version.id %}" title="{% trans 'Permit this version' %}"><i class="icon-ok"></i></a>
|
<a class="btn btn-mini" href="{% url 'motion_version_permit' motion.id version.version_number %}" title="{% trans 'Permit this version' %}"><i class="icon-ok"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not version.rejected and version.id > motion.active_version.id and perms.motion.can_manage_motion %}
|
{% if not version.rejected and version.id > motion.active_version.id and perms.motion.can_manage_motion %}
|
||||||
<a class="btn btn-mini" href="{% url 'motion_version_reject' version.id %}" title="{% trans 'Reject this version' %}"><i class="icon-ban-circle"></i></a>
|
<a class="btn btn-mini" href="{% url 'motion_version_reject' motion.id version.version_number %}" title="{% trans 'Reject this version' %}"><i class="icon-ban-circle"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if version.rejected %}
|
{% if version.rejected %}
|
||||||
<span class="badge badge-important" title="{% trans 'This version is rejected' %}"><i class="icon-ban-circle icon-white"></i></span>
|
<span class="badge badge-important" title="{% trans 'This version is rejected' %}"><i class="icon-ban-circle icon-white"></i></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td><a href="{% model_url version %}">{{ version.version_number }}</a></td>
|
<td>{{ version.version_number }}</td>
|
||||||
<td><i>{{ version.creation_time }}</i></td>
|
<td><i>{{ version.creation_time }}</i></td>
|
||||||
<td>
|
<td>
|
||||||
{% ifchanged %}
|
<input type="radio" value="{{ version.version_number }}" name="rev1">
|
||||||
<b>{{ version.title }}</b>
|
<input type="radio" value="{{ version.version_number }}" name="rev2">
|
||||||
{% else %}
|
|
||||||
<i>[{% trans "unchanged" %}]</i>
|
|
||||||
{% endifchanged %}
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% ifchanged %}
|
<a href="{% model_url version %}" title="{% trans 'Show version number' %} {{ version.version_number }}" class="btn btn-mini">
|
||||||
{{ version.text|linebreaks }}
|
<i class="icon-search"></i>
|
||||||
{% else %}
|
</a>
|
||||||
<i>[{% trans "unchanged" %}]</i>
|
{# TODO: add delete version function #}
|
||||||
{% endifchanged %}
|
<a href="{% model_url version 'delete' %}" title="{% trans 'Delete version number' %} {{ version.version_number }}" class="btn btn-mini">
|
||||||
</td>
|
<i class="icon-remove"></i>
|
||||||
<td>
|
</a>
|
||||||
{% ifchanged %}
|
|
||||||
{{ version.reason|linebreaks }}
|
|
||||||
{% else %}
|
|
||||||
<i>[{% trans "unchanged" %}]</i>
|
|
||||||
{% endifchanged %}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if forloop.last %}
|
{% if forloop.last %}
|
||||||
</table>
|
</table>
|
||||||
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<!-- TODO: For testing -->
|
|
||||||
<ol>
|
|
||||||
{% for motion_version in motion.versions.all %}
|
|
||||||
<li>
|
|
||||||
{% if motion_version.id == motion.version.id %}
|
|
||||||
<strong><a href="{% model_url motion_version %}">{{ motion_version }}</a></strong>
|
|
||||||
{% else %}
|
|
||||||
<a href="{% model_url motion_version %}">{{ motion_version }}</a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if motion_version.active %}
|
{% endwith %}
|
||||||
(active)
|
|
||||||
{% endif %}
|
|
||||||
{% if motion_version.rejected %}
|
|
||||||
(rejected)
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ol>
|
|
||||||
<!-- End TODO -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Log -->
|
<!-- Log -->
|
||||||
{% if perms.motion.can_manage_motion %}
|
{% if perms.motion.can_manage_motion %}
|
||||||
@ -247,6 +231,10 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
|
<!-- Category -->
|
||||||
|
<h5>{% trans "Category" %}:</h5>
|
||||||
|
{{ motion.category }}
|
||||||
|
|
||||||
<!-- Creation Time -->
|
<!-- Creation Time -->
|
||||||
<h5>{% trans "Creation Time" %}:</h5>
|
<h5>{% trans "Creation Time" %}:</h5>
|
||||||
{# TODO: use creation time of _first_ version #}
|
{# TODO: use creation time of _first_ version #}
|
||||||
@ -287,7 +275,7 @@
|
|||||||
<!-- Manage motion box -->
|
<!-- Manage motion box -->
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<h4>{% trans "Manage motion" %}</h4>
|
<h4>{% trans "Manage motion" %}</h4>
|
||||||
<div class="btn-group">
|
<div class="btn-group btn-group-vertical">
|
||||||
{% for state in motion.state.next_states.all %}
|
{% for state in motion.state.next_states.all %}
|
||||||
<a href="{% url 'motion_set_state' motion.pk state.pk %}" class="btn btn-small">{{ state }}</a>
|
<a href="{% url 'motion_set_state' motion.pk state.pk %}" class="btn btn-small">{{ state }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -303,5 +291,4 @@
|
|||||||
</div> <!--/span-->
|
</div> <!--/span-->
|
||||||
</div> <!--/row-->
|
</div> <!--/row-->
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
67
openslides/motion/templates/motion/motion_diff.html
Normal file
67
openslides/motion/templates/motion/motion_diff.html
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% load tags %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
|
||||||
|
{% block title %}{{ block.super }} – {% trans "Motion" %} {{ motion.identifier }}{% endblock %}
|
||||||
|
|
||||||
|
{% block header %}
|
||||||
|
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/motion.css' %}" />
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>
|
||||||
|
{{ motion.title }}
|
||||||
|
<br>
|
||||||
|
<small>
|
||||||
|
{% if motion.identifier != None %}
|
||||||
|
{% trans "Motion" %} {{ motion.identifier }},
|
||||||
|
{% else %}
|
||||||
|
<i>[{% trans "no number" %}]</i>,
|
||||||
|
{% endif %}
|
||||||
|
{% trans "Diff view" %}
|
||||||
|
</small>
|
||||||
|
<small class="pull-right">
|
||||||
|
<div class="btn-toolbar">
|
||||||
|
<a href="{% url 'motion_detail' motion.id %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to motion" %}</a>
|
||||||
|
</div>
|
||||||
|
</small>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
{% if version_rev1 and version_rev2 %}
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<tr>
|
||||||
|
<td><b>{% trans "Version" %} {{ version_rev1.version_number }}</b><br>
|
||||||
|
{% trans "created: " %} {{ version_rev1.creation_time }}<br>
|
||||||
|
<h4>{{ version_rev1.title }}</h4>
|
||||||
|
</td>
|
||||||
|
<td><b>{% trans "Version" %} {{ version_rev2.version_number }}</b><br>
|
||||||
|
{% trans "created: " %} {{ version_rev1.creation_time }}<br>
|
||||||
|
<h4>{{ version_rev2.title }}</h4>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- Text -->
|
||||||
|
<tr class="diff_row">
|
||||||
|
{% if not version_rev1.text == version_rev2.text %}
|
||||||
|
<td colspan="2">{{ diff_text|safe }}</td>
|
||||||
|
{% else %}
|
||||||
|
<td>{{ version_rev1.text }}</td>
|
||||||
|
<td>{{ version_rev2.text }}</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
<!-- Reason -->
|
||||||
|
<tr><td colspan="2"><h4>{% trans "Reason" %}:</h4></td></tr>
|
||||||
|
<tr class="diff_row">
|
||||||
|
{% if not version_rev1.reason == version_rev2.reason %}
|
||||||
|
<td colspan="2">{{ diff_reason|safe }}</td>
|
||||||
|
{% else %}
|
||||||
|
<td>{{ version_rev1.reason }}</td>
|
||||||
|
<td>{{ version_rev2.reason }}</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -10,9 +10,10 @@
|
|||||||
{% trans "Motions" %}
|
{% trans "Motions" %}
|
||||||
<small class="pull-right">
|
<small class="pull-right">
|
||||||
{% if perms.motion.can_create_motion %}
|
{% if perms.motion.can_create_motion %}
|
||||||
<a href="{% url 'motion_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New motion' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
|
<a href="{% url 'motion_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New motion' %}"><i class="icon-plus icon-white"></i> {% trans 'New' %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if perms.motion.can_manage_motion %}
|
{% if perms.motion.can_manage_motion %}
|
||||||
|
<a href="{% url 'motion_category_list' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New motion' %}"><i class="icon-th-large"></i> {% trans 'Category' %}</a>
|
||||||
{# <a href="{% url 'motion_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import motions' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>#}
|
{# <a href="{% url 'motion_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import motions' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>#}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% url 'motion_list_pdf' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all motions as PDF' %}"><i class="icon-print"></i> PDF</a>
|
<a href="{% url 'motion_list_pdf' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all motions as PDF' %}"><i class="icon-print"></i> PDF</a>
|
||||||
@ -60,7 +61,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% for motion in motion_list %}
|
{% for motion in motion_list %}
|
||||||
<tr class="{% if motion.active %}activeline{% endif %}">
|
<tr class="{% if motion.active %}activeline{% endif %}">
|
||||||
<td>{{ motion.number }}</td>
|
<td>{{ motion.identifier }}</td>
|
||||||
<td><a href="{% model_url motion %}">{{ motion.title }}</a></td>
|
<td><a href="{% model_url motion %}">{{ motion.title }}</a></td>
|
||||||
{% if min_supporters > 0 %}
|
{% if min_supporters > 0 %}
|
||||||
<td class="optional">{# motion.count_supporters #}</td>
|
<td class="optional">{# motion.count_supporters #}</td>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ block.super }} - {% trans "Motion" %} {{ motion.number }}, {{ ballot }}. {% trans "Vote" %}
|
{{ block.super }} - {% trans "Motion" %} {{ motion.identifier }}, {{ ballot }}. {% trans "Vote" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@ -11,7 +11,7 @@
|
|||||||
{{ motion }}
|
{{ motion }}
|
||||||
<br>
|
<br>
|
||||||
<small>
|
<small>
|
||||||
{% trans "Motion" %} {{ motion.number }}, {{ ballot }}. {% trans "Vote" %}
|
{% trans "Motion" %} {{ motion.identifier }}, {{ ballot }}. {% trans "Vote" %}
|
||||||
</small>
|
</small>
|
||||||
<small class="pull-right">
|
<small class="pull-right">
|
||||||
<div class="btn-toolbar">
|
<div class="btn-toolbar">
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
{{ motion.public_version.title }}
|
{{ motion.public_version.title }}
|
||||||
</a>
|
</a>
|
||||||
({% trans "motion" %}
|
({% trans "motion" %}
|
||||||
{% if motion.number %}
|
{% if motion.identifier %}
|
||||||
{{ motion.number }})
|
{{ motion.identifier }})
|
||||||
{% else %}
|
{% else %}
|
||||||
<i>[{% trans "no number" %}]</i>)
|
<i>[{% trans "no number" %}]</i>)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load staticfiles %}
|
{% load staticfiles %}
|
||||||
|
|
||||||
{% block title %}{{ block.super }} - {% trans "Motion" %} {{ motion.number }}{% endblock %}
|
{% block title %}{{ block.super }} - {% trans "Motion" %} {{ motion.identifier }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@ -59,8 +59,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>
|
<h1>
|
||||||
{% if motion.number != None %}
|
{% if motion.identifier %}
|
||||||
{% trans "Motion No." %} {{ motion.number }}
|
{% trans "Motion No." %} {{ motion.identifier }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans "Motion" %} <i>[{% trans "no number" %}]</i>
|
{% trans "Motion" %} <i>[{% trans "no number" %}]</i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -60,6 +60,11 @@ urlpatterns = patterns('openslides.motion.views',
|
|||||||
name='motion_version_reject',
|
name='motion_version_reject',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
url(r'^(?P<pk>\d+)/diff/$',
|
||||||
|
'version_diff',
|
||||||
|
name='motion_version_diff',
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/support/$',
|
url(r'^(?P<pk>\d+)/support/$',
|
||||||
'motion_support',
|
'motion_support',
|
||||||
name='motion_support',
|
name='motion_support',
|
||||||
|
@ -25,7 +25,7 @@ from openslides.utils.views import (
|
|||||||
TemplateView, RedirectView, UpdateView, CreateView, DeleteView, PDFView,
|
TemplateView, RedirectView, UpdateView, CreateView, DeleteView, PDFView,
|
||||||
DetailView, ListView, FormView, QuestionMixin, SingleObjectMixin)
|
DetailView, ListView, FormView, QuestionMixin, SingleObjectMixin)
|
||||||
from openslides.utils.template import Tab
|
from openslides.utils.template import Tab
|
||||||
from openslides.utils.utils import html_strong
|
from openslides.utils.utils import html_strong, htmldiff
|
||||||
from openslides.poll.views import PollFormView
|
from openslides.poll.views import PollFormView
|
||||||
from openslides.projector.api import get_active_slide
|
from openslides.projector.api import get_active_slide
|
||||||
from openslides.projector.projector import Widget, SLIDE
|
from openslides.projector.projector import Widget, SLIDE
|
||||||
@ -251,6 +251,39 @@ class VersionRejectView(GetVersionMixin, SingleObjectMixin, QuestionMixin, Redir
|
|||||||
version_reject = VersionRejectView.as_view()
|
version_reject = VersionRejectView.as_view()
|
||||||
|
|
||||||
|
|
||||||
|
class VersionDiffView(DetailView):
|
||||||
|
"""Show diff between two versions of a motion."""
|
||||||
|
permission_required = 'motion.can_see_motion'
|
||||||
|
model = Motion
|
||||||
|
template_name = 'motion/motion_diff.html'
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
"""Return the template context with versions and html diff strings."""
|
||||||
|
try:
|
||||||
|
rev1 = int(self.request.GET['rev1'])
|
||||||
|
rev2 = int(self.request.GET['rev2'])
|
||||||
|
version_rev1 = self.object.versions.get(version_number=self.request.GET['rev1'])
|
||||||
|
version_rev2 = self.object.versions.get(version_number=self.request.GET['rev2'])
|
||||||
|
diff_text = htmldiff(version_rev1.text, version_rev2.text)
|
||||||
|
diff_reason = htmldiff(version_rev1.reason, version_rev2.reason)
|
||||||
|
except (KeyError, ValueError, MotionVersion.DoesNotExist):
|
||||||
|
messages.error(self.request, _('At least one version number was not valid.'))
|
||||||
|
version_rev1 = None
|
||||||
|
version_rev2 = None
|
||||||
|
diff_text = None
|
||||||
|
diff_reason = None
|
||||||
|
context = super(VersionDiffView, self).get_context_data(**kwargs)
|
||||||
|
context.update({
|
||||||
|
'version_rev1': version_rev1,
|
||||||
|
'version_rev2': version_rev2,
|
||||||
|
'diff_text': diff_text,
|
||||||
|
'diff_reason': diff_reason,
|
||||||
|
})
|
||||||
|
return context
|
||||||
|
|
||||||
|
version_diff = VersionDiffView.as_view()
|
||||||
|
|
||||||
|
|
||||||
class SetIdentifierView(SingleObjectMixin, RedirectView):
|
class SetIdentifierView(SingleObjectMixin, RedirectView):
|
||||||
"""Set the identifier of the motion.
|
"""Set the identifier of the motion.
|
||||||
|
|
||||||
@ -530,6 +563,7 @@ category_list = CategoryListView.as_view()
|
|||||||
class CategoryCreateView(CreateView):
|
class CategoryCreateView(CreateView):
|
||||||
permission_required = 'motion.can_manage_motion'
|
permission_required = 'motion.can_manage_motion'
|
||||||
model = Category
|
model = Category
|
||||||
|
success_url_name = 'motion_category_list'
|
||||||
|
|
||||||
category_create = CategoryCreateView.as_view()
|
category_create = CategoryCreateView.as_view()
|
||||||
|
|
||||||
@ -537,6 +571,7 @@ category_create = CategoryCreateView.as_view()
|
|||||||
class CategoryUpdateView(UpdateView):
|
class CategoryUpdateView(UpdateView):
|
||||||
permission_required = 'motion.can_manage_motion'
|
permission_required = 'motion.can_manage_motion'
|
||||||
model = Category
|
model = Category
|
||||||
|
success_url_name = 'motion_category_list'
|
||||||
|
|
||||||
category_update = CategoryUpdateView.as_view()
|
category_update = CategoryUpdateView.as_view()
|
||||||
|
|
||||||
@ -544,6 +579,7 @@ category_update = CategoryUpdateView.as_view()
|
|||||||
class CategoryDeleteView(DeleteView):
|
class CategoryDeleteView(DeleteView):
|
||||||
permission_required = 'motion.can_manage_motion'
|
permission_required = 'motion.can_manage_motion'
|
||||||
model = Category
|
model = Category
|
||||||
|
question_url_name = 'motion_category_list'
|
||||||
success_url_name = 'motion_category_list'
|
success_url_name = 'motion_category_list'
|
||||||
|
|
||||||
category_delete = CategoryDeleteView.as_view()
|
category_delete = CategoryDeleteView.as_view()
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="{% model_url motion 'view' %}">{{ motion.public_version.title }}</a>
|
<a href="{% model_url motion 'view' %}">{{ motion.public_version.title }}</a>
|
||||||
({% trans "motion" %}
|
({% trans "motion" %}
|
||||||
{% if motion.number %}
|
{% if motion.identifier %}
|
||||||
{{ motion.number }})
|
{{ motion.identifier }})
|
||||||
{% else %}
|
{% else %}
|
||||||
<i>[{% trans "no number" %}]</i>)
|
<i>[{% trans "no number" %}]</i>)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -26,8 +26,8 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="{% model_url motion 'view' %}">{{ motion.public_version.title }}</a>
|
<a href="{% model_url motion 'view' %}">{{ motion.public_version.title }}</a>
|
||||||
({% trans "motion" %}
|
({% trans "motion" %}
|
||||||
{% if motion.number %}
|
{% if motion.identifier %}
|
||||||
{{ motion.number }})
|
{{ motion.identifier }})
|
||||||
{% else %}
|
{% else %}
|
||||||
<i>[{% trans "no number" %}]</i>)
|
<i>[{% trans "no number" %}]</i>)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -10,8 +10,9 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import difflib
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
@ -133,3 +134,10 @@ def ajax_request(data):
|
|||||||
|
|
||||||
def html_strong(string):
|
def html_strong(string):
|
||||||
return u"<strong>%s</strong>" % string
|
return u"<strong>%s</strong>" % string
|
||||||
|
|
||||||
|
|
||||||
|
def htmldiff(text1, text2):
|
||||||
|
"""Return string of html diff between two strings (text1 and text2)"""
|
||||||
|
|
||||||
|
diff = difflib.HtmlDiff(wrapcolumn=60)
|
||||||
|
return diff.make_table(text1.splitlines(), text2.splitlines())
|
||||||
|
Loading…
Reference in New Issue
Block a user