41 lines
1.9 KiB
Text
41 lines
1.9 KiB
Text
<% cache("whole-comment-area-#{@article.id}-#{@article.last_comment_at}-#{@article.show_comments}-#{@discussion_lock&.updated_at}", expires_in: 2.hours) do %>
|
|
<section id="comments" data-follow-button-container="true" data-updated-at="<%= Time.current %>" class="text-padding mb-4 border-t-1 border-0 border-solid border-base-10">
|
|
<% if @article.show_comments %>
|
|
<header class="relative flex justify-between items-center mb-6">
|
|
<h2 class="crayons-subtitle-1">
|
|
<%= t("views.articles.comments.subtitle_html",
|
|
num: tag.span(t("views.articles.comments.num", num: @article.comments_count), class: "js-comments-count", data: { comments_count: @article.comments_count })) %>
|
|
</h2>
|
|
<div id="comment-subscription" class="print-hidden">
|
|
<div class="crayons-btn-group">
|
|
<span class="crayons-btn crayons-btn--outlined"><%= t("views.articles.comments.subscribe") %></span>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<div
|
|
id="comments-container"
|
|
data-testid="comments-container"
|
|
data-commentable-id="<%= @article.id %>"
|
|
data-commentable-type="Article"
|
|
data-has-recent-comment-activity="<%= @article.has_recent_comment_activity? %>">
|
|
|
|
<% if @discussion_lock %>
|
|
<%= render "/comments/discussion_lock_reason" %>
|
|
<% else %>
|
|
<%= render "/comments/form", commentable: @article, commentable_type: "Article" %>
|
|
<% end %>
|
|
|
|
<div class="comments" id="comment-trees-container">
|
|
<% if @article.comments_count > 0 %>
|
|
<%= render partial: "articles/comment_tree", collection: Comment.tree_for(@article, @comments_to_show_count), as: :comment_node, cached: proc { |comment, _sub_comments| comment } %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<%= render "articles/comments_actions" %>
|
|
<% end %>
|
|
</section>
|
|
<%= render "comments/hide_comments_modal" %>
|
|
<% end %>
|
|
<% return if @warm_only %>
|