Get highlighting working.

This commit is contained in:
Matthew Mongeau
2012-09-04 14:26:37 -04:00
parent ffab52be36
commit 0129be36c9
2 changed files with 9 additions and 0 deletions

View File

@@ -23,6 +23,8 @@ class @DiscussionThreadView extends DiscussionContentView
Markdown.makeWmdEditor @$(".reply-body"), "", DiscussionUtil.urlFor("upload"), (text) -> DiscussionUtil.postMathJaxProcessor(text)
@convertMath()
@renderResponses()
@highlight @$(".post-body")
@highlight @$("h1")
@
renderDogear: ->
@@ -151,3 +153,6 @@ class @DiscussionThreadView extends DiscussionContentView
type: "POST"
success: (response, textStatus) =>
@model.set('endorsed', not endorsed)
highlight: (el) ->
el.html(el.html().replace(/&lt;mark&gt;/g, "<mark>").replace(/&lt;\/mark&gt;/g, "</mark>"))

View File

@@ -12,6 +12,7 @@ class @ThreadListItemView extends Backbone.View
@$el.html(@template(@model.toJSON()))
if window.user.following(@model)
@follow()
@highlight @$(".title")
@
threadSelected: (event) ->
event.preventDefault()
@@ -25,3 +26,6 @@ class @ThreadListItemView extends Backbone.View
addComment: =>
@$(".comments-count").html(parseInt(@$(".comments-count").html()) + 1)
highlight: (el) ->
el.html(el.html().replace(/&lt;mark&gt;/g, "<mark>").replace(/&lt;\/mark&gt;/g, "</mark>"))