Permalink
Browse files

clearified comments collection

  • Loading branch information...
1 parent 5989428 commit 8232f521185e5d20ef5d44a5a5228d5e6aeebb29 @dodo dodo committed Feb 28, 2012
Showing with 8 additions and 4 deletions.
  1. +6 −0 src/collections/post.coffee
  2. +2 −4 src/models/topicpost.coffee
@@ -17,3 +17,9 @@ class exports.Posts extends Collection
comparator: (post) ->
- new Date(post.get_last_update()).getTime()
+
+
+class exports.Comments extends exports.Posts
+ comparator: ->
+ -1 * super # comments have a reversed posts order
+
@@ -1,14 +1,12 @@
-{ Posts } = require '../collections/post'
+{ Comments } = require '../collections/post'
{ Post } = require './post'
##
# Is "opener" along with additional "comments"
class exports.TopicPost extends Post
initialize: ->
- @comments = new Posts parent:this
- @comments.comparator = (post) ->
- new Date(post.get_last_update()).getTime()
+ @comments = new Comments parent:this
# Bubble changes up:
@comments.bind 'all', =>

0 comments on commit 8232f52

Please sign in to comment.