* Allow priority selection on submission

* Display coloured background on new Priority column in lists
* Allow sorting by priority in ticket list
This commit is contained in:
Ross Poulton 2008-01-10 05:06:47 +00:00
parent 8aae8564ba
commit ff7f718caf
6 changed files with 50 additions and 10 deletions

View File

@ -48,6 +48,11 @@ class TicketForm(forms.Form):
assigned_to = forms.ChoiceField(choices=(), required=False, assigned_to = forms.ChoiceField(choices=(), required=False,
label=u'Case owner') label=u'Case owner')
priority = forms.ChoiceField(choices=Ticket.PRIORITY_CHOICES,
required=False,
initial='3',
label=u'Priority')
def save(self, user): def save(self, user):
""" """
Writes and returns a Ticket() object Writes and returns a Ticket() object
@ -60,6 +65,7 @@ class TicketForm(forms.Form):
status = Ticket.OPEN_STATUS, status = Ticket.OPEN_STATUS,
queue = q, queue = q,
description = self.cleaned_data['body'], description = self.cleaned_data['body'],
priority = self.cleaned_data['priority'],
) )
if self.cleaned_data['assigned_to']: if self.cleaned_data['assigned_to']:
try: try:

View File

@ -141,3 +141,28 @@ a.ticket_link_status {
color: #369; color: #369;
font: 12pt Garamond; font: 12pt Garamond;
} }
.priority1 {
background-color: #fcc;
}
.priority2 {
background-color: #FFE5CE;
}
.priority3 {
background-color: #CEE0FF;
}
.priority4 {
background-color: #CEF5FF;
}
.prority5 {
background-color: #CEE0FF;
}
.priority1, .priority2, .priority3, .priority4, .priority5 {
color: #6C79A0;
border-bottom: solid #d5e7fd 1px;
}

View File

@ -31,6 +31,11 @@
<dd>{{ form.assigned_to }}</dd> <dd>{{ form.assigned_to }}</dd>
{% if form.assigned_to.errors %} {% if form.assigned_to.errors %}
<dd class='error'>{{ form.assigned_to.errors }}</dd>{% endif %} <dd class='error'>{{ form.assigned_to.errors }}</dd>{% endif %}
<dt><label for='id_priority'>{{ form.priority.label }}</label></dt>
<dd>{{ form.priority }}</dd>
{% if form.priority.errors %}
<dd class='error'>{{ form.priority.errors }}</dd>{% endif %}
</dl> </dl>
<div class='buttons'> <div class='buttons'>

View File

@ -19,11 +19,12 @@ $(document).ready(function() {
</table> </table>
<table width='100%'> <table width='100%'>
<tr class='row_tablehead'><td colspan='5'>Your Tickets</td></tr> <tr class='row_tablehead'><td colspan='6'>Your Tickets</td></tr>
<tr class='row_columnheads'><th>#</th><th>Title</th><th>Queue</th><th>Status</th><th>Last Update</th></tr> <tr class='row_columnheads'><th>#</th><th>Pr</th><th>Title</th><th>Queue</th><th>Status</th><th>Last Update</th></tr>
{% for ticket in user_tickets %} {% for ticket in user_tickets %}
<tr class='row_{% cycle odd,even %} row_hover'> <tr class='row_{% cycle odd,even %} row_hover'>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.ticket }}</a></th> <th class='priority{{ ticket.priority }}'><a href='{{ ticket.get_absolute_url }}'>{{ ticket.ticket }}</a></th>
<td class='priority{{ ticket.priority }}'>{{ ticket.priority }}</td>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th> <th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td> <td>{{ ticket.queue }}</td>
<td>{{ ticket.get_status_display }}</td> <td>{{ ticket.get_status_display }}</td>
@ -33,11 +34,12 @@ $(document).ready(function() {
</table> </table>
<table width='100%'> <table width='100%'>
<tr class='row_tablehead'><td colspan='5'>Unassigned Tickets</td></tr> <tr class='row_tablehead'><td colspan='6'>Unassigned Tickets</td></tr>
<tr class='row_columnheads'><th>#</th><th>Title</th><th>Queue</th><th>Created</th><th>&nbsp;</th></tr> <tr class='row_columnheads'><th>#</th><th>Pr</th><th>Title</th><th>Queue</th><th>Created</th><th>&nbsp;</th></tr>
{% for ticket in unassigned_tickets %} {% for ticket in unassigned_tickets %}
<tr class='row_{% cycle odd,even %} row_hover'> <tr class='row_{% cycle odd,even %} row_hover'>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.ticket }}</a></th> <th class='priority{{ ticket.priority }}'><a href='{{ ticket.get_absolute_url }}'>{{ ticket.ticket }}</a></th>
<td class='priority{{ ticket.priority }}'>{{ ticket.priority }}</td>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th> <th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td> <td>{{ ticket.queue }}</td>
<td><span title='{{ ticket.created|date:"r" }}'>{{ ticket.created|timesince }} ago</span></td> <td><span title='{{ ticket.created|date:"r" }}'>{{ ticket.created|timesince }} ago</span></td>

View File

@ -15,6 +15,7 @@ $(document).ready(function() {
<option value='title'{% ifequal sort "title"%} selected='selected'{% endifequal %}>Title</option> <option value='title'{% ifequal sort "title"%} selected='selected'{% endifequal %}>Title</option>
<option value='queue'{% ifequal sort "queue"%} selected='selected'{% endifequal %}>Queue</option> <option value='queue'{% ifequal sort "queue"%} selected='selected'{% endifequal %}>Queue</option>
<option value='status'{% ifequal sort "status"%} selected='selected'{% endifequal %}>Status</option> <option value='status'{% ifequal sort "status"%} selected='selected'{% endifequal %}>Status</option>
<option value='priority'{% ifequal sort "priority"%} selected='selected'{% endifequal %}>Priority</option>
<option value='assigned_to'{% ifequal sort "assigned_to"%} selected='selected'{% endifequal %}>Owner</option> <option value='assigned_to'{% ifequal sort "assigned_to"%} selected='selected'{% endifequal %}>Owner</option>
</select> </select>
@ -30,11 +31,12 @@ $(document).ready(function() {
</form> </form>
<table width='100%'> <table width='100%'>
<tr class='row_tablehead'><td colspan='6'>Tickets</td></tr> <tr class='row_tablehead'><td colspan='7'>Tickets</td></tr>
<tr class='row_columnheads'><th>#</th><th>Title</th><th>Queue</th><th>Status</th><th>Created</th><th>Owner</th></tr> <tr class='row_columnheads'><th>#</th><th>Pr</th><th>Title</th><th>Queue</th><th>Status</th><th>Created</th><th>Owner</th></tr>
{% if tickets %}{% for ticket in tickets %} {% if tickets %}{% for ticket in tickets %}
<tr class='row_{% cycle odd,even %} row_hover'> <tr class='row_{% cycle odd,even %} row_hover'>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.id }}</a></th> <th class='priority{{ ticket.priority }}'><a href='{{ ticket.get_absolute_url }}'>{{ ticket.ticket }}</a></th>
<td class='priority{{ ticket.priority }}'>{{ ticket.priority }}</td>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th> <th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td> <td>{{ ticket.queue }}</td>
<td>{{ ticket.get_status_display }}</td> <td>{{ ticket.get_status_display }}</td>

View File

@ -198,7 +198,7 @@ def ticket_list(request):
### SORTING ### SORTING
sort = request.GET.get('sort', None) sort = request.GET.get('sort', None)
if sort not in ('status', 'assigned_to', 'created', 'title', 'queue'): if sort not in ('status', 'assigned_to', 'created', 'title', 'queue', 'priority'):
sort = 'created' sort = 'created'
tickets = tickets.order_by(sort) tickets = tickets.order_by(sort)
context = dict(context, sort=sort) context = dict(context, sort=sort)