journalduhacker/app/views/users/show.html.erb
2016-02-11 09:59:05 -06:00

209 lines
5.6 KiB
Plaintext

<div class="box wide">
<div class="legend">
<% if !@showing_user.is_active? %>
<span class="inactive_user">
<% elsif @showing_user.is_new? %>
<span class="new_user">
<% else %>
<span>
<% end %>
<%= @showing_user.username %>
</span>
<% if @user && @showing_user.is_active? %>
(<a href="/messages?to=<%= @showing_user.username %>">Send a Message</a>)
<% end %>
</div>
<% if @showing_user.is_active? %>
<div id="gravatar">
<img src="<%= @showing_user.avatar_url(100) %>"
srcset="<%= @showing_user.avatar_url(100) %> 1x,
<%= @showing_user.avatar_url(200) %> 2x">
</div>
<% end %>
<label class="required">Status:</label>
<span class="d"
<%= @showing_user.is_banned? ? raw("style=\"color: red;\"") : "" %>>
<% if @showing_user.is_banned? %>
Banned
<% elsif !@showing_user.is_active? %>
Inactive
<% else %>
Active
<% end %>
<%= @showing_user.is_admin? ? "administrator" :
(@showing_user.is_moderator? ? "moderator" : "user") %>
</span>
<br>
<label class="required">Joined:</label>
<span class="d">
<%= time_ago_in_words_label(@showing_user.created_at) %>
<% if @showing_user.invited_by_user %>
by invitation from
<%= link_to @showing_user.invited_by_user.try(:username),
@showing_user.invited_by_user %>
<% end %>
</span>
<br>
<% if @showing_user.is_banned? %>
<label class="required">Banned:</label>
<span class="d">
<%= time_ago_in_words_label(@showing_user.banned_at) %>
<% if @showing_user.banned_by_user %>
by <%= link_to @showing_user.banned_by_user.try(:username),
@showing_user.banned_by_user %>:
<em><%= @showing_user.banned_reason %></em>
<% end %>
</span>
<br>
<% end %>
<% if @showing_user.hats.any? %>
<label class="required">Hats:</label>
<span class="d">
<% @showing_user.hats.each do |hat| %>
<%= hat.to_html_label %>
<% end %>
</span>
<br>
<% end %>
<% if @showing_user.deleted_at? %>
<label class="required">Left:</label>
<span class="d">
<%= time_ago_in_words_label(@showing_user.deleted_at) %>
</span>
<br>
<% end %>
<% if !@showing_user.is_admin? %>
<label class="required">Karma:</label>
<span class="d">
<%= @showing_user.karma %>, averaging <%=
number_with_precision(@showing_user.average_karma, :precision => 2) %>
per story/comment
</span>
<br>
<% end %>
<label class="required">Stories Submitted:</label>
<span class="d">
<% tag = @showing_user.most_common_story_tag %>
<a href="/newest/<%= @showing_user.username %>"><%=
@showing_user.stories_submitted_count %></a><%= tag ? ", " : "" %>
<% if tag %>
most commonly tagged <a href="<%= tag_path(tag.tag) %>"
class="<%= tag.css_class %>" title="<%= tag.description %>"><%=
tag.tag %></a>
<% end %>
</span>
<br>
<label class="required">Comments Posted:</label>
<span class="d">
<a href="/threads/<%= @showing_user.username %>"><%=
@showing_user.comments_posted_count %></a>
</span>
<br>
<% if @showing_user.is_active? %>
<label class="required">About:</label>
<div class="d shorten_first_p">
<% if @showing_user.about.present? %>
<%= raw @showing_user.linkified_about %>
<% else %>
<span class="na">A mystery...</span>
<% end %>
</div>
<% end %>
<% if @user && @user.is_admin? && !@showing_user.is_moderator? %>
<div style="clear: both;"></div>
<br>
<p>
<div class="legend">
Administrative Information
</div>
</p>
<label class="required">E-Mail:</label>
<span class="d">
<%= @showing_user.email %>
</span>
<br>
<label class="required">Recent Votes:</label>
<div class="d shorten_first_p">
<% @showing_user.votes_for_others.limit(10).each do |v| %>
<p>
<% if v.vote == 1 %>
+1
<% else %>
<%= v.vote %>
<% if v.comment_id %>
(<%= Vote::COMMENT_REASONS[v.reason] %>)
<% else %>
(<%= Vote::STORY_REASONS[v.reason] %>)
<% end %>
<% end %>
on
<% if v.comment_id %>
<a href="<%= v.comment.short_id_url %>">comment</a>
by
<a href="/u/<%= v.comment.user.try(:username) %>"><%=
v.comment.user.try(:username) %></a>
on
<a href="<%= v.story.short_id_url %>"><%= v.story.title %></a>
<% elsif v.story_id && !v.comment_id %>
<a href="<%= v.story.short_id_url %>"><%= v.story.title %></a>
by
<a href="/u/<%= v.story.user.try(:username) %>"><%=
v.story.user.try(:username) %></a>
<% end %>
</p>
<% end %>
</div>
<br>
<div style="clear: both;"></div>
<br>
<p>
<div class="legend">
Administrative Actions
</div>
</p>
<% if @showing_user.is_banned? %>
<%= form_tag user_unban_path, :method => :post do %>
<p>
<%= submit_tag "Unban User" %>
</p>
<% end %>
<% else %>
<%= form_tag user_ban_path, :method => :post do %>
<p>
Banning a user will send an e-mail to the user with the reason below,
with your e-mail address as the Reply-To so the user can respond.
</p>
<p>
<div class="boxline">
<%= label_tag :reason, "Reason:", :class => "required" %>
<%= text_field_tag :reason, "", :size => 40 %>
</div>
<p>
<%= submit_tag "Ban User" %>
</p>
<% end %>
<% end %>
<% end %>
</div>