docbrown/app/views/articles/_full_comment_area.html.erb
2019-02-28 17:23:06 -05:00

29 lines
1.2 KiB
Text

<% cache("whole-comment-area-#{@article.id}-#{@article.last_comment_at}-#{@article.show_comments}", expires_in: 2.hours) do %>
<div id="comments" style="margin-top: -56px;padding-bottom:56px;position:relative;z-index:-100" data-updated-at="<%= Time.current %>"></div>
<% if @article.show_comments %>
<div class="comments-container-container">
<div
class="comments-container"
id="comments-container"
data-commentable-id="<%= @article.id %>"
data-commentable-type="Article">
<%= render "/comments/form",
commentable: @article,
commentable_type: "Article" %>
<div class="comment-trees" id="comment-trees-container">
<% if @article.comments_count > 0 %>
<% Comment.tree_for(@article, @comments_to_show_count).each do |comment, sub_comments| %>
<% cache ["comment_root_cached_tree", comment] do %>
<%= tree_for(comment, sub_comments, @article) %>
<% end %>
<% end %>
<% end %>
</div>
</div>
<div class="show-comments-footer">
<%= render "articles/comments_actions" %>
</div>
</div>
<% end %>
<% end %>
<% return if @warm_only %>