Commit 9cf9165b by David Ormsbee

Merge pull request #545 from MITx/feature/rocky/discussion

some tiny bug fixes (delete & update follow)
parents f9616c6e ca09c742
...@@ -191,6 +191,8 @@ if Backbone? ...@@ -191,6 +191,8 @@ if Backbone?
comment = @model.addComment response.content comment = @model.addComment response.content
commentView = new CommentView el: $comment[0], model: comment commentView = new CommentView el: $comment[0], model: comment
comment.updateInfo response.annotated_content_info comment.updateInfo response.annotated_content_info
if autowatch
@model.get('thread').set('subscribed', true)
@cancelReply() @cancelReply()
cancelReply: -> cancelReply: ->
...@@ -330,9 +332,11 @@ if Backbone? ...@@ -330,9 +332,11 @@ if Backbone?
DiscussionUtil.safeAjax DiscussionUtil.safeAjax
$elem: $elem $elem: $elem
url: url url: url
type: "POST"
success: (response, textStatus) => success: (response, textStatus) =>
@$el.remove() @$el.remove()
@model.get('thread').removeComment(@model) if @model.get('type') == 'comment'
@model.get('thread').removeComment(@model)
events: events:
"click .discussion-follow-thread": "toggleFollow" "click .discussion-follow-thread": "toggleFollow"
......
...@@ -72,12 +72,10 @@ class @DiscussionUtil ...@@ -72,12 +72,10 @@ class @DiscussionUtil
params["beforeSend"] = -> params["beforeSend"] = ->
$elem.attr("disabled", "disabled") $elem.attr("disabled", "disabled")
if params["$loading"] if params["$loading"]
console.log "loading"
params["$loading"].loading() params["$loading"].loading()
$.ajax(params).always -> $.ajax(params).always ->
$elem.removeAttr("disabled") $elem.removeAttr("disabled")
if params["$loading"] if params["$loading"]
console.log "loaded"
params["$loading"].loaded() params["$loading"].loaded()
@get: ($elem, url, data, success) -> @get: ($elem, url, data, success) ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment