Commit 5427d9a5 by Matthew Mongeau

Keep active thread active

parent e98f1e87
......@@ -7,18 +7,23 @@ class @DiscussionRouter extends Backbone.Router
@discussion = options['discussion']
@nav = new DiscussionThreadListView(collection: @discussion, el: $(".sidebar"))
@nav.on "thread:selected", @navigateToThread
@nav.on "threads:rendered", @setActiveThread
@nav.render()
allThreads: ->
true
setActiveThread: =>
if @thread
@nav.setActiveThread(@thread.get("id"))
showThread: (forum_name, thread_id) ->
@nav.setActiveThread(thread_id)
thread = @discussion.get(thread_id)
@thread = @discussion.get(thread_id)
@setActiveThread()
if(@main)
@main.undelegateEvents()
@main = new DiscussionThreadView(el: $(".discussion-column"), model: thread)
@main = new DiscussionThreadView(el: $(".discussion-column"), model: @thread)
@main.render()
navigateToThread: (thread_id) =>
......
......@@ -15,6 +15,7 @@ class @DiscussionThreadListView extends Backbone.View
renderThreads: =>
@$(".post-list").html("")
@collection.each @renderThreadListItem
@trigger "threads:rendered"
renderThreadListItem: (thread) =>
view = new ThreadListItemView(model: thread)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment