* Initial work * Add special exceptions * Clean up and progress * Update github url Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com> * Add tests and finalize data update script * Fix test * Add some tests * Fix display_area test * Adjust spec * Fix svg title Co-authored-by: Molly Struve <mollylbs@gmail.com> Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
66 lines
3.3 KiB
Text
66 lines
3.3 KiB
Text
<div class="gap-2 m:gap-4 hidden m:grid js-user-info">
|
|
<% cache "user-profile-sidebar-additional-#{@user.id}-#{@user.github_repos_updated_at}-#{@user.badge_achievements_count}-#{@user.organization_info_updated_at}", expires_in: 2.days do %>
|
|
<% if @user.organizations.present? %>
|
|
<div class="crayons-card crayons-card--secondary">
|
|
<header class="crayons-card__header">
|
|
<h3 class="crayons-subtitle-3 spec-org-titles">Organizations</h3>
|
|
</header>
|
|
<div>
|
|
<%# it's unlikely that a user will belong to enough organizations to cause a performance issue here %>
|
|
<%# More info regarding the `.present?/.each` pattern: https://www.speedshop.co/2019/01/10/three-activerecord-mistakes.html %>
|
|
<% @user.organizations.each do |organization| %>
|
|
<a href="/<%= organization.slug %>" class="flex items-center crayons-link crayons-link--contentful">
|
|
<span class="crayons-logo crayons-logo--l mr-2 shrink-0">
|
|
<img src="<%= Images::Profile.call(organization.profile_image_url, length: 90) %>" alt="<%= organization.name %> profile image" class="crayons-logo__image">
|
|
</span>
|
|
<h4 class="fs-base fw-medium"><%= organization.name %></h4>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%= render partial: "users/github_repositories_area", locals: { repositories: repositories } %>
|
|
|
|
<% if @user.badge_achievements_count.positive? %>
|
|
<%= render partial: "users/badges_area", locals: {
|
|
achievements: @user.badge_achievements.order(id: :desc).includes(:badge),
|
|
count: @user.badge_achievements_count,
|
|
limit: @badges_limit
|
|
} %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% cache "user-profile-sidebar-profile-details-#{@user.id}-#{@user.profile_updated_at}", expires_in: 10.days do %>
|
|
<% @profile.ui_attributes_for(area: :left_sidebar).each do |title, value| %>
|
|
<div class="crayons-card crayons-card--secondary">
|
|
<header class="crayons-card__header">
|
|
<h3 class="crayons-subtitle-3">
|
|
<%= sanitized_sidebar title.titleize %>
|
|
</h3>
|
|
</header>
|
|
|
|
<div class="crayons-card__body">
|
|
<%= sanitized_sidebar value %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% cache "user-profile-sidebar-stats-#{@user.id}-#{@user.last_article_at&.rfc3339}-#{@user.last_comment_at&.rfc3339}-#{@user.following_tags_count}-#{@user.last_followed_at&.rfc3339}", expires_in: 10.days do %>
|
|
<div class="crayons-card crayons-card--secondary p-4">
|
|
<div class="flex items-center mb-4">
|
|
<%= inline_svg_tag("post.svg", aria: true, class: "crayons-icon mr-3 color-base-50", title: "Post") %>
|
|
<%= pluralize @user.articles.published.size, "post" %> published
|
|
</div>
|
|
<div class="flex items-center mb-4">
|
|
<%= inline_svg_tag("comment.svg", aria: true, class: "crayons-icon mr-3 color-base-50", title: "Comment") %>
|
|
<%= pluralize @user.comments.where(deleted: false).size, "comment" %> written
|
|
</div>
|
|
<div class="flex items-center">
|
|
<%= inline_svg_tag("tag.svg", aria: true, class: "crayons-icon mr-3 color-base-50", title: "Tag") %>
|
|
<%= pluralize @user.decorate.cached_followed_tags.size, "tag" %> followed
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|