Updated motion category template.

This commit is contained in:
Emanuel Schuetze 2013-03-11 21:29:56 +01:00
parent ff848a865a
commit d9fbaf9aa7
5 changed files with 40 additions and 7 deletions

View File

@ -527,7 +527,7 @@ class MotionSupporter(models.Model):
class Category(models.Model):
name = models.CharField(max_length=255, verbose_name=ugettext_lazy("Category name"))
prefix = models.CharField(max_length=32, verbose_name=ugettext_lazy("Category prefix"))
prefix = models.CharField(max_length=32, verbose_name=ugettext_lazy("Prefix"))
def __unicode__(self):
return self.name
@ -536,6 +536,8 @@ class Category(models.Model):
if link == 'update' or link == 'edit':
return reverse('motion_category_update', args=[str(self.id)])
class Meta:
ordering = ['prefix']
## class Comment(models.Model):
## motion_version = models.ForeignKey(MotionVersion)

View File

@ -5,7 +5,7 @@
{% block title %}
{{ block.super }}
{% if motion %}
{% if category %}
{% trans "Edit category" %}
{% else %}
{% trans "New category" %}
@ -14,7 +14,7 @@
{% block content %}
<h1>
{% if motion %}
{% if category %}
{% trans "Edit category" %}
{% else %}
{% trans "New category" %}
@ -24,7 +24,7 @@
{% include "form.html" %}
<p>
{% include "formbuttons_saveapply.html" %}
<a href='{% url 'motion_list' %}' class="btn">
<a href='{% url 'motion_category_list' %}' class="btn">
{% trans 'Cancel' %}
</a>
</p>

View File

@ -6,9 +6,37 @@
{% block title %}{{ block.super }} {% trans "Motions" %}{% endblock %}
{% 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 %}
<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>
{# TODO: motion_category_delete #}
<a href="{% url 'motion_delete' category.id %}" title="{% trans 'Delete' %}" class="btn btn-mini">
<i class="icon-remove"></i>
</a>
</span>
</td>
</tr>
{% empty %}
<p>No Categories</p>
{% endfor %}

View File

@ -10,9 +10,10 @@
{% trans "Motions" %}
<small class="pull-right">
{% 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 %}
{% 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>#}
{% 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>

View File

@ -479,6 +479,7 @@ category_list = CategoryListView.as_view()
class CategoryCreateView(CreateView):
permission_required = 'motion.can_manage_motion'
model = Category
success_url_name = 'motion_category_list'
category_create = CategoryCreateView.as_view()
@ -486,6 +487,7 @@ category_create = CategoryCreateView.as_view()
class CategoryUpdateView(UpdateView):
permission_required = 'motion.can_manage_motion'
model = Category
success_url_name = 'motion_category_list'
category_update = CategoryUpdateView.as_view()