]> git.openstreetmap.org Git - rails.git/blob - app/views/users/show.html.erb
Add links for admins from user page to user list filtered by ip/status
[rails.git] / app / views / users / show.html.erb
1 <% content_for :heading do %>
2   <div class="row">
3     <div class="col-sm-auto">
4       <%= user_image @user %>
5     </div>
6     <div class="col">
7       <h1><%= @user.display_name %> <%= role_icons(@user) %></h1>
8       <% if current_user and @user.id == current_user.id %>
9         <!-- Displaying user's own profile page -->
10         <nav class='secondary-actions'>
11           <ul class='clearfix'>
12             <li>
13               <%= link_to t(".my edits"), :controller => "changesets", :action => "index", :display_name => current_user.display_name %>
14               <span class='badge count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
15             </li>
16             <li>
17               <%= link_to t(".my notes"), user_notes_path(@user) %>
18             </li>
19             <li>
20               <%= link_to t(".my traces"), :controller => "traces", :action => "mine" %>
21               <span class='badge count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
22             </li>
23             <li>
24               <%= link_to t(".my diary"), :controller => "diary_entries", :action => "index", :display_name => current_user.display_name %>
25               <span class='badge count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
26             </li>
27             <li>
28               <%= link_to t(".my comments"), diary_comments_path(current_user) %>
29             </li>
30             <li>
31               <%= link_to t(".my settings"), edit_account_path %>
32             </li>
33
34             <% if current_user.blocks.exists? %>
35               <li>
36                 <%= link_to t(".blocks on me"), user_blocks_on_path(current_user) %>
37                 <span class='badge count-number'><%= number_with_delimiter(current_user.blocks.active.size) %></span>
38               </li>
39             <% end %>
40
41             <% if can?(:create, UserBlock) and current_user.blocks_created.exists? %>
42               <li>
43                 <%= link_to t(".blocks by me"), user_blocks_by_path(current_user) %>
44                 <span class='badge count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
45               </li>
46             <% end %>
47
48           </ul>
49         </nav>
50
51         <% else %>
52         <!-- Displaying user profile page to the public -->
53         <nav class='secondary-actions'>
54           <ul class='clearfix'>
55
56             <li>
57               <%= link_to t(".edits"), :controller => "changesets", :action => "index", :display_name => @user.display_name %>
58               <span class='badge count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
59             </li>
60             <li>
61               <%= link_to t(".notes"), user_notes_path(@user) %>
62             </li>
63             <li>
64               <%= link_to t(".traces"), :controller => "traces", :action => "index", :display_name => @user.display_name %>
65               <span class='badge count-number'><%= number_with_delimiter(@user.traces.size) %></span>
66             </li>
67
68             <!-- Displaying another user's profile page -->
69
70             <li>
71               <%= link_to t(".send message"), new_message_path(@user) %>
72             </li>
73             <li>
74               <%= link_to t(".diary"), :controller => "diary_entries", :action => "index", :display_name => @user.display_name %>
75               <span class='badge count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
76             </li>
77             <li>
78               <%= link_to t(".comments"), diary_comments_path(@user) %>
79             </li>
80             <li>
81               <% if current_user and current_user.friends_with?(@user) %>
82                 <%= link_to t(".remove as friend"), remove_friend_path(:display_name => @user.display_name), :method => :post %>
83               <% elsif current_user %>
84                 <%= link_to t(".add as friend"), make_friend_path(:display_name => @user.display_name), :method => :post %>
85               <% else %>
86                 <%= link_to t(".add as friend"), make_friend_path(:display_name => @user.display_name) %>
87               <% end %>
88             </li>
89
90             <% if @user.blocks.exists? %>
91               <li>
92                 <%= link_to t(".block_history"), user_blocks_on_path(@user) %>
93                 <span class='badge count-number'><%= number_with_delimiter(@user.blocks.active.size) %></span>
94               </li>
95             <% end %>
96
97             <% if @user.moderator? and @user.blocks_created.exists? %>
98               <li>
99                 <%= link_to t(".moderator_history"), user_blocks_by_path(@user) %>
100                 <span class='badge count-number'><%= number_with_delimiter(@user.blocks_created.active.size) %></span>
101               </li>
102             <% end %>
103
104             <% if can?(:revoke_all, UserBlock) and @user.blocks.active.exists? %>
105               <li>
106                 <%= link_to t(".revoke_all_blocks"), revoke_all_user_blocks_path(@user) %>
107               </li>
108             <% end %>
109
110             <% if can?(:create, UserBlock) %>
111               <li>
112                 <%= link_to t(".create_block"), new_user_block_path(@user) %>
113               </li>
114             <% end %>
115
116             <% if current_user and @user.id != current_user.id %>
117               <li>
118                 <%= report_link(t(".report"), @user) %>
119               </li>
120             <% end %>
121
122             <% if current_user and UserMute.exists?(owner: current_user, subject: @user) %>
123               <li>
124               <%= link_to t(".destroy_mute"), user_mute_path(@user), :method => :delete %>
125               </li>
126             <% elsif current_user %>
127               <li>
128               <%= link_to t(".create_mute"), user_mute_path(@user), :method => :post, :title => t("user_mutes.index.user_mute_explainer") %>
129               </li>
130             <% end %>
131           </ul>
132         </nav>
133       <% end %>
134
135       <div class='text-muted'>
136         <small>
137           <dl class="list-inline">
138             <dt class="list-inline-item m-0"><%= t ".mapper since" %></dt>
139             <dd class="list-inline-item"><%= l @user.created_at.to_date, :format => :long %></dd>
140             <% unless @user.terms_agreed %>
141               <dt class="list-inline-item m-0"><%= t ".ct status" %></dt>
142               <dd class="list-inline-item">
143                 <% if @user.terms_seen? -%>
144                   <%= t ".ct declined" %>
145                 <% else -%>
146                   <%= t ".ct undecided" %>
147                 <% end -%>
148               </dd>
149             <% end -%>
150             <% if current_user&.moderator? || current_user&.administrator? %>
151               <dt class="list-inline-item m-0"><%= t ".uid" %></dt>
152               <dd class="list-inline-item"><%= link_to @user.id, api_user_path(:id => @user.id) %></dd>
153             <% end -%>
154           </dl>
155         </small>
156       </div>
157
158       <% if can?(:set_status, User) || can?(:destroy, User) %>
159         <nav class='secondary-actions'>
160           <ul class='clearfix'>
161             <% if can? :set_status, User %>
162               <% if @user.may_activate? %>
163                 <li>
164                   <%= link_to t(".activate_user"), set_status_user_path(:event => "activate", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
165                 </li>
166               <% end %>
167
168               <% if @user.may_unsuspend? %>
169                 <li>
170                   <%= link_to t(".unsuspend_user"), set_status_user_path(:event => "unsuspend", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
171                 </li>
172               <% end %>
173
174               <% if @user.may_confirm? %>
175                 <li>
176                   <%= link_to t(".confirm_user"), set_status_user_path(:event => "confirm", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
177                 </li>
178               <% end %>
179
180               <% if @user.may_unconfirm? %>
181                 <li>
182                   <%= link_to t(".unconfirm_user"), set_status_user_path(:event => "unconfirm", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
183                 </li>
184               <% end %>
185
186               <% if @user.may_hide? %>
187                 <li>
188                   <%= link_to t(".hide_user"), set_status_user_path(:event => "hide", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
189                 </li>
190               <% end %>
191
192               <% if @user.may_unhide? %>
193                 <li>
194                   <%= link_to t(".unhide_user"), set_status_user_path(:event => "unhide", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
195                 </li>
196               <% end %>
197             <% end %>
198
199             <% if can?(:destroy, User) && @user.may_soft_destroy? %>
200               <li>
201                 <%= link_to t(".delete_user"), user_path(:display_name => @user.display_name), :method => :delete, :data => { :confirm => t(".confirm") } %>
202               </li>
203             <% end %>
204           </ul>
205         </nav>
206       <% end %>
207
208       <% if current_user and current_user.administrator? -%>
209         <div class='text-muted'>
210           <small>
211             <dl class="list-inline">
212               <dt class="list-inline-item m-0"><%= t ".email address" %></dt>
213               <dd class="list-inline-item"><%= @user.email %></dd>
214               <% unless @user.creation_ip.nil? -%>
215                 <dt class="list-inline-item m-0"><%= t ".created from" %></dt>
216                 <dd class="list-inline-item"><%= link_to @user.creation_ip, users_path(:ip => @user.creation_ip) %></dd>
217               <% end -%>
218               <dt class="list-inline-item m-0"><%= t ".status" %></dt>
219               <dd class="list-inline-item"><%= link_to @user.status.capitalize, users_path(:status => @user.status) %></dd>
220               <dt class="list-inline-item m-0"><%= t ".spam score" %></dt>
221               <dd class="list-inline-item"><%= @user.spam_score %></dd>
222             </dl>
223           </small>
224         </div>
225       <% end -%>
226     </div>
227   </div>
228 <% end %>
229
230 <div class="richtext text-break clearfix"><%= @user.description.to_html %></div>
231
232 <% if current_user and @user.id == current_user.id %>
233   <div class="my-3">
234     <%= link_to t(".edit_profile"), edit_profile_path, :class => "btn btn-outline-primary" %>
235   </div>
236 <% end %>