From: Charles Holbrow Date: Tue, 19 Mar 2013 17:01:29 +0000 (-0400) Subject: Adding support for FIltering by Date with the "Updated On" prefix. Also, re-formattin... X-Git-Tag: release-20150131~494 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fd4290ef41b39ce7410c70f22027335feaf2202a;p=oweals%2Fkarmaworld.git Adding support for FIltering by Date with the "Updated On" prefix. Also, re-formatting the date to match Nicks spec --- diff --git a/karmaworld/templates/courses/course_list.html b/karmaworld/templates/courses/course_list.html index 9798c47..24beff9 100644 --- a/karmaworld/templates/courses/course_list.html +++ b/karmaworld/templates/courses/course_list.html @@ -39,8 +39,9 @@ $(document).ready(function() { null, null, ], - "aoColumnDefs": [ { - "aTargets": [ 2 ], + "aoColumnDefs": [ + { + "aTargets": [ 'note-count' ], // matches a 'th' element class name "mData": function ( source, type, val ) { //console.log(source); if (type === 'set') { @@ -54,8 +55,24 @@ $(document).ready(function() { } // 'sort', 'type', 'filter' and undefined all just use the integer return source.count; + } + }, + { + "aTargets": [ 'date' ], // matches a 'th' element class name + "mData": function ( source, type, val ) { + //console.log(source); + if (type === 'set') { + source.date = val; + source.date_display = val=="" ? "" : "Updated on "+val; + return; + } + else if (type === 'display') { + return source.date_display; + } + // for types 'sort', 'type', 'filter' and undefined use raw date + return source.date; } - } ], + }], // Initial sorting 'aaSorting': [[2,'desc']] // Use out Ajax endpoing to populate the list @@ -102,7 +119,7 @@ $(document).ready(function() { {% for course in object_list %} - Updated on {{ course.updated_at|date:"M d o" }} + {{ course.updated_at|date:"F d, o" }} {{ course.file_count }} {{ course.school.name }} {{ course.name }}