docbrown/app/views/users/_comments_section.html.erb
yheuhtozr a93e9f1aa7
I18nize users (non-settings) & logo designer (#15078)
* users (mostly non-settings), logo designer i18n

* remove ja.yml

* Update _profile.html.erb

* Update _metadata.html.erb

* Update _sidebar.html.erb

* Update en.yml

* Update fr.yml

* Apply suggestions from code review

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Update _profile.html.erb

* Update en.yml

* Update fr.yml

* Update _logo_design.html.erb

Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-10-27 17:11:28 -04:00

58 lines
2.4 KiB
Text

<% cache("user-profile-comments-#{@user.last_comment_at}-#{@user.id}-#{@comments.size}", expires_in: 2.days) do %>
<div class="profile-comment-card crayons-card mt-2 m:mt-0 mb-2">
<% if @comments.present? %>
<% if params[:view] == "comments" %>
<div class="crayons-card__header">
<h3 class="crayons-subtitle-2">
<% if high_number_of_comments?(@user.comments_count) %>
<%= t("views.users.comments.last", count: number_of_comments_to_render) %>
<% else %>
<%= t("views.users.comments.all", count: @user.comments_count) %>
<% end %>
</h3>
<div class="crayons-card__actions">
<a href="<%= @user.path %>" class="crayons-link--branded fs-base">
<%= t("views.users.comments.view") %>
</a>
</div>
</div>
<% else %>
<div class="crayons-card__header">
<h3 class="crayons-subtitle-2">
<%= t("views.users.comments.recent") %>
</h3>
</div>
<% end %>
<% end %>
<% @comments.each do |comment| %>
<% if comment.commentable.present? && comment.commentable.published && !comment.deleted %>
<a href="<%= comment.path %>" class="profile-comment-row ">
<h4 class="fw-bold fs-base m-0 mb-1">
<%= comment.commentable.title %>
</h4>
<div class="flex items-center fs-s">
<p class="color-base-80">
<%= truncate(strip_tags(comment.processed_html), length: 64).html_safe %>
<p>
<small class="ml-2 color-base-60 fs-s comment-date whitespace-nowrap">
<time datetime="<%= comment.decorate.published_timestamp %>"><%= comment.readable_publish_date %></time>
</small>
</div>
</a>
<% end %>
<% end %>
<% if params[:view] != "comments" && high_number_of_comments?(@user.comments_count) %>
<div class="pt-3 pl-4 pb-3 pr-4">
<a href="<%= @user.path %>/comments" class="fs-base">
<%= t("views.users.comments.view_last", count: number_of_comments_to_render) %>
</a>
</div>
<% elsif params[:view] != "comments" && view_all_comments?(@user.comments_count) %>
<div class="py-3 px-4">
<a href="<%= @user.path %>/comments" class="fs-base">
<%= t("views.users.comments.view_all", count: @user.comments_count) %>
</a>
</div>
<% end %>
</div>
<% end %>