Files
danbooru/app/views/posts/partials/show/_notices.html.erb
evazion 40711e1d4f posts/show: refactor parent/child notices.
* Convert notices from helpers to partials.
* Eliminate PostSets::PostRelationship class in favor of post_sets/posts template.
* Eliminate COUNT(*) queries when calculating the number of child posts.
* Eliminate redundant parent load and parent exists queries.
2020-01-12 18:38:38 -06:00

76 lines
3.0 KiB
Plaintext

<% if post.is_flagged? && !post.is_deleted? && post.flags.any? %>
<div class="notice notice-small post-notice post-notice-flagged">
<p>This post was flagged for review (<%= link_to_wiki "learn more", "howto:flag" %>): </p>
<%= render "post_flags/reasons", flags: post.flags %>
</div>
<% end %>
<% if post.is_banned? %>
<div class="notice notice-small post-notice post-notice-banned">
The artist requested removal of this page
</div>
<% end %>
<% if post.is_deleted? %>
<div class="notice notice-small post-notice post-notice-deleted">
<% if post.flags.any? %>
<p>This post was deleted for the following reasons: </p>
<%= render "post_flags/reasons", flags: post.flags %>
<% else %>
<p>This post was deleted</p>
<% end %>
<%= render "post_disapprovals/counts", :disapprovals => post.disapprovals, :post => post %>
<% if CurrentUser.id == post.uploader_id %>
<p>If you don't understand why your upload was deleted, you can ask for
advice in the Upload Feedback Thread on the forum.</p>
<% end %>
</div>
<% end %>
<% if post.is_pending? || post.is_flagged? %>
<div class="notice notice-small post-notice post-notice-pending">
<% if post.is_pending? %>
This post is pending approval.
(<%= link_to_wiki "learn more", "about:mod_queue" %>)
<% else %>
This post was flagged and is pending approval (<%= link_to_wiki "learn more", "about:mod_queue" %>)
<% end %>
<%= render "post_disapprovals/counts", :disapprovals => post.disapprovals, :post => post %>
<% if CurrentUser.can_approve_posts? && !post.disapproved_by?(CurrentUser.user) %>
<%= render "moderator/post/queues/quick_mod", post: post %>
<%= render "post_disapprovals/detailed_rejection_dialog" %>
<% end %>
</div>
<% end %>
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
<div class="notice notice-small post-notice post-notice-appealed">
<p>This post was appealed:</p>
<%= render "post_appeals/reasons", appeals: post.appeals %>
</div>
<% end %>
<% if post.parent.present? %>
<div class="notice notice-small post-notice post-notice-child">
<%= render "posts/partials/show/parent_notice", parent: post.parent, children: @sibling_posts.to_a %>
</div>
<% end %>
<% if post.has_visible_children? %>
<div class="notice notice-small post-notice post-notice-parent">
<%= render "posts/partials/show/child_notice", parent: post, children: @child_posts.to_a %>
</div>
<% end %>
<% if post.visible? && post.has_large? && !post.is_ugoira? %>
<div class="notice notice-small post-notice post-notice-resized" id="image-resize-notice" style="<%= CurrentUser.default_image_size == "original" ? "display: none;" : "" %>">
<span>Resized to <%= number_to_percentage post.resize_percentage.floor, :precision => 0 %> of original (<%= link_to "view original", post.tagged_file_url, :id => "image-resize-link" %>)</span>
<span style="display: none;">Loading...</span>
</div>
<% end %>