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.
This commit is contained in:
8
app/views/posts/partials/show/_child_notice.html.erb
Normal file
8
app/views/posts/partials/show/_child_notice.html.erb
Normal file
@@ -0,0 +1,8 @@
|
||||
This post has <%= link_to pluralize(children.length, "child"), posts_path(tags: "parent:#{parent.id}") %>
|
||||
|
||||
(<%= link_to_wiki "learn more", "help:post_relationships" %>)
|
||||
<%= link_to("« hide", "#", id: "has-children-relationship-preview-link") %>
|
||||
|
||||
<div id="has-children-relationship-preview">
|
||||
<%= post_previews_html([parent, *children], tags: "parent:#{parent.id}", show_deleted: true) %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user