anthonymidili/Recipedia

View on GitHub
app/views/users/_profile_stats.html.haml

Summary

Maintainability
Test Coverage
= link_to user, class: 'black-text profile-stats-avatar' do
  - if user.avatar.attached?
    = image_tag avatar_image(user.avatar, size), class: 'img-thumbnail'
  - else
    %i.fas.fa-user{class: "default-avatar-#{size} img-thumbnail hide-on-print"}

.hide-on-print.profile-stats{id: "profile_stats_#{user.id}"}
  = link_to followers_user_path(user), class: 'stat' do
    %span{id: "followers_count_#{user.id}"}
      = user.followers.count
    followers
  = link_to following_user_path(user), class: 'stat' do
    %span{id: "following_count_#{user.id}"}
      = user.following.count
    following