|
20 | 20 | </div> |
21 | 21 | <% end %> |
22 | 22 |
|
| 23 | +<% is_me = @user.same_as?(current_user) %> |
23 | 24 | <div class="grid <%= deleted_user?(@user) ? 'deleted-content' : '' %>"> |
24 | 25 | <div class="grid--cell is-9-lg is-12"> |
25 | 26 | <div class="h-p-0 h-p-t-0"> |
|
56 | 57 | </div> |
57 | 58 | <% end %> |
58 | 59 | <% end %> |
59 | | - |
| 60 | + |
60 | 61 | <p> |
61 | 62 | <% if @user.discord.present? %> |
62 | 63 | <span class="h-m-r-4"> |
|
72 | 73 | <% end %> |
73 | 74 | <% end %> |
74 | 75 | <% if current_user&.at_least_moderator? %> |
75 | | - <a href="<%= mod_user_path(@user) %>" class="button is-danger is-outlined is-small" data-drop="#mod-tools-drop"><i class="fas fa-shield-alt"></i> Moderator Tools <% if @user.community_user.mod_warnings&.size.positive? %> (<%= pluralize(@user.community_user.mod_warnings.count, 'message') %>) <% end %></a> |
| 76 | + <a href="<%= mod_user_path(@user) %>" class="button is-danger is-outlined is-small" data-drop="#mod-tools-drop"><i class="fas fa-shield-alt"></i> Moderator Tools <% if @user.community_user.mod_warnings&.size.positive? %> (<%= pluralize(@user.community_user.mod_warnings.count, 'message') %>) <% end %></a> |
76 | 77 | <div class="droppanel" id="mod-tools-drop"> |
77 | 78 | <div class="droppanel--header">quick actions</div> |
78 | 79 | <div class="droppanel--menu"> |
79 | 80 | <a href="/users/<%= @user.id %>/mod/activity-log">full activity log</a> |
80 | 81 | <a href="/users/<%= @user.id %>/mod/annotations">annotations on user</a> |
81 | 82 | <a href="/users/<%= @user.id %>/mod/privileges">privileges</a> |
82 | 83 | <a href="/warning/log/<%= @user.id %>">warnings and suspensions sent to user |
83 | | - <% if @user.community_user.suspended? %><em>(includes lifting the suspension)</em> |
84 | | - <% elsif @user.community_user.mod_warnings&.size.positive? %> |
85 | | - (latest <%= time_ago_in_words(@user.community_user.latest_warning) %> ago) |
86 | | - <% end %></a> |
| 84 | + <% if @user.community_user.suspended? %> |
| 85 | + <em>(includes lifting the suspension)</em> |
| 86 | + <% elsif @user.community_user.mod_warnings&.size.positive? %> |
| 87 | + (latest <%= time_ago_in_words(@user.community_user.latest_warning) %> ago) |
| 88 | + <% end %></a> |
87 | 89 | <a href="/warning/new/<%= @user.id %>">warn or suspend user</a> |
88 | 90 | </div> |
89 | 91 | <div class="h-m-t-6"> |
|
146 | 148 | <td class="overflow-ellipsis" title="<%= @user.reputation %>"><%= @user.reputation %></td> |
147 | 149 | </tr> |
148 | 150 | <tr> |
149 | | - <td colspan="2"><i class="far fa-fw fa-comment-alt"></i> Number of top-level posts</td> |
| 151 | + <td colspan="2"><i class="far fa-fw fa-comment-alt"></i> Top-level posts</td> |
150 | 152 | <td class="overflow-ellipsis" title="<%= @user.metric '1' %>"><%= @user.metric '1' %></td> |
151 | 153 | </tr> |
152 | 154 | <tr> |
153 | | - <td colspan="2"><i class="fas fa-fw fa-reply-all"></i> Number of answers</td> |
| 155 | + <td colspan="2"> |
| 156 | + <i class="fas fa-fw fa-reply-all"></i> |
| 157 | + <%= link_to search_path(search: "user:#{@user.id} post_type:2"), |
| 158 | + 'aria-label': is_me ? 'View your answers' : "View answers from #{rtl_safe_username(@user)}" do %> |
| 159 | + Answers |
| 160 | + <% end %> |
| 161 | + </td> |
154 | 162 | <td class="overflow-ellipsis" title="<%= @user.metric '2' %>"><%= @user.metric '2' %></td> |
155 | 163 | </tr> |
156 | 164 | <tr> |
157 | | - <td colspan="2"><i class="fas fa-fw fa-star-half-alt"></i> Sum of received votes (up minus down)</td> |
| 165 | + <td colspan="2"><i class="fas fa-fw fa-star-half-alt"></i> |
| 166 | + <%= link_to is_me ? my_vote_summary_path : vote_summary_path, |
| 167 | + 'aria-label': |
| 168 | + is_me ? 'View your received votes' : "View received votes for #{rtl_safe_username(@user)}" do %> |
| 169 | + Received votes |
| 170 | + <% end %> |
| 171 | + <br>(up minus down) |
| 172 | + </td> |
158 | 173 | <td class="overflow-ellipsis" title="<%= @user.metric 's' %>"><%= @user.metric 's' %></td> |
159 | 174 | </tr> |
160 | 175 | <tr> |
161 | | - <td colspan="2"><i class="fas fa-fw fa-pen"></i> Number of edits made</td> |
| 176 | + <td colspan="2"><i class="fas fa-fw fa-pen"></i> Edits made</td> |
162 | 177 | <td class="overflow-ellipsis" title="<%= @user.metric 'E' %>"><%= @user.metric 'E' %></td> |
163 | 178 | </tr> |
164 | | - <% if current_user&.id == @user.id || current_user&.at_least_moderator? %> |
165 | | - <tr><td colspan="3">User since <%= @user.community_user.created_at %></td></tr> |
| 179 | + <% if is_me || current_user&.at_least_moderator? %> |
| 180 | + <tr><td colspan="3">Joined <%= @user.community_user.created_at %></td></tr> |
166 | 181 | <% end %> |
167 | 182 | </table> |
168 | | - |
| 183 | + |
169 | 184 | <% unless @abilities.empty? %> |
170 | 185 | <h2>Earned Abilities</h2> |
171 | 186 |
|
|
181 | 196 | <% end %> |
182 | 197 | <% end %> |
183 | 198 | <div class="widget--footer"> |
184 | | - <% if current_user&.id == @user.id %> |
185 | | - <%= link_to abilities_path, class: 'has-font-weight-bold', 'aria-label': 'View your abilities' do %> |
186 | | - Abilities » |
187 | | - <% end %> |
188 | | - <% else %> |
189 | | - <%= link_to abilities_path(for: @user.id), class: 'has-font-weight-bold', 'aria-label': "View abilities of #{rtl_safe_username(@user)}" do %> |
190 | | - Abilities » |
191 | | - <% end %> |
| 199 | + <%= link_to is_me ? abilities_path : abilities_path(for: @user.id), |
| 200 | + class: 'has-font-weight-bold', |
| 201 | + 'aria-label': is_me ? 'View your abilities' : "View abilities of #{rtl_safe_username(@user)}" do %> |
| 202 | + Abilities » |
192 | 203 | <% end %> |
193 | 204 | </div> |
194 | 205 | </div> |
|
203 | 214 | <th colspan="3">Posts</th> |
204 | 215 | </tr> |
205 | 216 | <tr> |
206 | | - <td colspan="2">Count</td> |
| 217 | + <td colspan="2"> |
| 218 | + <%= link_to user_posts_path, |
| 219 | + 'aria-label': is_me ? 'View your posts' : "View posts for #{rtl_safe_username(@user)}" do %> |
| 220 | + Total |
| 221 | + <% end %> |
| 222 | + </td> |
207 | 223 | <td class="overflow-ellipsis" title="<%= @user.posts.undeleted.count %>"> |
208 | 224 | <%= @user.posts.undeleted.count %> |
209 | 225 | </td> |
210 | 226 | </tr> |
211 | 227 | <tr> |
212 | | - <td colspan="2">Questions</td> |
| 228 | + <td colspan="2"> |
| 229 | + <%= link_to search_path(search: "user:#{@user.id} post_type:1"), |
| 230 | + 'aria-label': is_me ? 'View your questions' : "View questions from #{rtl_safe_username(@user)}" do %> |
| 231 | + Questions |
| 232 | + <% end %> |
| 233 | + </td> |
213 | 234 | <td class="overflow-ellipsis" title="<%= posts_for(posts_by_post_type, Question) %>"> |
214 | 235 | <%= posts_for(posts_by_post_type, Question) %> |
215 | 236 | </td> |
216 | 237 | </tr> |
217 | 238 | <tr> |
218 | | - <td colspan="2">Answers</td> |
| 239 | + <td colspan="2"> |
| 240 | + <%= link_to search_path(search: "user:#{@user.id} post_type:2"), |
| 241 | + 'aria-label': is_me ? 'View your answers' : "View answers from #{rtl_safe_username(@user)}" do %> |
| 242 | + Answers |
| 243 | + <% end %> |
| 244 | + </td> |
219 | 245 | <td class="overflow-ellipsis" title="<%= posts_for(posts_by_post_type, Answer) %>"> |
220 | 246 | <%= posts_for(posts_by_post_type, Answer) %> |
221 | 247 | </td> |
222 | 248 | </tr> |
223 | 249 | <tr> |
224 | | - <td colspan="2">Articles</td> |
| 250 | + <td colspan="2"> |
| 251 | + <%= link_to search_path(search: "user:#{@user.id} post_type:5"), |
| 252 | + 'aria-label': is_me ? 'View your articles' : "View articles from #{rtl_safe_username(@user)}" do %> |
| 253 | + Articles |
| 254 | + <% end %> |
| 255 | + </td> |
225 | 256 | <td class="overflow-ellipsis" title="<%= posts_for(posts_by_post_type, Article) %>"> |
226 | 257 | <%= posts_for(posts_by_post_type, Article) %> |
227 | 258 | </td> |
|
238 | 269 | <th colspan="3">Votes cast</th> |
239 | 270 | </tr> |
240 | 271 | <tr> |
241 | | - <td colspan="2">Count</td> |
| 272 | + <td colspan="2">Total</td> |
242 | 273 | <td class="overflow-ellipsis" title="<%= @user.votes.count %>"><%= @user.votes.count %></td> |
243 | 274 | </tr> |
244 | | - <% if @user.id == current_user&.id || current_user&.admin? %> |
245 | | - <tr> |
246 | | - <td colspan="2"> |
247 | | - <div class="flex items-center gap-sm"> |
248 | | - <svg class="has-color-tertiary-600" width="1em" height="0.67em" viewbox="0 0 100 50"> |
249 | | - <path d="M50,0 L100,50 L0,50 Z" fill="currentColor" /> |
250 | | - </svg>Upvotes |
251 | | - </div> |
252 | | - </td> |
253 | | - <td class="overflow-ellipsis" title="<%= votes_by_type[1] || 0 %>"><%= votes_by_type[1] || 0 %></td> |
254 | | - </tr> |
255 | | - <tr> |
256 | | - <td colspan="2"> |
257 | | - <div class="flex items-center gap-sm"> |
258 | | - <svg class="has-color-tertiary-600" width="1em" height="0.67em" viewbox="0 0 100 50"> |
259 | | - <path d="M0,0 L100,0 L50,50 Z" fill="currentColor" /> |
260 | | - </svg>Downvotes |
261 | | - </div> |
262 | | - </td> |
263 | | - <td class="overflow-ellipsis" title="<%= votes_by_type[-1] || 0 %>"><%= votes_by_type[-1] || 0 %></td> |
264 | | - </tr> |
265 | | - <tr> |
266 | | - <td colspan="2">on Question</td> |
267 | | - <td class="overflow-ellipsis" title="<%= votes_for(votes_by_post_type, Question) %>"> |
268 | | - <%= votes_for(votes_by_post_type, Question) %> |
269 | | - </td> |
270 | | - </tr> |
271 | | - <tr> |
272 | | - <td colspan="2">on Answer</td> |
273 | | - <td class="overflow-ellipsis" title="<%= votes_for(votes_by_post_type, Answer) %>"> |
274 | | - <%= votes_for(votes_by_post_type, Answer) %> |
275 | | - </td> |
276 | | - </tr> |
277 | | - <tr> |
278 | | - <td colspan="2">on Article</td> |
279 | | - <td class="overflow-ellipsis" title="<%= votes_for(votes_by_post_type, Article) %>"> |
280 | | - <%= votes_for(votes_by_post_type, Article) %> |
281 | | - </td> |
282 | | - </tr> |
| 275 | + <% if is_me || current_user&.admin? %> |
| 276 | + <tr> |
| 277 | + <td colspan="2"> |
| 278 | + <div class="flex items-center gap-sm"> |
| 279 | + <svg class="has-color-tertiary-600" width="1em" height="0.67em" viewbox="0 0 100 50"> |
| 280 | + <path d="M50,0 L100,50 L0,50 Z" fill="currentColor" /> |
| 281 | + </svg>Upvotes |
| 282 | + </div> |
| 283 | + </td> |
| 284 | + <td class="overflow-ellipsis" title="<%= votes_by_type[1] || 0 %>"><%= votes_by_type[1] || 0 %></td> |
| 285 | + </tr> |
| 286 | + <tr> |
| 287 | + <td colspan="2"> |
| 288 | + <div class="flex items-center gap-sm"> |
| 289 | + <svg class="has-color-tertiary-600" width="1em" height="0.67em" viewbox="0 0 100 50"> |
| 290 | + <path d="M0,0 L100,0 L50,50 Z" fill="currentColor" /> |
| 291 | + </svg>Downvotes |
| 292 | + </div> |
| 293 | + </td> |
| 294 | + <td class="overflow-ellipsis" title="<%= votes_by_type[-1] || 0 %>"><%= votes_by_type[-1] || 0 %></td> |
| 295 | + </tr> |
| 296 | + <tr> |
| 297 | + <td colspan="2">on Questions</td> |
| 298 | + <td class="overflow-ellipsis" title="<%= votes_for(votes_by_post_type, Question) %>"> |
| 299 | + <%= votes_for(votes_by_post_type, Question) %> |
| 300 | + </td> |
| 301 | + </tr> |
| 302 | + <tr> |
| 303 | + <td colspan="2">on Answers</td> |
| 304 | + <td class="overflow-ellipsis" title="<%= votes_for(votes_by_post_type, Answer) %>"> |
| 305 | + <%= votes_for(votes_by_post_type, Answer) %> |
| 306 | + </td> |
| 307 | + </tr> |
| 308 | + <tr> |
| 309 | + <td colspan="2">on Articles</td> |
| 310 | + <td class="overflow-ellipsis" title="<%= votes_for(votes_by_post_type, Article) %>"> |
| 311 | + <%= votes_for(votes_by_post_type, Article) %> |
| 312 | + </td> |
| 313 | + </tr> |
283 | 314 | <% end %> |
284 | 315 | </table> |
285 | 316 | <br> |
|
288 | 319 | <th colspan="3">Flags raised</th> |
289 | 320 | </tr> |
290 | 321 | <tr> |
291 | | - <td colspan="2">Count</td> |
| 322 | + <td colspan="2">Total</td> |
292 | 323 | <td class="overflow-ellipsis" title="<%= @user.flags.count %>"> |
293 | | - <% if current_user&.id == @user.id || at_least_moderator? %> |
| 324 | + <% if is_me || at_least_moderator? %> |
294 | 325 | <%= link_to @user.flags.count, flag_history_path(@user.id), class: 'is-muted', |
295 | 326 | 'aria-label': "View flag history for #{@user.flags.count} flags" %> |
296 | 327 | <% else %> |
|
0 commit comments