docbrown/app/views/users/_sidebar.html.erb
Ben Halpern 71a419e5ee
Add profile_updated_at and github_repos_updated_at to avoid extra fet… (#1754)
* Add profile_updated_at and github_repos_updated_at to avoid extra fetches

* Fix variant_number issue

* Fix test
2019-02-06 20:39:15 -04:00

62 lines
2.1 KiB
Text

<div id="sidebar-wrapper-left" class="sidebar-wrapper sidebar-wrapper-left">
<div class="sidebar-bg" id="sidebar-bg-left"></div>
<div class="side-bar">
<div class="user-sidebar">
<% cache "user-profile-sidebar-profile-details-#{@user.profile_updated_at}", expires_in: 10.days do %>
<% if @user.mostly_work_with.present? %>
<div class="widget">
<header>
<h4>skills/languages</h4>
</header>
<div class="widget-body">
<%= sanitized_sidebar @user.mostly_work_with %>
</div>
</div>
<% end %>
<% if @user.currently_learning.present? %>
<div class="widget">
<header>
<h4>learning/trying</h4>
</header>
<div class="widget-body">
<%= sanitized_sidebar @user.currently_learning %>
</div>
</div>
<% end %>
<% if @user.currently_hacking_on.present? %>
<div class="widget">
<header>
<h4>projects and hacks</h4>
</header>
<div class="widget-body">
<%= sanitized_sidebar @user.currently_hacking_on %>
</div>
</div>
<% end %>
<% if @user.available_for.present? %>
<div class="widget">
<header>
<h4>available for</h4>
</header>
<div class="widget-body">
<%= sanitized_sidebar @user.available_for %>
</div>
</div>
<% end %>
<% end %>
<% cache "user-profile-sidebar-stats-#{@user.last_article_at}-#{@user.last_comment_at}-#{@user.last_followed_at}", expires_in: 10.days do %>
<div class="sidebar-data">
<div>
<%= pluralize @user.articles.where(published: true).size, "Post" %> Published
</div>
<div>
<%= pluralize @user.comments.where(deleted: false).size, "Comment" %> Written
</div>
<div>
<%= pluralize @user.decorate.cached_followed_tags.size, "Tag" %> Followed
</div>
</div>
<% end %>
</div>
</div>
</div>