From 9a180eff84d14e2c06b6a5346fd9f9e439a15de4 Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Tue, 18 Mar 2014 17:14:01 -0400 Subject: [PATCH] Fix sorting on course list --- karmaworld/templates/courses/course_list.html | 22 ++++++++++++------- .../templates/courses/course_list_entry.html | 4 ++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/karmaworld/templates/courses/course_list.html b/karmaworld/templates/courses/course_list.html index c7d16ed..8ae1ab9 100644 --- a/karmaworld/templates/courses/course_list.html +++ b/karmaworld/templates/courses/course_list.html @@ -43,21 +43,24 @@ $(document).ready(function() { "aoColumnDefs": [ { // 4th element: thanks - "aTargets": [ 3 ], + "aTargets": [ 6 ], "bSortable": true, - "bVisible": true + "bVisible": true, + "aDataSort": [ 3 ] }, { // 3rd element: notes - "aTargets": [ 2 ], + "aTargets": [ 5 ], "bSortable": true, - "bVisible": true + "bVisible": true, + "aDataSort": [ 2 ] }, { // 2nd element: date - "aTargets": [ 1 ], + "aTargets": [ 4 ], "bSortable": true, - "bVisible": true + "bVisible": true, + "aDataSort": [ 1 ] }, { // 1st element: "sort by" label @@ -67,7 +70,7 @@ $(document).ready(function() { } ], // Initial sorting - 'aaSorting': [[2,'desc']] + 'aaSorting': [[6,'desc']] }); $('.dataTables_filter input').attr("placeholder", "search courses"); // TODO: can't prepend html to .dataTables_filter input html for fontawesome search icon @@ -95,8 +98,11 @@ $(document).ready(function() { Sort by: + Date + # Notes + Popularity Date - #Notes + # Notes Popularity Upload Course Name diff --git a/karmaworld/templates/courses/course_list_entry.html b/karmaworld/templates/courses/course_list_entry.html index 18fd2fc..ac70db0 100644 --- a/karmaworld/templates/courses/course_list_entry.html +++ b/karmaworld/templates/courses/course_list_entry.html @@ -1,5 +1,9 @@ + {{ course.updated_at|date:"U" }} + {{ course.file_count|stringformat:"010g" }} + {{ course.get_popularity|stringformat:"010g" }} + Updated {{ course.updated_at|date:"b d, o"|capfirst }} {{ course.file_count }} Notes {{ course.get_popularity }} Thanks -- 2.25.1