Files
nairobi/app/components/shared/comments_component.html.erb
Javi Martín 93f3411a30 Use anchors in comments order and pagination links
It was a bit frustrating to click on one of the order elements or the
link to the next page and having to scroll down again until reaching the
comments.
2021-06-28 00:15:06 +02:00

18 lines
590 B
Plaintext

<% cache cache_key do %>
<div class="row comments">
<div id="comments" class="small-12 column">
<%= content %>
<% if current_user %>
<%= render "comments/form", { commentable: record, parent_id: nil } %>
<% else %>
<%= render "shared/login_to_comment" %>
<% end %>
<%= render Shared::OrderLinksComponent.new("comments", anchor: "comments") %>
<%= render "comments/comment_list", comments: comment_tree.root_comments %>
<%= paginate comment_tree.root_comments, params: { anchor: "comments" } %>
</div>
</div>
<% end %>