Files
grecia/app/views/comments/create.js.erb
Juanjo Bazán dee2d0196b ancestries
moves to ancestry from acts_as_commentable_with_threading
2015-09-02 19:23:09 +02:00

12 lines
409 B
Plaintext

var comment_html = "<%= j(render @comment) %>"
<% if @comment.root? -%>
var commentable_id = '<%= dom_id(@commentable) %>';
App.Comments.reset_form(commentable_id);
App.Comments.add_comment(commentable_id, comment_html);
<% else -%>
var parent_id = '<%= "comment_#{@comment.parent_id}" %>';
App.Comments.reset_and_hide_form(parent_id);
App.Comments.add_reply(parent_id, comment_html);
<% end -%>