Browse files

Fix filtering for following column on all-users page. Issue #202.

  • Loading branch information...
1 parent 7805acc commit 51ef71d386e138aabafe7f0a0b14b6bd8c81a76e @nbeloglazov nbeloglazov committed Sep 1, 2012
Showing with 8 additions and 3 deletions.
  1. +1 −1 resources/public/script/foreclojure.js
  2. +7 −2 src/foreclojure/users.clj
View
2 resources/public/script/foreclojure.js
@@ -166,7 +166,7 @@ function configureDataTables(){
null,
null,
null,
- {"bSortable": false}
+ null
],
"iDisplayLength":100,
"bProcessing": true,
View
9 src/foreclojure/users.clj
@@ -249,8 +249,13 @@
(defn datatable-paging [start length users]
(take length (drop start users)))
-(let [column-sorts [:rank :user (comp count :solved)]]
- (defn datatable-sort-cols [sort-col users]
+(defn get-sort-by-following-fn []
+ (let [following (if-user [{:keys [following]}]
+ (set following))]
+ #(if (following (:_id %)) -1 1)))
+
+(defn datatable-sort-cols [sort-col users]
+ (let [column-sorts [:rank :user (comp count :solved) (get-sort-by-following-fn)]]
(if-let [sort-fn (get column-sorts sort-col)]
(sort-by sort-fn users)
users)))

0 comments on commit 51ef71d

Please sign in to comment.