Permalink
Browse files

Add username sort to team page.

  • Loading branch information...
1 parent 76b7867 commit cb2b06aa6780c1e320cd94c72e474b29111dd1ec @chromakode chromakode committed Jun 13, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −0 reddit_about/data/team.json
  2. +6 −1 reddit_about/public/static/js/about/about-team.js
@@ -1,6 +1,7 @@
{
"sorts": [
{"id": "random", "title": "random", "dir": 1},
+ {"id": "username", "title": "username", "dir": 1},
{"id": "new", "title": "new", "dir": -1},
{"id": "top", "title": "top", "dir": -1},
{"id": "beard", "title": "beard", "dir": -1},
@@ -65,7 +65,12 @@ SortableCollection = Backbone.Collection.extend({
if (!sort) {
return
}
- return sort.get('dir') * model.get(sort.id) || model.get('random')
+
+ var sortVal = model.get(sort.id)
+ if (_.isNumber(sortVal)) {
+ sortVal = sortVal * sort.get('dir')
+ }
+ return sortVal || model.get('random')
}
})

0 comments on commit cb2b06a

Please sign in to comment.