pundit: convert comments to pundit.
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
<%= error_messages_for :comment %>
|
||||
|
||||
<%= edit_form_for(comment, html: { style: ("display: none;" if local_assigns[:hidden]), class: "edit_comment" }) do |f| %>
|
||||
<%= f.hidden_field :post_id %>
|
||||
<% if comment.new_record? %>
|
||||
<%= f.hidden_field :post_id %>
|
||||
<% end %>
|
||||
<%= dtext_field "comment", "body", :classes => "autocomplete-mentions", :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}" %>
|
||||
<% if comment.new_record? %>
|
||||
<%= f.input :do_not_bump_post, :label => "No bump" %>
|
||||
<% end %>
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
<% if policy(comment).can_sticky_comment? %>
|
||||
<%= f.input :is_sticky, :label => "Post as moderator", :for => "comment_is_sticky" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if CurrentUser.is_member? %>
|
||||
<% if policy(Comment).create? %>
|
||||
<div class="new-comment">
|
||||
<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 %>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
<%= render "application/update_notice", record: comment %>
|
||||
|
||||
<% if CurrentUser.is_member? %>
|
||||
<% if policy(comment).create? %>
|
||||
<menu>
|
||||
<% if context == :index_by_comment %>
|
||||
<li><%= link_to "Reply", new_comment_path(id: comment, comment: { post_id: comment.post_id }), class: "reply-link" %></li>
|
||||
@@ -39,7 +39,7 @@
|
||||
<li><%= link_to "Reply", new_comment_path(id: comment, comment: { post_id: comment.post_id }), class: "reply-link", remote: true %></li>
|
||||
<% end %>
|
||||
|
||||
<% if comment.editable_by?(CurrentUser.user) %>
|
||||
<% if policy(comment).update? %>
|
||||
<% if comment.is_deleted? %>
|
||||
<li><%= link_to "Undelete", undelete_comment_path(comment.id), method: :post, remote: true %></li>
|
||||
<% else %>
|
||||
@@ -60,7 +60,7 @@
|
||||
<li><%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Comment", model_id: comment.id }), remote: true %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
<% if comment.editable_by?(CurrentUser.user) %>
|
||||
<% if policy(comment).update? %>
|
||||
<%= render "comments/form", comment: comment, hidden: true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user