This repository has been archived on 2024-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
redstoner.com/app/views/users/show.html.erb

114 lines
3.9 KiB
Plaintext

<% title @user.name %>
<div id="user-info">
<% if @user.is?(current_user) || (mod? && current_user.role >= @user.role) %>
<div class="profile-action" ><%= link_to "edit profile", edit_user_path(@user), :class => "btn blue" %></div>
<% end %>
<div class="profile-action" >
<% if !session[:original_user_id] && admin? %>
<%= link_to "become this user", become_path(user: @user), :class => "btn blue" %>
<% elsif session[:original_user_id] %>
<%= link_to "revert", revert_path, :class => "btn blue" %>
<% end %>
</div>
<h1><%= @user.name %></h1>
<div class="clear"></div>
<% if @ban_json && (@ban_json["expires"] == "forever" || !(DateTime.parse(@ban_json["expires"]) <= DateTime.now)) %>
<span class="user-banned">This user is banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span>
<% end %>
<% if @user.banned? %>
<span class="user-banned">This user is banned on the website!</span>
<% end %>
<br>
<% if !@user.confirmed? %>
<% if @user.is?(current_user) || mod? %>
<span class="user-unconfirmed">Please confirm your email <u><%= @user.email %></u> !</span>
<%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn blue", form_class: "inline-block", data: {confirm: "Did you check your spam folder?"} %>
<% else %>
<span class="user-unconfirmed">This user hasn't confirmed their email yet!</span>
<% end %>
<% elsif @user.disabled? %>
<% if @user.is?(current_user) %>
<span class="user-unconfirmed">Your account has been disabled.</span>
<% else %>
<span class="user-unconfirmed">This account has been disabled.</span>
<% end %>
<% end %>
<%= @user.avatar(128, class: "user-avatar avatar") %>
<%= render partial: "users/username", locals: {user: @user} %>
<table>
<tbody>
<tr>
<td><b>IGN</b></td>
<td><%= @user.ign %></td>
</tr>
<tr>
<td><b>UUID</b></td>
<td><%= @user.uuid %></td>
</tr>
<tr>
<td><b>Role</b></td>
<td><%= link_to @user.role, users_path(:role => @user.role.name) %></td>
</tr>
<% if current_user && !@user.discord.blank? %>
<tr>
<td><b>Discord</b></td>
<td><%= @user.discord %></td>
</tr>
<% end %>
<% if !@user.youtube.blank? && !@user.youtube_channelname.blank? %>
<tr>
<td><b>YouTube</b></td>
<td>
<% if @user.youtube.length == 24 && @user.youtube[0..1] == "UC" %>
<%= link_to @user.youtube_channelname, "https://youtube.com/channel/#{CGI.escape(@user.youtube)}", :target => "_blank" %>
<% else %>
<%= link_to @user.youtube_channelname, "https://youtube.com/user/#{CGI.escape(@user.youtube)}", :target => "_blank" %>
<% end %>
</td>
</tr>
<% end %>
<% if !@user.twitter.blank? %>
<tr>
<td><b>Twitter</b></td>
<td><%= link_to "@#{@user.twitter}", "https://twitter.com/#{CGI.escape(@user.twitter)}", :target => "_blank" %></td>
</tr>
<% end %>
<tr>
<td><b>Joined</b></td>
<td><%= ago @user.created_at %></td>
</tr>
<tr>
<td><b>Last seen</b></td>
<td>
<% if @user.last_seen %>
<%= ago @user.last_seen %>
<% else %>
Never
<% end %>
</td>
</tr>
<% if mod? || @user.is?(current_user) %>
<tr>
<td><b>Last IP</b></td>
<td><%= @user.last_ip %></td>
</tr>
<tr>
<td><b>Email</b></td>
<td><%= mail_to @user.email, @user.email, :subject => "Redstoner" %></td>
</tr>
<% end %>
</tbody>
</table>
About:<br>
<% if @user.about.blank? %>
<span class="no-about">nothing</span>
<% else %>
<%= render_md(@user.about).html_safe %>
<% end %>
</div>