Factor out FontAwesome icons into a set of helpers. This is so that it's easier to keep track of which icons we're using and easier to change icons globally.
128 lines
5.7 KiB
Plaintext
128 lines
5.7 KiB
Plaintext
<div class="user-tooltip">
|
|
<div class="user-tooltip-header">
|
|
<%= avatar_icon(class: "user-tooltip-avatar") %>
|
|
|
|
<div class="user-tooltip-header-top">
|
|
<span class="user-tooltip-name"><%= link_to_user @user %></span>
|
|
|
|
<% if @user.is_banned? %>
|
|
<%= link_to "Banned", users_path(search: { is_banned: true }), class: "user-tooltip-badge user-tooltip-badge-banned" %>
|
|
<% elsif @user.is_admin? %>
|
|
<%= link_to @user.level_string, users_path(search: { level: @user.level }), class: "user-tooltip-badge user-tooltip-badge-#{@user.level_string.downcase}" %>
|
|
<% elsif @user.is_moderator? %>
|
|
<%= link_to @user.level_string, users_path(search: { level: @user.level }), class: "user-tooltip-badge user-tooltip-badge-#{@user.level_string.downcase}" %>
|
|
<% elsif @user.can_approve_posts? %>
|
|
<%= link_to "Approver", users_path(search: { can_approve_posts: true }), class: "user-tooltip-badge user-tooltip-badge-approver" %>
|
|
<% elsif @user.can_upload_free? %>
|
|
<%= link_to "Contributor", users_path(search: { can_upload_free: true }), class: "user-tooltip-badge user-tooltip-badge-contributor" %>
|
|
<% else %>
|
|
<%= link_to @user.level_string, users_path(search: { level: @user.level }), class: "user-tooltip-badge user-tooltip-badge-#{@user.level_string.downcase}" %>
|
|
<% end %>
|
|
|
|
<% if @user.positive_feedback_count > 0 %>
|
|
<%= link_to user_feedbacks_path(search: { user_id: @user.id }), class: "link-plain user-tooltip-badge user-tooltip-badge-positive-feedback" do %>
|
|
<%= medal_icon %>
|
|
<span><%= @user.positive_feedback_count %>
|
|
<% end %>
|
|
<% elsif @user.negative_feedback_count > 0 %>
|
|
<%= link_to user_feedbacks_path(search: { user_id: @user.id }), class: "link-plain user-tooltip-badge user-tooltip-badge-negative-feedback" do %>
|
|
<%= negative_icon %>
|
|
<span><%= @user.negative_feedback_count %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="user-tooltip-header-bottom">
|
|
<%= time_tag @user.created_at.to_date.iso8601, @user.created_at, class: "user-tooltip-created-at" %>
|
|
<% if @user.last_ip_addr.present? && policy(IpAddress).show? %>
|
|
· <%= link_to_ip @user.last_ip_addr, shorten: true, class: "link-plain" %>
|
|
<% end %>
|
|
|
|
<% @user.user_name_change_requests.visible(CurrentUser.user).count.tap do |name_change_count| %>
|
|
<% if name_change_count > 0 %>
|
|
· <%= link_to pluralize(name_change_count, "other name"), user_name_change_requests_path(search: { user_id: @user.id }), class: "link-plain" %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= render PopupMenuComponent.new do |menu| %>
|
|
<%= menu.item do %>
|
|
<%= link_to new_dmail_path(dmail: { to_id: @user.id }) do %>
|
|
<%= message_icon %> Send Message
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if !@user.is_platinum? %>
|
|
<%= menu.item do %>
|
|
<%= link_to new_user_upgrade_path(user_id: @user.id) do %>
|
|
<%= gift_icon %> Gift Upgrade
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if policy(UserFeedback.new(user: @user)).create? %>
|
|
<%= menu.item do %>
|
|
<%= link_to new_user_feedback_path(user_feedback: { user_id: @user.id }) do %>
|
|
<%= feedback_icon %> Give Feedback
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if policy(CurrentUser.user).promote? %>
|
|
<%= menu.item do %>
|
|
<%= link_to edit_admin_user_path(@user.id) do %>
|
|
<%= promotion_icon %> Promote User
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if policy(Ban.new(user: @user)).create? %>
|
|
<%= menu.item do %>
|
|
<%= link_to new_ban_path(ban: { user_id: @user.id }) do %>
|
|
<%= ban_icon %> Ban User
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<ul class="user-tooltip-stats">
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to posts_path(tags: "user:#{@user.name}"), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.post_upload_count) %></div>
|
|
<div class="user-tooltip-stat-name">Uploads</div>
|
|
<% end %>
|
|
</li>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to post_versions_path(search: { updater_id: @user.id }), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.post_update_count) %></div>
|
|
<div class="user-tooltip-stat-name">Tag Edits</div>
|
|
<% end %>
|
|
</li>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to note_versions_path(search: { updater_id: @user.id }), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.note_update_count) %></div>
|
|
<div class="user-tooltip-stat-name">Note Edits</div>
|
|
<% end %>
|
|
</li>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to posts_path(tags: "ordfav:#{@user.name}"), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.favorite_count) %></div>
|
|
<div class="user-tooltip-stat-name">Favorites</div>
|
|
<% end %>
|
|
</li>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to comments_path(search: { creator_id: @user.id }), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.comment_count) %></div>
|
|
<div class="user-tooltip-stat-name">Comments</div>
|
|
<% end %>
|
|
</li>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to forum_posts_path(search: { creator_id: @user.id }), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.forum_post_count) %></div>
|
|
<div class="user-tooltip-stat-name">Forum Posts</div>
|
|
<% end %>
|
|
</li>
|
|
</ul>
|
|
</div>
|