summaryrefslogtreecommitdiff
path: root/app/views/users/show.html.erb
blob: 6edcc6e5789a53261bac3fff18a49f025fc832e4 (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
114
115
116
<% title @user.name %>

<div id="user-info">
  <div class="profile-action">
    <% if session[:original_user_id] %>
      <%= link_to "revert", revert_path, :class => "btn blue" %>
    <% elsif admin? %>
      <%= link_to "become this user", become_path(user: @user), :class => "btn blue" %>
    <% end %>
    <% if @user.is?(current_user) || (mod? && current_user.role >= @user.role) %>
      <%= link_to "edit profile", edit_user_path(@user), :class => "btn blue" %>
    <% end %>
    <% if @user.is?(current_user) %>
      <%= link_to "private messages (#{Message.where.not(user_unread: current_user).count})", messages_path, :class => "btn blue" %>
    <% elsif current_user %>
      <%= link_to "Send this user a message", new_message_path(user_target: @user.ign), :class => "btn blue" %>
    <% end %>
  </div>

  <h1><%= @user.name %></h1>

  <div class="clear"></div>

  <% if @user.banned? %>
    <span class="user-banned">This user is banned!</span>
  <% end %>

  <% 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 dark", 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.skype.blank? && (@user.skype_public || current_user == @user || mod?) %>
      <tr>
        <td><b>Skype</b></td>
        <td><%= link_to @user.skype, "skype:#{@user.skype}?chat", target: "_blank" %></a></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>