fixed js error on new comments on statusmessage show page
This commit is contained in:
parent
f1f0d6e2ea
commit
7a2f6dae10
3 changed files with 6 additions and 16 deletions
|
|
@ -21,18 +21,7 @@ class CommentsController < ApplicationController
|
|||
Postzord::Dispatch.new(current_user, @comment).post
|
||||
|
||||
respond_to do |format|
|
||||
format.js{
|
||||
json = { :post_id => @comment.post_id,
|
||||
:comment_id => @comment.id,
|
||||
:html => render_to_string(
|
||||
:partial => 'comments/comment',
|
||||
:locals => { :comment => @comment,
|
||||
:person => current_user.person,
|
||||
}
|
||||
)
|
||||
}
|
||||
render(:json => json, :status => 201)
|
||||
}
|
||||
format.js{ render(:create, :status => 201)}
|
||||
format.html{ render :nothing => true, :status => 201 }
|
||||
format.mobile{ redirect_to @comment.post }
|
||||
end
|
||||
|
|
|
|||
5
app/views/comments/create.js.erb
Normal file
5
app/views/comments/create.js.erb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
WebSocketReceiver.processComment(<%= @comment.post_id %>,
|
||||
<%= @comment.id %>,
|
||||
"<%= escape_javascript(render(:partial => 'comments/comment', :locals => { :comment => @comment, :person => current_user.person}))%>",
|
||||
false);
|
||||
|
||||
|
|
@ -89,10 +89,6 @@ var Stream = {
|
|||
}
|
||||
});
|
||||
|
||||
$(stream_string + " .new_comment").live('ajax:success', function(data, json, xhr) {
|
||||
json = $.parseJSON(json);
|
||||
WebSocketReceiver.processComment(json.post_id, json.comment_id, json.html, false);
|
||||
});
|
||||
$(stream_string + ".new_comment").live('ajax:failure', function(data, html, xhr) {
|
||||
Diaspora.widgets.alert.alert('Failed to post message!');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue