Skip to content

Commit a6ced92

Browse files
authored
Merge pull request #1736 from codidact/0valt/1735/activity-tab
Fix for the "all events" filter tab on the user activity page
2 parents 78c1f6e + 1853292 commit a6ced92

File tree

3 files changed

+39
-45
lines changed

3 files changed

+39
-45
lines changed

app/assets/stylesheets/utilities.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ span.spoiler {
359359
overflow-wrap: anywhere;
360360
}
361361

362+
.wrap-word {
363+
overflow-wrap: break-word;
364+
}
365+
362366
.nowrap {
363367
white-space: nowrap;
364368
}

app/views/users/_activity_items.html.erb

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,28 @@
1010
<tr class="<%= deleted_item?(i) ? 'deleted-content' : '' %>">
1111
<% if i.class == Post %>
1212
<% type_name = (i.question? ? 'Question' : (i.article? ? 'Article' : 'Answer')) %>
13-
<td>
14-
<span class="h-fw-bold">
15-
<%= type_name %>
16-
</span>
17-
</td>
13+
<td class="wrap-word"><span class="h-fw-bold"><%= type_name %></span></td>
1814
<td>&mdash;</td>
1915
<td class="h-fs-caption">
2016
<% working_title = i.answer? ? "A: #{i.parent.title}" : i.title %>
2117
<strong><%= working_title %></strong><br>
2218
<%= i.body_plain[0..300] + ((i.body_plain.length > 300) ? "..." : "") %><br>
23-
<%= link_to '(more)', generic_share_link(i), 'aria-label': "More information about #{type_name} #{working_title}" %>
19+
<%= link_to '(more)',
20+
generic_share_link(i),
21+
'aria-label': "More information about #{type_name} #{working_title}" %>
2422
</td>
2523
<td>&mdash;</td>
2624
<% elsif i.class == Comment %>
27-
<td>
28-
Comment
29-
</td>
30-
<td>
31-
<%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %>
32-
</td>
25+
<td class="wrap-word">Comment</td>
26+
<td><%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %></td>
3327
<td class="h-fs-caption">
34-
<%= i.content[0..300] + ((i.content.length > 300) ? "..." : "") %><br>
28+
<%= i.content[0..300] + ((i.content.length > 300) ? '...' : '') %><br>
3529
<%= link_to '(more)', comment_link(i), 'aria-label': 'More information about comment' %>
3630
</td>
3731
<td>&mdash;</td>
3832
<% elsif i.class == PostHistory %>
39-
<td>
40-
Edit
41-
</td>
42-
<td>
43-
<%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %>
44-
</td>
33+
<td class="wrap-word">Edit</td>
34+
<td><%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %></td>
4535
<td class="h-fs-caption">
4636
<% if i.comment %>
4737
<em><%= i.post_history_type.name.gsub("_", " ").capitalize %></em>:<br><%= i.comment %>
@@ -51,38 +41,32 @@
5141
</td>
5242
<td>&mdash;</td>
5343
<% elsif i.class == SuggestedEdit %>
54-
<td>
55-
Suggested Edit
56-
</td>
57-
<td>
58-
<%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %>
59-
</td>
44+
<td class="wrap-word">Suggested Edit</td>
45+
<td><%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %></td>
6046
<td class="h-fs-caption">
6147
<em>Suggested edit</em>:<br><%= i.comment %><br>
62-
<%= link_to '(more)', suggested_edit_url(i.id), 'aria-label': "More information about suggested edit #{i.comment}" %>
48+
<%= link_to '(more)',
49+
suggested_edit_url(i.id),
50+
'aria-label': "More information about suggested edit #{i.comment}" %>
6351
</td>
6452
<td>
65-
<%= (i.pending? ? "pending" : (i.approved? ? "helpful" : "declined")) %>
53+
<%= (i.pending? ? 'pending' : (i.approved? ? 'helpful' : 'declined')) %>
6654
</td>
6755
<% elsif mod && i.class == ModWarning %>
68-
<td>
69-
<span class="h-fw-bold h-c-red-700">Warning</span>
70-
</td>
56+
<td class="wrap-word"><span class="h-fw-bold h-c-red-700">Warning</span></td>
7157
<td>&mdash;</td>
7258
<td class="h-fs-caption">
7359
<%= i.body[0..300] + ((i.body.length > 300) ? "..." : "") %>
7460
</td>
7561
<td>&mdash;</td>
7662
<% elsif mod && i.class == Flag %>
63+
<td class="wrap-word">Flag</td>
7764
<td>
78-
Flag
79-
</td>
80-
<td>
81-
<% if i.post_type == 'Post' %>
65+
<% if i.post_type == 'Post' %>
8266
<%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post)%>
83-
<% elsif i.post_type == 'Comment' %>
84-
<%= link_to "Comment thread: " + i.post.comment_thread.title, comment_link(i.post) %>
85-
<% end %>
67+
<% elsif i.post_type == 'Comment' %>
68+
<%= link_to "Comment thread: " + i.post.comment_thread.title, comment_link(i.post) %>
69+
<% end %>
8670
</td>
8771
<td class="h-fs-caption">
8872
<%= i.reason[0..300] + ((i.reason.length > 300) ? "..." : "") %><br>
@@ -91,9 +75,7 @@
9175
<%= i.status || "pending" %>
9276
</td>
9377
<% else %>
94-
<td>
95-
<span class="badge is-tag is-muted">Unknown</span>
96-
</td>
78+
<td class="wrap-word"><span class="badge is-tag is-muted">Unknown</span></td>
9779
<td>&mdash;</td>
9880
<td><%= i.class %></td>
9981
<td>&mdash;</td>

app/views/users/activity.html.erb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,28 @@
77
<h1>Activity for <%= user_link @user %></h1>
88

99
<div class="button-list is-gutterless h-m-v-4">
10-
<a class="button is-muted is-outlined" href="?" role="button">
11-
Show all events
10+
<a class="button is-muted is-outlined <%= 'is-active' unless params[:filter].present? %>"
11+
href="<%= user_activity_path %>"
12+
role="button">
13+
All events
1214
</a>
13-
<a class="button is-muted is-outlined <%= params[:filter] == 'posts' ? 'is-active' : '' %>" href="?filter=posts" role="button">
15+
<a class="button is-muted is-outlined <%= 'is-active' if params[:filter] == 'posts' %>"
16+
href="<%= user_activity_path(filter: :posts) %>"
17+
role="button">
1418
Posts
1519
<% if @posts > 0 %><span class="badge is-status"><%= @posts %></span>
1620
<% end %>
1721
</a>
18-
<a class="button is-muted is-outlined <%= params[:filter] == 'comments' ? 'is-active' : '' %>" href="?filter=comments" role="button">
22+
<a class="button is-muted is-outlined <%= 'is-active' if params[:filter] == 'comments' %>"
23+
href="<%= user_activity_path(filter: :comments) %>"
24+
role="button">
1925
Comments
2026
<% if @comments > 0 %><span class="badge is-status"><%= @comments %></span>
2127
<% end %>
2228
</a>
23-
<a class="button is-muted is-outlined <%= params[:filter] == 'edits' ? 'is-active' : '' %>" href="?filter=edits" role="button">
29+
<a class="button is-muted is-outlined <%= 'is-active' if params[:filter] == 'edits' %>"
30+
href="<%= user_activity_path(filter: :edits) %>"
31+
role="button">
2432
Edits
2533
<% if @all_edits > 0 %><span class="badge is-status"><%= @all_edits %></span>
2634
<% end %>

0 commit comments

Comments
 (0)