Files
danbooru/app/views/comments/_index_by_comment.html.erb
2021-01-16 01:02:42 -06:00

20 lines
932 B
Plaintext

<div id="p-index-by-comment" class="comments-for-post">
<div class="list-of-comments list-of-messages">
<% dtext_data = DText.preprocess(@comments.map(&:body)) %>
<% @comments.each do |comment| %>
<% if CurrentUser.is_moderator? || (params[:search] && params[:search][:is_deleted] =~ /t/) || !comment.is_deleted? %>
<%= tag.div id: "post_#{comment.post.id}", **PostPreviewComponent.new(post: comment.post).article_attrs("post") do %>
<div class="preview">
<% if policy(comment.post).visible? %>
<%= link_to(image_tag(comment.post.preview_file_url), post_path(comment.post)) %>
<% end %>
</div>
<%= render_comment(comment, dtext_data: dtext_data, context: :index_by_comment, show_deleted: params.dig(:search, :is_deleted).to_s.truthy?) %>
<% end %>
<% end %>
<% end %>
</div>
</div>
<%= numbered_paginator(@comments) %>