docbrown/app/views/comments/_comment_footer.html.erb
Suzanne Aitchison fd690982cf
Hide like text if no likes on comment (#18322)
* set label to empty if no likes

* update spec

* fix styling issues when text is removed

* fix missed test text
2022-08-12 15:19:53 +01:00

39 lines
2.3 KiB
Text

<footer class="comment__footer print-hidden">
<button
class="crayons-tooltip__activator crayons-btn crayons-btn--ghost crayons-btn--icon<%= comment.public_reactions_count.zero? ? "" : "-left" %> crayons-btn--s mr-1 reaction-like inline-flex reaction-button"
id="button-for-comment-<%= comment.id %>"
data-comment-id="<%= comment.id %>"
aria-label="<%= t("views.comments.footer.heart.aria_label") %>"
data-tracking-name="comment_heart_button">
<%= crayons_icon_tag("small-heart",
class: "reaction-icon not-reacted",
title: t("views.comments.footer.heart.icon")) %>
<%= crayons_icon_tag("small-heart-filled", class: "crayons-icon reaction-icon--like reaction-icon reacted", title: t("views.comments.footer.heart.icon")) %>
<%= t("views.comments.footer.heart.count_html", num: tag.span((comment.public_reactions_count if comment.public_reactions_count.positive?), class: "reactions-count"), likes: tag.span(like_button_text(comment).html_safe, class: "reactions-label hidden m:inline-block")) %>
<span data-testid="tooltip" class="crayons-tooltip__content">
<%= t("views.comments.footer.heart.title") %>
</span>
</button>
<% unless @discussion_lock %>
<% if (comment.depth < 2 || is_childless) %>
<a
class="actions crayons-btn crayons-btn--ghost crayons-btn--s crayons-btn--icon-left toggle-reply-form mr-1 inline-flex"
href="#<%= commentable.path %>/comments/new/<%= comment.id_code_generated %>"
data-comment-id="<%= comment.id %>"
data-path="<%= commentable.path %>/comments/<%= comment.id_code_generated %>"
data-tracking-name="comment_reply_button"
data-testid="reply-button-<%= comment.id %>"
rel="nofollow">
<%= crayons_icon_tag("small-comment", class: "reaction-icon not-reacted", title: t("views.comments.footer.reply.icon")) %>
<span class="hidden m:inline-block"><%= t("views.comments.footer.reply.text") %></span>
</a>
<% else %>
<span class="fs-s inline-flex items-center fs-italic color-base-50 pl-1">
<%= crayons_icon_tag("small-thread", title: t("views.comments.footer.thread.icon")) %>
<%= t("views.comments.footer.thread.text") %>
</span>
<% end %>
<% end %>
</footer>