Follow a thread

This commit is contained in:
Matthew Mongeau
2012-08-29 10:28:02 -04:00
parent a5b1abb2a8
commit 19b14f446b

View File

@@ -33,8 +33,18 @@ class @DiscussionThreadView extends Backbone.View
else
@unvote()
toggleFollowing: ->
toggleFollowing: (event) ->
$elem = $(event.target)
@$(".dogear").toggleClass("is-followed")
url = null
if @$(".dogear").hasClass("is-followed")
url = @model.urlFor("follow")
else
url = @model.urlFor("unfollow")
DiscussionUtil.safeAjax
$elem: $elem
url: url
type: "POST"
vote: ->
url = @model.urlFor("upvote")