docbrown/app/views/comments/_comment.html.erb
Ben Halpern f4c48fc83b
Add new article billboard locations (#20878)
* Initial work

* Add new billboard locations

* Clean up formatting
2024-04-22 13:58:39 -04:00

44 lines
2.3 KiB
Text

<% if comment && comment.user %>
<% if @current_comment_index.to_i > 6 && !@shown_billboard && comment.depth.zero? %>
<div class="js-billboard-container mid-comments-billboard-container pb-6" data-async-url="<%= article_billboard_path(username: @article.username, slug: @article.slug, placement_area: :post_comments_mid) %>"></div>
<% @shown_billboard = true %>
<% end %>
<% if comment.depth < 3 %>
<details class="comment-wrapper js-comment-wrapper comment-wrapper--deep-<%= comment.depth %>
<%= comment_class(comment, is_view_root: is_view_root) %>
<%= should_be_hidden?(comment, @root_comment) ? "details-comment-hidden-by-commentable-user" : "" %>" open>
<summary aria-label="Toggle this comment (and replies)" data-tracking-name="expand_comment_toggle">
<span class="<% if comment.depth > 0 %>mx-0<% else %>m:mx-1<% end %> inline-block align-middle">
<%= crayons_icon_tag(:collapse, class: "expanded", title: t("views.comments.collapse")) %>
<%= crayons_icon_tag(:expand, class: "collapsed", title: t("views.comments.expand")) %>
</span>
<span class="js-collapse-comment-content inline-block align-middle"></span>
</summary>
<% end %>
<div
id="comment-node-<%= comment.id %>"
class="
comment single-comment-node
<%= "low-quality-comment" if comment.decorate.low_quality %>
<%= comment_class(comment, is_view_root: is_view_root) %>
comment--deep-<%= comment.depth %>
<%= "comment--too-deep" if comment.depth > 3 %>
"
data-comment-id="<%= comment.id %>"
data-path="<%= commentable&.path %>/comments/<%= comment.id_code_generated %>"
data-comment-author-id="<%= comment_user_id_unless_deleted comment %>"
data-content-user-id="<%= comment_user_id_unless_deleted comment %>">
<a name="comment-<%= comment.id_code %>" style="position: absolute; top: -8px;">&nbsp;</a>
<%= render("comments/comment_proper",
comment: comment,
commentable: commentable,
is_view_root: is_view_root,
is_childless: is_childless,
is_admin: is_admin,
subtree_html: subtree_html) %>
</div>
<% if comment.depth < 3 %>
</details>
<% end %>
<% @current_comment_index += 1 if @current_comment_index.present? %>
<% end %>