Commit 1a488a80 authored by Baptiste Jonglez's avatar Baptiste Jonglez

[enh] Sort cases by status on /list

The order is:
  moreinfo < new < verified < duplicate < ooscope < closed
so that cases that need a lot of attention come first.
parent 02e5e6b0
......@@ -51,10 +51,10 @@ MEDIA = (
('mobile', _('Mobile')),
)
STATUS = (
('moreinfo', _('Need more info')),
('new', _('New')),
('duplicate', _('Duplicate')),
('verified', _('Verified')),
('moreinfo', _('Need more info')),
('duplicate', _('Duplicate')),
('ooscope', _('Out of scope')),
('closed', _('Closed')),
)
......
......@@ -11,7 +11,7 @@ from django.contrib import messages
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.db.models import Count
from models import Violation, Attachment, Comment, Confirmation, COUNTRIES
from models import Violation, Attachment, Comment, Confirmation, COUNTRIES, STATUS
from tempfile import mkstemp
from datetime import datetime
import hashlib, os, re, json, smtplib
......@@ -181,7 +181,8 @@ def add(request):
return render_to_response(
'index.html',
{ 'form': form,
'violations': v_list },
'violations': v_list,
'status': STATUS },
context_instance=RequestContext(request))
def ajax(request, country=None, operator=None):
......@@ -213,6 +214,7 @@ def index(request):
(_('Countries with some confirmed reports'), len([i for i,z in confirms if i>1])),
(_('Operators with some confirmed reports'), len([i for i,z in operators if i>1])),
],
'status': STATUS,
'violations': v_list },
context_instance=RequestContext(request))
......
......@@ -27,9 +27,24 @@
$('#'+key+' path').css('fill', data[key]);
}
{% endif %}
$.tablesorter.addParser({
// set a unique id
id: 'stateparser',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s) {
// format your data for normalization
return s.toLowerCase(){% for s, translation in status %}.replace(/{{translation}}/,{{forloop.counter}}){% endfor %};
},
// set type, either numeric or text
type: 'numeric'
});
$("#sortedlist").tablesorter({
headers: { 8: { sorter: false },},
sortList: [[1,0],[7,1]],
headers: { 8: { sorter: false },
0: { sorter: 'stateparser' }},
sortList: [[1,0],[0,0],[7,1]],
});
var options = { enableCookies: false };
$('#sortedlist').tableFilter(options);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment