fix deep comment links
This commit is contained in:
@@ -7,12 +7,6 @@ if Backbone?
|
||||
@template = _.template($("#response-comment-show-template").html())
|
||||
params = @model.toJSON()
|
||||
|
||||
# Only things that are nested under comments get parents
|
||||
params['deep'] = @model.hasOwnProperty('parent')
|
||||
if @model.hasOwnProperty('parent')
|
||||
params['parent_id'] = @model.parent.id
|
||||
params['parent_username'] = @model.parent.get('username')
|
||||
|
||||
@$el.html(@template(params))
|
||||
@initLocal()
|
||||
@delegateEvents()
|
||||
@@ -20,8 +14,15 @@ if Backbone?
|
||||
@markAsStaff()
|
||||
@$el.find(".timeago").timeago()
|
||||
@convertMath()
|
||||
@addReplyLink()
|
||||
@
|
||||
|
||||
addReplyLink: () ->
|
||||
if @model.hasOwnProperty('parent')
|
||||
html = "<a href='#comment_#{@model.parent.id}'>@#{@model.parent.get('username')}</a>: "
|
||||
p = @$('.response-body p:first')
|
||||
p.prepend(html)
|
||||
|
||||
convertMath: ->
|
||||
body = @$el.find(".response-body")
|
||||
body.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight body.html()
|
||||
|
||||
@@ -118,9 +118,6 @@
|
||||
|
||||
<script type="text/template" id="response-comment-show-template">
|
||||
<div id="comment_${'<%- id %>'}">
|
||||
${'<% if (deep) {%>'}
|
||||
<a href="#comment_${'<%- parent_id %>'}">@${'<%- parent_username %>'}</a>:
|
||||
${'<% }%>'}
|
||||
<div class="response-body">
|
||||
${'<%- body %>'}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user