comments.js: clean up comment quoting.

Replace Comment.quote with a remote new.js.erb call.
This commit is contained in:
evazion
2018-09-29 12:16:29 -05:00
parent 75232c0cd4
commit 9ac59aeadd
4 changed files with 19 additions and 30 deletions

View 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();

View File

@@ -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>