comments: add standalone new comment form.

Add standalone /comments/new page to allow commenting if javascript is
disabled.
This commit is contained in:
evazion
2018-09-29 14:24:17 -05:00
parent 9ac59aeadd
commit dfb7cf6994
3 changed files with 15 additions and 2 deletions

View File

@@ -106,6 +106,6 @@ private
permitted_params += %i[is_deleted] if context == :update
permitted_params += %i[is_sticky] if CurrentUser.is_moderator?
params.require(:comment).permit(permitted_params)
params.fetch(:comment, {}).permit(permitted_params)
end
end

View File

@@ -0,0 +1,13 @@
<div id="c-comments">
<div id="a-new">
<h1>New Comment</h1>
<%= render "comments/form", comment: @comment %>
</div>
</div>
<%= render "secondary_links" %>
<% content_for(:page_title) do %>
New Comment - <%= Danbooru.config.app_name %>
<% end %>

View File

@@ -27,7 +27,7 @@
<% if CurrentUser.is_member? %>
<div class="new-comment">
<p><%= link_to "Post comment", new_comment_path, :class => "expand-comment-response" %></p>
<p><%= link_to "Post comment", new_comment_path(comment: { post_id: post.id }), :class => "expand-comment-response" %></p>
<%= render "comments/form", comment: post.comments.new, hidden: true %>
</div>
<% end %>