Fix sorting on course list
authorCharles Connell <charles@connells.org>
Tue, 18 Mar 2014 21:14:01 +0000 (17:14 -0400)
committerCharles Connell <charles@connells.org>
Tue, 18 Mar 2014 21:14:11 +0000 (17:14 -0400)
karmaworld/templates/courses/course_list.html
karmaworld/templates/courses/course_list_entry.html

index c7d16ed7c5ce4085a93bf25ef33f82c982e9ee22..8ae1ab97eaf786bd87d28e2e27abccbccddc9cd1 100644 (file)
@@ -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() {
         <thead>
           <tr>
             <th id="data-table-sort-by"> Sort by: </th>
+            <th class="no-display" id="data-table-date-hidden"> Date </th>
+            <th class="no-display" id="data-table-note-count-hidden"> # Notes </th>
+            <th class="no-display" id="data-table-thanks-hidden"> Popularity </th>
             <th id="data-table-date"> Date </th>
-            <th id="data-table-note-count"> #Notes </th>
+            <th id="data-table-note-count"> # Notes </th>
             <th id="data-table-thanks"> Popularity </th>
             <th class="no-display" id="data-table-upload"> Upload </th>
             <th class="no-display" id="data-table-course-name"> Course Name </th>
index 18fd2fca2588fc105c88eecb898f7ffd051d6b34..ac70db09e51434a47772388292a712a3ce46aa75 100644 (file)
@@ -1,5 +1,9 @@
 <tr>
   <td class="no-display"><!-- this spot solely for the Sort By header --></td>
+  <td class="no-display">{{ course.updated_at|date:"U" }}</td>
+  <td class="no-display">{{ course.file_count|stringformat:"010g" }}</td>
+  <td class="no-display">{{ course.get_popularity|stringformat:"010g" }}</td>
+
   <td class="small-8 columns large-4 slim"><span>Updated {{ course.updated_at|date:"b d, o"|capfirst }}</span></td>
   <td class="small-4 columns large-2 large-offset-2 slim"><span>{{ course.file_count }} Notes</span></td>
   <td class="small-4 columns large-2 large-offset-1 slim"><span>{{ course.get_popularity }} Thanks</span></td>