Skip to content

Commit a6eb2a5

Browse files
authored
Merge pull request #1935 from codidact/trichoplax/profile-right-panel-shorter-wordings
Improve and shorten wordings in right panel of profile
2 parents c34bf71 + 982b965 commit a6eb2a5

1 file changed

Lines changed: 98 additions & 67 deletions

File tree

app/views/users/show.html.erb

Lines changed: 98 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
</div>
2121
<% end %>
2222

23+
<% is_me = @user.same_as?(current_user) %>
2324
<div class="grid <%= deleted_user?(@user) ? 'deleted-content' : '' %>">
2425
<div class="grid--cell is-9-lg is-12">
2526
<div class="h-p-0 h-p-t-0">
@@ -56,7 +57,7 @@
5657
</div>
5758
<% end %>
5859
<% end %>
59-
60+
6061
<p>
6162
<% if @user.discord.present? %>
6263
<span class="h-m-r-4">
@@ -72,18 +73,19 @@
7273
<% end %>
7374
<% end %>
7475
<% 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>
7677
<div class="droppanel" id="mod-tools-drop">
7778
<div class="droppanel--header">quick actions</div>
7879
<div class="droppanel--menu">
7980
<a href="/users/<%= @user.id %>/mod/activity-log">full activity log</a>
8081
<a href="/users/<%= @user.id %>/mod/annotations">annotations on user</a>
8182
<a href="/users/<%= @user.id %>/mod/privileges">privileges</a>
8283
<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>
8789
<a href="/warning/new/<%= @user.id %>">warn or suspend user</a>
8890
</div>
8991
<div class="h-m-t-6">
@@ -146,26 +148,39 @@
146148
<td class="overflow-ellipsis" title="<%= @user.reputation %>"><%= @user.reputation %></td>
147149
</tr>
148150
<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>
150152
<td class="overflow-ellipsis" title="<%= @user.metric '1' %>"><%= @user.metric '1' %></td>
151153
</tr>
152154
<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>
154162
<td class="overflow-ellipsis" title="<%= @user.metric '2' %>"><%= @user.metric '2' %></td>
155163
</tr>
156164
<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>
158173
<td class="overflow-ellipsis" title="<%= @user.metric 's' %>"><%= @user.metric 's' %></td>
159174
</tr>
160175
<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>
162177
<td class="overflow-ellipsis" title="<%= @user.metric 'E' %>"><%= @user.metric 'E' %></td>
163178
</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>
166181
<% end %>
167182
</table>
168-
183+
169184
<% unless @abilities.empty? %>
170185
<h2>Earned Abilities</h2>
171186

@@ -181,14 +196,10 @@
181196
<% end %>
182197
<% end %>
183198
<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 &raquo;
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 &raquo;
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 &raquo;
192203
<% end %>
193204
</div>
194205
</div>
@@ -203,25 +214,45 @@
203214
<th colspan="3">Posts</th>
204215
</tr>
205216
<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>
207223
<td class="overflow-ellipsis" title="<%= @user.posts.undeleted.count %>">
208224
<%= @user.posts.undeleted.count %>
209225
</td>
210226
</tr>
211227
<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>
213234
<td class="overflow-ellipsis" title="<%= posts_for(posts_by_post_type, Question) %>">
214235
<%= posts_for(posts_by_post_type, Question) %>
215236
</td>
216237
</tr>
217238
<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>
219245
<td class="overflow-ellipsis" title="<%= posts_for(posts_by_post_type, Answer) %>">
220246
<%= posts_for(posts_by_post_type, Answer) %>
221247
</td>
222248
</tr>
223249
<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>
225256
<td class="overflow-ellipsis" title="<%= posts_for(posts_by_post_type, Article) %>">
226257
<%= posts_for(posts_by_post_type, Article) %>
227258
</td>
@@ -238,48 +269,48 @@
238269
<th colspan="3">Votes cast</th>
239270
</tr>
240271
<tr>
241-
<td colspan="2">Count</td>
272+
<td colspan="2">Total</td>
242273
<td class="overflow-ellipsis" title="<%= @user.votes.count %>"><%= @user.votes.count %></td>
243274
</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>
283314
<% end %>
284315
</table>
285316
<br>
@@ -288,9 +319,9 @@
288319
<th colspan="3">Flags raised</th>
289320
</tr>
290321
<tr>
291-
<td colspan="2">Count</td>
322+
<td colspan="2">Total</td>
292323
<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? %>
294325
<%= link_to @user.flags.count, flag_history_path(@user.id), class: 'is-muted',
295326
'aria-label': "View flag history for #{@user.flags.count} flags" %>
296327
<% else %>

0 commit comments

Comments
 (0)