journalduhacker/app/views/users/show.html.erb

256 lines
7.2 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 %>"><%= t('.sendmessage') %></a>)
<% end %>
</div>
<% if @showing_user.is_active? %>
<div id="gravatar">
<%= avatar_img(@showing_user, 100) %>
</div>
<% end %>
<label class="required"><%= t('.status') %></label>
<span class="d"
<%= @showing_user.is_banned? ? raw("style=\"color: red;\"") : "" %>>
<% if @showing_user.is_banned? %>
<%= t('.banneduser') %>
<% elsif !@showing_user.is_active? %>
<%= t('.inactiveuser') %>
<% else %>
<%= t('.active') %>
<%= @showing_user.is_admin? ? t('.administrator') :
(@showing_user.is_moderator? ? t('.moderator') : t('.user')) %>
<% if !@showing_user.can_invite? %>
<%= t('.withinvites') %>
<% if !@showing_user.can_submit_stories? %>
<%= t('.storysubmissions') %>
<% end %>
<%= t('.disabled') %>
<% end %>
<% end %>
</span>
<br>
<label class="required"><%= t('.joined') %></label>
<span class="d">
<%= distance_of_time_in_words(@showing_user.created_at, Time.now) %>
<% if @showing_user.invited_by_user %>
<%= raw(t('.byinvitationfrom', :user => @showing_user.username)) %>
<%= 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"><%= t('.banneduser') %></label>
<span class="d">
<%= distance_of_time_in_words(@showing_user.banned_at, Time.now) %>
<% if @showing_user.banned_by_user %>
<%= t('.bannedby') %><%= 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.deleted_at? %>
<label class="required"><% t('.left') %></label>
<span class="d">
<%= distance_of_time_in_words(@showing_user.deleted_at, Time.now) %>
</span>
<br>
<% end %>
<% if !@showing_user.is_admin? %>
<label class="required"><%= t('.karma') %></label>
<span class="d">
<%= @showing_user.karma %><%= t('.karmaaverage') %><%=
number_with_precision(@showing_user.average_karma, :precision => 2) %>
<%= t('.karmaperstorycomment') %>
</span>
<br>
<% end %>
<label class="required"><%= t('.storiessubmitted') %></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 %>
<%= t('.mostcommonlytagged') %><a href="<%= tag_path(tag.tag) %>"
class="<%= tag.css_class %>" title="<%= tag.description %>"><%=
tag.tag %></a>
<% end %>
</span>
<br>
<label class="required"><%= t('.postedcomments') %></label>
<span class="d">
<a href="/threads/<%= @showing_user.username %>"><%=
@showing_user.comments_posted_count %></a>
</span>
<br>
<% if @showing_user.hats.any? %>
<label class="required"><%= t('.hats') %></label>
<div class="d">
<% @showing_user.hats.each do |hat| %>
<%= hat.to_html_label %>
<% end %>
</div>
<div style="clear: both;"></div>
<% end %>
<% if @showing_user.github_username.present? %>
<label class="required">GitHub:</label>
<span class="d">
<a href="https://github.com/<%= h(@showing_user.github_username) %>"
rel="nofollow">https://github.com/<%= h(@showing_user.github_username)
%></a>
</span>
<br>
<% end %>
<% if @showing_user.twitter_username.present? %>
<label class="required">Twitter:</label>
<span class="d">
<a href="https://twitter.com/<%= h(@showing_user.twitter_username) %>"
rel="nofollow">@<%= h(@showing_user.twitter_username) %></a>
</span>
<br>
<% end %>
<% if @showing_user.is_active? %>
<label class="required"><%= t('.about') %></label>
<div class="d shorten_first_p">
<% if @showing_user.about.present? %>
<%= raw @showing_user.linkified_about %>
<% else %>
<span class="na"><%= t('.aboutdefault') %></span>
<% end %>
</div>
<% end %>
<% if @user && @user.is_admin? && !@showing_user.is_moderator? %>
<div style="clear: both;"></div>
<br>
<p>
<div class="legend">
<%= t('.administrativeinfo') %>
</div>
</p>
<label class="required"><%= t('.email') %></label>
<span class="d">
<%= @showing_user.email %>
</span>
<br>
<label class="required"><%= t('.recentvotes') %></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 %>"><%= t('.commentlinktext') %></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">
<%= t('.administrativeactions') %>
</div>
</p>
<% if @showing_user.is_banned? %>
<%= form_tag user_unban_path, :method => :post do %>
<p>
<%= submit_tag t('unbanuser') %>
</p>
<% end %>
<% else %>
<p>
<%= t('.banningdescription') %>
</p>
<%= form_tag user_ban_path, :method => :post do %>
<p>
<div class="boxline">
<%= label_tag :reason, t('.banningreason'), :class => "required" %>
<%= text_field_tag :reason, "", :size => 40 %>
</div>
<p>
<%= submit_tag t('.banuserbutton') %>
</p>
<% end %>
<% end %>
<% if @showing_user.banned_from_inviting? %>
<%= form_tag user_enable_invite_path, :method => :post do %>
<p>
<%= submit_tag t('.enableinvitesforuser') %>
</p>
<% end %>
<% else %>
<%= form_tag user_disable_invite_path, :method => :post do %>
<p>
<div class="boxline">
<%= label_tag :reason, t('.disableinvitesreason'), :class => "required" %>
<%= text_field_tag :reason, "", :size => 40 %>
</div>
<p>
<%= submit_tag t('.disableinvitesbutton') %>
</p>
<% end %>
<% end %>
<% end %>
</div>