app/views/users/_header.html.erb
<div class="btn-group float-right" role="group" style="position:absolute;right:15px;z-index:1">
<% if current_user == @user %>
<%= link_to edit_user_path(@user), class: 'btn btn-outline-primary', role: 'button' do %>
<%= fa_icon("pencil") %> Edit profile
<% end %>
<% elsif @user.followers.include?(current_user) %>
<%= link_to "Unfollow", unfollow_user_path(@user), method: :put, class: 'btn btn-outline-primary', role: 'button' %>
<% else %>
<%= link_to "Follow", follow_user_path(@user), method: :put, class: 'btn btn-outline-primary', role: 'button' %>
<% end %>
</div>
<div class="row align-items-center">
<div class="col col-sm-auto text-sm-left text-center mb-3 mb-sm-0">
<% if @user.avatar? %>
<%= image_tag(@user.avatar.thumb_url('100x100'), alt: 'avatar', class: 'rounded-circle', width: 100, height: 100) %>
<% else %>
<span class="rounded-circle align-bottom d-inline-block text-white" style="background:#ccc;width:100px;height:100px">
<i class="fa fa-user-o align-top text-center" style="width:100px;line-height:95px;font-size:70px" aria-hidden="true"></i>
</span>
<% end %>
</div>
<div class="col-sm text-sm-left text-center">
<h1 class="mb-0 overflow-hidden">
<%= @user.name %>
</h1>
</div>
</div>
<hr class="mt-4 mb-4">
<ul class="nav nav-pills">
<li class="nav-item">
<%= link_to t('profile'), @user, class: "nav-link#{body_class == 'users-show' ? ' active' : ''}" %>
</li>
<li class="nav-item">
<%= link_to t('picture', count: @user.pictures.public_setting.enabled.count), user_pictures_path(@user), class: "nav-link#{body_class == 'pictures-index' ? ' active' : ''}" %>
</li>
<li class="nav-item">
<%= link_to t('album', count: @user.albums.count), user_albums_path(@user), class: "nav-link#{body_class == 'albums-index' ? ' active' : ''}" %>
</li>
<li class="nav-item">
<%= link_to t('followee', count: @user.followees.count), followees_user_path(@user), class: "nav-link#{body_class == 'users-followees' ? ' active' : ''}" %>
</li>
<li class="nav-item">
<%= link_to t('follower', count: @user.followers.count), followers_user_path(@user), class: "nav-link#{body_class == 'users-followers' ? ' active' : ''}" %>
</li>
</ul>