         @listenTo( @newPostView, 'newPost:cancel', @hideNewPost )
         $('.new-post-btn').bind "click", @showNewPost
         $('.new-post-btn').bind "keydown", (event) => DiscussionUtil.activateOnSpace(event, @showNewPost)
+
+    getSingleThreadRoute: (commentable_id, thread_id) ->
+      base_route = "#{commentable_id}/threads/#{thread_id}"
+      if DiscussionUtil.route_prefix
+        base_route = "#{DiscussionUtil.route_prefix}/#{base_route}"
+      base_route
 
     allThreads: ->
       @nav.updateSidebar()


    navigateToThread: (thread_id) =>
      thread = @discussion.get(thread_id)
      @navigate("#{DiscussionUtil.route_prefix}#{thread.get("commentable_id")}/threads/#{thread_id}", trigger: true)

    navigateToAllThreads: =>
      @navigate("#{DiscussionUtil.route_prefix}", trigger: true)

    showNewPost: (event) =>
      $('.forum-content').fadeOut(

if Backbone?
  class @DiscussionRouter extends Backbone.Router
    initialize: (options) ->
        @allThreadsRoute = DiscussionUtil.route_prefix
        @singleThreadRoute = @getSingleThreadRoute(":forum_name", ":thread_id")

        @route(@allThreadsRoute, "allThreads")
        @route(@singleThreadRoute, "showThread")

        @discussion = options['discussion']
        @course_settings = options['course_settings']
