comments.js: clean up comment quoting.
Replace Comment.quote with a remote new.js.erb call.
This commit is contained in:
11
app/views/comments/new.js.erb
Normal file
11
app/views/comments/new.js.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
var $div = $('div.comments-for-post[data-post-id="<%= @comment.post_id %>"] div.new-comment');
|
||||
$div.find(".expand-comment-response").click();
|
||||
|
||||
var $textarea = $div.find("textarea");
|
||||
var msg = "<%= j @comment.body %>";
|
||||
if ($textarea.val().length > 0) {
|
||||
msg = $textarea.val() + "\n\n" + msg;
|
||||
}
|
||||
|
||||
$textarea.val(msg);
|
||||
$textarea.selectEnd();
|
||||
@@ -24,7 +24,7 @@
|
||||
<% if CurrentUser.is_member? %>
|
||||
<menu>
|
||||
<% if @post || @posts %>
|
||||
<li><%= link_to "Reply", new_comment_path(:post_id => comment.post_id), :class => "reply-link", "data-comment-id" => comment.id %></li>
|
||||
<li><%= link_to "Reply", new_comment_path(id: comment, comment: { post_id: comment.post_id }), class: "reply-link", remote: true %></li>
|
||||
<% if comment.editable_by?(CurrentUser.user) %>
|
||||
<% if comment.is_deleted? %>
|
||||
<li><%= link_to "Undelete", undelete_comment_path(comment.id), :method => :post, :remote => true %></li>
|
||||
|
||||
Reference in New Issue
Block a user