Created
November 28, 2014 01:46
-
-
Save caok/c99245bdb6a40c8d64c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render(:json => {:comment_html => render_to_string(:partial => "admin/comments/comment", :locals => {:comment => new_comment})}) and return | |
$("body") | |
.on('ajax:success', 'form.comment_form', function(e, response, status, xhr) { | |
var parent_id = $(this).data('parent_id'); | |
this.reset(); | |
var comment_list = parent_id ? $(".comments_"+parent_id) : $(this).siblings('ul.comments'); | |
comment_list.prepend(response.comment_html); | |
var comments_count = $(".comments_count_"+parent_id); | |
comments_count.html((1*comments_count.html())+1); | |
}) | |
.on('ajax:success', 'form.work_reference_form', function(e, response, status, xhr) { | |
var parent_id = $(this).data('parent_id'); | |
this.reset(); | |
$("#work_reference_"+parent_id).html(response.work_reference_html); | |
window.initialize_editables(); | |
}) | |
.on('click', 'form.comment_form .morelink', function(){ | |
var $this = $(this); | |
setTimeout(function(){$this.closest('form').find('textarea').focus()}, 100) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment