diff --git a/bt/models.py b/bt/models.py index 4e5562757e51615018faa60f4e3c337e82f2ccad..41cf4c2592ef8947dfd223cc484cb481216b655d 100644 --- a/bt/models.py +++ b/bt/models.py @@ -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')), ) diff --git a/bt/views.py b/bt/views.py index 0ecf1713fad61f32c0577b0d48c7cd435ab89521..a376dd40ded8f1c00fefbc1d8bed0d26b632e6b6 100644 --- a/bt/views.py +++ b/bt/views.py @@ -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)) diff --git a/templates/list.html b/templates/list.html index 48dad0e00b7c26970967cc2bfafeaa09e678c1c4..bd4223c0fd93e5e362726836ee012617f49ad9ca 100644 --- a/templates/list.html +++ b/templates/list.html @@ -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);