Add sortable columns to the dashboard and review request lists

Review Request #106 — Created July 1, 2007 and submitted

Information

Review Board SVN (deprecated)
trunk

Reviewers

Added support for sorting review requests in the dashboard and various lists (submitters, groups, all). The columns are now clickable and will cause the list to sort.

Up to three columns can be taken into consideration for sorting at any given point. We update the columns when clicked as follows:

* If the column is not in the existing sort list, it becomes the primary sort column and we display a large down arrow.
* If the column is in the existing sort list and is the primary sort column, we reverse the order of the column and display a large up arrow.
* If the column is in the sort list but is not the primary sort column, we make it the primary sort column, and we don't reverse the order.

We save a cookie every time the order changes and use that next time unless a ?sort= parameter is set.
Sorted various columns and messed with each case above. Appears to work correctly.
david
  1. You're not going to be happy :(
  2. /trunk/reviewboard/reviews/views.py (Diff revision 4)
     
     
    Hah
  3. /trunk/reviewboard/reviews/views.py (Diff revision 4)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Hmm.  I really don't like using the BogusQuerySet for all of the views.  When possible (everything except the "All Incoming Review Requests" page), we should let the database do the sort/limit.
    
    What this evaluates to is basically "SELECT * FROM blah", when what we want is "SELECT * FROM blah ORDER BY blah blah blah LIMIT blah".  MySQL's finely tuned C code will be faster doing this than your python ;)
    
    When I named that object, it was in the Toejam & Earl sense of the word "Bogus", like when you eat a moldy cheeseburger.
    1. As discussed in IRC, we are using the order_by() stuff. This just provides an implementation of this for BogusQuerySet. It accomplishes the same thing but operates on a list. I've now updated the code so we only use BogusQuerySet in the one case where we need it, falling back on QuerySets in other cases. This is more efficient for those other cases and will let us take advantage of the database sorting in almost all cases.
  4. /trunk/reviewboard/utils/templatetags/htmlutils.py (Diff revision 4)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Can you use HTML entities for these instead?
    1. Updated to use entities.
  5. 
      
david
  1. Looks great
    1. I was more happy than either of us thought!
      
      Thanks for the review.
  2. No need for this anymore.
    1. Fixed this but was too lazy to re-upload a new diff.
  3.