diff --git a/lms/static/coffee/src/discussion/views/response_comment_view.coffee b/lms/static/coffee/src/discussion/views/response_comment_view.coffee index 5fff33e6bb..e797dd0d4d 100644 --- a/lms/static/coffee/src/discussion/views/response_comment_view.coffee +++ b/lms/static/coffee/src/discussion/views/response_comment_view.coffee @@ -8,7 +8,12 @@ if Backbone? @$delegateElement = @$local render: -> - @$el.html(@template(@model.toJSON())) + params = @model.toJSON() + params['deep'] = @options.deep + if @options.deep + params['parent_id'] = @options.parent.id + params['parent_username'] = @options.parent.get('username') + @$el.html(@template(params)) @initLocal() @delegateEvents() @renderAttrs() diff --git a/lms/static/coffee/src/discussion/views/thread_response_view.coffee b/lms/static/coffee/src/discussion/views/thread_response_view.coffee index feedbb6f6d..4fd839ad2d 100644 --- a/lms/static/coffee/src/discussion/views/thread_response_view.coffee +++ b/lms/static/coffee/src/discussion/views/thread_response_view.coffee @@ -27,15 +27,15 @@ if Backbone? MathJax.Hub.Queue ["Typeset", MathJax.Hub, element[0]] renderComments: -> - @model.get("comments").each @renderComment + @model.get("comments").each (comment) => @renderComment(comment, false, null) - renderComment: (comment) => + renderComment: (comment, deep=false, parent=null) => comment.set('thread', @model.get('thread')) - view = new ResponseCommentView(model: comment) + view = new ResponseCommentView(model: comment, deep: deep, parent: parent) view.render() @$el.find(".comments li:last").before(view.el) children = new Comments(comment.get('children')) - children.each @renderComment + children.each (child) => @renderComment child, true, comment toggleVote: (event) -> diff --git a/lms/templates/discussion/_underscore_templates.html b/lms/templates/discussion/_underscore_templates.html index 0d906852cf..2c3585bb58 100644 --- a/lms/templates/discussion/_underscore_templates.html +++ b/lms/templates/discussion/_underscore_templates.html @@ -95,7 +95,13 @@