fixes #1424 for comments
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
this.initialize_response_link();
|
this.initialize_response_link();
|
||||||
this.initialize_reply_links();
|
this.initialize_reply_links();
|
||||||
this.initialize_expand_links();
|
this.initialize_expand_links();
|
||||||
|
this.initialize_edit_links();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($("#c-posts").length && $("#a-show").length) {
|
if ($("#c-posts").length && $("#a-show").length) {
|
||||||
@@ -63,6 +64,16 @@
|
|||||||
$("div.new-comment form").hide();
|
$("div.new-comment form").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Danbooru.Comment.initialize_edit_links = function() {
|
||||||
|
$(".edit_comment").hide();
|
||||||
|
$(".edit_comment_link").click(function(e) {
|
||||||
|
var link_id = $(this).attr("id");
|
||||||
|
var comment_id = link_id.match(/^edit_comment_link_(\d+)$/)[1];
|
||||||
|
$("#edit_comment_" + comment_id).toggle();
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Danbooru.Comment.highlight_threshold_comments = function(post_id) {
|
Danbooru.Comment.highlight_threshold_comments = function(post_id) {
|
||||||
var threshold = parseInt(Danbooru.meta("user-comment-threshold"));
|
var threshold = parseInt(Danbooru.meta("user-comment-threshold"));
|
||||||
var articles = $("article.comment[data-post-id=" + post_id + "]");
|
var articles = $("article.comment[data-post-id=" + post_id + "]");
|
||||||
|
|||||||
5
app/views/comments/_edit.html.erb
Normal file
5
app/views/comments/_edit.html.erb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<%= simple_form_for(comment) do |f| %>
|
||||||
|
<%= dtext_field "comment", "body", :value => comment.body, :input_id => "comment_body_for_#{comment.id}", :preview_id => "dtext-preview-for-#{comment.id}" %>
|
||||||
|
<%= f.button :submit, "Submit" %>
|
||||||
|
<%= dtext_preview_button "comment", "body", :input_id => "comment_body_for_#{comment.id}", :preview_id => "dtext-preview-for-#{comment.id}" %>
|
||||||
|
<% end %>
|
||||||
@@ -20,12 +20,15 @@
|
|||||||
<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(:post_id => comment.post_id), :class => "reply-link", "data-comment-id" => comment.id %></li>
|
||||||
<% if comment.editable_by?(CurrentUser.user) %>
|
<% if comment.editable_by?(CurrentUser.user) %>
|
||||||
<li><%= link_to "Delete", comment_path(comment.id), :confirm => "Are you sure you want to delete this comment?", :method => :delete, :remote => true %></li>
|
<li><%= link_to "Delete", comment_path(comment.id), :confirm => "Are you sure you want to delete this comment?", :method => :delete, :remote => true %></li>
|
||||||
<li><%= link_to "Edit", edit_comment_path(comment.id) %></li>
|
<li><%= link_to "Edit", edit_comment_path(comment.id), :id => "edit_comment_link_#{comment.id}", :class => "edit_comment_link" %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li id="comment-vote-up-link-for-<%= comment.id %>"><%= link_to "Vote up", comment_votes_path(:comment_id => comment.id, :score => "up"), :method => :post, :remote => true %></li>
|
<li id="comment-vote-up-link-for-<%= comment.id %>"><%= link_to "Vote up", comment_votes_path(:comment_id => comment.id, :score => "up"), :method => :post, :remote => true %></li>
|
||||||
<li id="comment-vote-down-link-for-<%= comment.id %>"><%= link_to "Vote down", comment_votes_path(:comment_id => comment.id, :score => "down"), :method => :post, :remote => true %></li>
|
<li id="comment-vote-down-link-for-<%= comment.id %>"><%= link_to "Vote down", comment_votes_path(:comment_id => comment.id, :score => "down"), :method => :post, :remote => true %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</menu>
|
</menu>
|
||||||
|
<% if comment.editable_by?(CurrentUser.user) %>
|
||||||
|
<%= render "comments/edit", :comment => comment %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user