summaryrefslogtreecommitdiffstats
path: root/app/views/users/show.html.erb
blob: 16a6c34145850fe4948d67e6f0a52ef898a06848 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<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="splitcontent">
<div class="splitcontentleft">
<ul>
  <li><%=l(:field_login)%>: <%= @user.login %></li>
  <% unless @user.pref.hide_mail %>
    <li><%=l(:field_mail)%>: <%= user_emails(@user) %></li>
  <% end %>
  <% @user.visible_custom_field_values.each do |custom_value| %>
  <% if !custom_value.value.blank? %>
    <li class="<%= custom_value.custom_field.css_classes %>"><%= 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>

<table class="list issue-report">
<thead>
  <tr>
    <th></th>
    <th><%=l(:label_open_issues_plural)%></th>
    <th><%=l(:label_closed_issues_plural)%></th>
    <th><%=l(:label_total)%></th>
  </tr>
</thead>
<tbody>
  <% assigned_to_ids = ([@user.id] + @user.group_ids).join("|") %>
  <% sort_cond = 'priority:desc,updated_on:desc' %>
  <tr>
    <td class="name">
      <%= link_to l(:label_assigned_issues),
        issues_path(:set_filter => 1, :assigned_to_id => assigned_to_ids, :sort => sort_cond) %>
    </td>
    <td>
      <%= link_to @issue_counts[:assigned][:open],
        issues_path(:set_filter => 1, :assigned_to_id => assigned_to_ids, :sort => sort_cond) %>
    </td>
    <td>
      <%= link_to @issue_counts[:assigned][:total] - @issue_counts[:assigned][:open],
        issues_path(:set_filter => 1, :status_id => 'c', :assigned_to_id => assigned_to_ids, :sort => sort_cond) %>
    </td>
    <td class="total">
      <%= link_to @issue_counts[:assigned][:total],
        issues_path(:set_filter => 1, :status_id => '*', :assigned_to_id => assigned_to_ids, :sort => sort_cond) %>
    </td>
  </tr>
  <tr>
    <td class="name">
      <%= link_to l(:label_reported_issues),
        issues_path(:set_filter => 1, :author_id => @user.id, :sort => sort_cond) %>
    </td>
    <td>
      <%= link_to @issue_counts[:reported][:open],
        issues_path(:set_filter => 1, :author_id => @user.id, :sort => sort_cond) %>
    </td>
    <td>
      <%= link_to @issue_counts[:reported][:total] - @issue_counts[:reported][:open],
        issues_path(:set_filter => 1, :status_id => 'c', :author_id => @user.id, :sort => sort_cond) %>
    </td>
    <td class="total">
      <%= link_to @issue_counts[:reported][:total],
        issues_path(:set_filter => 1, :status_id => '*', :author_id => @user.id, :sort => sort_cond) %>
    </td>
  </tr>
</tbody>
</table>

<% unless @memberships.empty? %>
<h3><%=l(:label_project_plural)%></h3>
<table class="list projects">
<thead>
  <tr>
    <th><%=l(:label_project)%></th>
    <th><%=l(:label_role_plural)%></th>
    <th><%=l(:label_registered_on)%></th>
  </tr>
</thead>
<tbody>
<% memberships_by_project = @memberships.group_by(&:project) %>
<% project_tree(memberships_by_project.keys, :init_level => true) do |project, level| %>
  <% membership = memberships_by_project[project].first %>
  <tr class="<%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
    <td class="name"><span><%= link_to_project(project) %></span></td>
    <td class="roles"><%= membership.roles.sort.collect(&:to_s).join(', ') %></td>
    <td><%= format_date(membership.created_on) %></td>
  </tr>
<% end %>
</tbody>
</table>
<% end %>

<% if (User.current == @user || User.current.admin?) && @user.groups.any? %>
<div id="groups">
  <h3><%=l(:label_group_plural)%></h3>
  <ul>
  <% for group in @user.groups %>
    <li><%= link_to_group(group) %>
  <% end %>
  </ul>
</div>
<% 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.atom_key} %>
<% end %>

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