summaryrefslogtreecommitdiff
path: root/app/views/users/show.html.erb
blob: 1edf6db9c9660fd32b30125ed492cc341520fa03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<% 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>
      <% 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>
        <tr>
          <td><b>Last seen</b></td>
          <td>
            <% if @user.last_seen %>
              <%= ago @user.last_seen %>
            <% else %>
              Never
            <% end %>
          </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>