mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-25 19:17:35 +00:00
Test implementation of custom date sorting
This commit is contained in:
@@ -85,9 +85,9 @@ def googleanalyticsjs(parser, token):
|
||||
|
||||
@register.filter
|
||||
def truncmixlist(value):
|
||||
value = trunc_lines(value, 5)
|
||||
if len(value) > 0:
|
||||
if not is_number(value[0]):
|
||||
value = linenumbers(value)
|
||||
|
||||
value = trunc_lines(value, 5)
|
||||
return value
|
||||
@@ -33,10 +33,46 @@ var ReleaseListView = Backbone.View.extend({
|
||||
});
|
||||
$("#release-table", this.el).tablesorter({
|
||||
sortList:[
|
||||
[0, 0],
|
||||
[1, 0]
|
||||
]
|
||||
[1, 1],
|
||||
[0, 0]
|
||||
],
|
||||
headers:{
|
||||
1:{
|
||||
sorter:'humanDates'
|
||||
}
|
||||
}
|
||||
});
|
||||
// <editor-fold desc="Custom sorter">
|
||||
$.tablesorter.addParser({
|
||||
id:'humanDates',
|
||||
is:function (s) {
|
||||
return false;
|
||||
},
|
||||
format:function (s) {
|
||||
var date = s.match(/^(\w{3})[ ](\d{1,2}),[ ](\d{4})$/);
|
||||
var m = monthNames[date[1]];
|
||||
var d = String(date[2]);
|
||||
if (d.length == 1) {d = "0" + d;}
|
||||
var y = date[3];
|
||||
return '' + y + m + d;
|
||||
},
|
||||
type:'Numeric'
|
||||
});
|
||||
var monthNames = {};
|
||||
monthNames["Jan"] = "01";
|
||||
monthNames["Feb"] = "02";
|
||||
monthNames["Mar"] = "03";
|
||||
monthNames["Apr"] = "04";
|
||||
monthNames["May"] = "05";
|
||||
monthNames["Jun"] = "06";
|
||||
monthNames["Jul"] = "07";
|
||||
monthNames["Aug"] = "08";
|
||||
monthNames["Sep"] = "09";
|
||||
monthNames["Oct"] = "10";
|
||||
monthNames["Nov"] = "11";
|
||||
monthNames["Dec"] = "12";
|
||||
// </editor-fold>
|
||||
|
||||
$('tr.rowlink', this.el).rowlink();
|
||||
$('#tablesorter-fix', this.el).hide();
|
||||
return this;
|
||||
|
||||
@@ -64,7 +64,8 @@ window.SidebarView = Backbone.View.extend({
|
||||
_eventAggregator.trigger("track_changed", data);
|
||||
liveButton.button('reset');
|
||||
liveButton.removeClass('btn-success').addClass('btn-danger').text('Stop listening');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user