<div class="contextual">
<%= link_to(l(:button_edit), edit_user_path(@user), :class => 'icon icon-edit') if User.current.admin? && @user.logged? %>
</div>

<h2><%= avatar @user, :size => "50" %> <%= @user.name %></h2>

<div class="splitcontentleft">
<ul>
  <% if User.current.admin? %>
    <li><%=l(:field_login)%>: <%= @user.login %></li>
  <% end %>
  <% unless @user.pref.hide_mail %>
    <li><%=l(:field_mail)%>: <%= mail_to(@user.mail, nil, :encode => 'javascript') %></li>
  <% end %>
  <% @user.visible_custom_field_values.each do |custom_value| %>
  <% if !custom_value.value.blank? %>
    <li class="cf_<%= custom_value.custom_field.id %>"><%= custom_value.custom_field.name %>: <%= show_value(custom_value) %></li>
  <% end %>
  <% end %>
    <li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>
  <% unless @user.last_login_on.nil? %>
    <li><%=l(:field_last_login_on)%>: <%= format_date(@user.last_login_on) %></li>
  <% end %>
</ul>

<h3><%=l(:label_issue_plural)%></h3>
<ul>
  <li><%= link_to l(:label_assigned_issues),
        issues_path(:set_filter => 1, :assigned_to_id => ([@user.id] + @user.group_ids).join("|"), :sort => 'priority:desc,updated_on:desc') %>:
      <%= Issue.visible.open.assigned_to(@user).count %>
  <li><%= link_to l(:label_reported_issues),
        issues_path(:set_filter => 1, :status_id => '*', :author_id => @user.id) %>:
      <%= Issue.visible.where(:author_id => @user.id).count %>
</ul>

<% unless @memberships.empty? %>
<h3><%=l(:label_project_plural)%></h3>
<ul>
<% for membership in @memberships %>
  <li><%= link_to_project(membership.project) %>
    (<%= membership.roles.sort.collect(&:to_s).join(', ') %>, <%= format_date(membership.created_on) %>)</li>
<% end %>
</ul>
<% end %>
<%= call_hook :view_account_left_bottom, :user => @user %>
</div>

<div class="splitcontentright">

<% unless @events_by_day.empty? %>
<h3><%= link_to l(:label_activity), :controller => 'activities',
                :action => 'index', :id => nil, :user_id => @user,
                :from => @events_by_day.keys.first %></h3>
<%= render :partial => 'activities/activities', :locals => {:events_by_day => @events_by_day} %>

<% other_formats_links do |f| %>
  <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => nil, :user_id => @user, :key => User.current.rss_key} %>
<% end %>

<% content_for :header_tags do %>
  <%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :user_id => @user, :format => :atom, :key => User.current.rss_key) %>
<% end %>
<% end %>
<%= call_hook :view_account_right_bottom, :user => @user %>
</div>

<% html_title @user.name %>
