Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/assets/stylesheets/utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ span.spoiler {
overflow-wrap: anywhere;
}

.wrap-word {
overflow-wrap: break-word;
}

.nowrap {
white-space: nowrap;
}
Expand Down
62 changes: 22 additions & 40 deletions app/views/users/_activity_items.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,28 @@
<tr class="<%= deleted_item?(i) ? 'deleted-content' : '' %>">
<% if i.class == Post %>
<% type_name = (i.question? ? 'Question' : (i.article? ? 'Article' : 'Answer')) %>
<td>
<span class="h-fw-bold">
<%= type_name %>
</span>
</td>
<td class="wrap-word"><span class="h-fw-bold"><%= type_name %></span></td>
<td>&mdash;</td>
<td class="h-fs-caption">
<% working_title = i.answer? ? "A: #{i.parent.title}" : i.title %>
<strong><%= working_title %></strong><br>
<%= i.body_plain[0..300] + ((i.body_plain.length > 300) ? "..." : "") %><br>
<%= link_to '(more)', generic_share_link(i), 'aria-label': "More information about #{type_name} #{working_title}" %>
<%= link_to '(more)',
generic_share_link(i),
'aria-label': "More information about #{type_name} #{working_title}" %>
</td>
<td>&mdash;</td>
<% elsif i.class == Comment %>
<td>
Comment
</td>
<td>
<%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %>
</td>
<td class="wrap-word">Comment</td>
<td><%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %></td>
<td class="h-fs-caption">
<%= i.content[0..300] + ((i.content.length > 300) ? "..." : "") %><br>
<%= i.content[0..300] + ((i.content.length > 300) ? '...' : '') %><br>
<%= link_to '(more)', comment_link(i), 'aria-label': 'More information about comment' %>
</td>
<td>&mdash;</td>
<% elsif i.class == PostHistory %>
<td>
Edit
</td>
<td>
<%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %>
</td>
<td class="wrap-word">Edit</td>
<td><%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %></td>
<td class="h-fs-caption">
<% if i.comment %>
<em><%= i.post_history_type.name.gsub("_", " ").capitalize %></em>:<br><%= i.comment %>
Expand All @@ -51,38 +41,32 @@
</td>
<td>&mdash;</td>
<% elsif i.class == SuggestedEdit %>
<td>
Suggested Edit
</td>
<td>
<%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %>
</td>
<td class="wrap-word">Suggested Edit</td>
<td><%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post) %></td>
<td class="h-fs-caption">
<em>Suggested edit</em>:<br><%= i.comment %><br>
<%= link_to '(more)', suggested_edit_url(i.id), 'aria-label': "More information about suggested edit #{i.comment}" %>
<%= link_to '(more)',
suggested_edit_url(i.id),
'aria-label': "More information about suggested edit #{i.comment}" %>
</td>
<td>
<%= (i.pending? ? "pending" : (i.approved? ? "helpful" : "declined")) %>
<%= (i.pending? ? 'pending' : (i.approved? ? 'helpful' : 'declined')) %>
</td>
<% elsif mod && i.class == ModWarning %>
<td>
<span class="h-fw-bold h-c-red-700">Warning</span>
</td>
<td class="wrap-word"><span class="h-fw-bold h-c-red-700">Warning</span></td>
<td>&mdash;</td>
<td class="h-fs-caption">
<%= i.body[0..300] + ((i.body.length > 300) ? "..." : "") %>
</td>
<td>&mdash;</td>
<% elsif mod && i.class == Flag %>
<td class="wrap-word">Flag</td>
<td>
Flag
</td>
<td>
<% if i.post_type == 'Post' %>
<% if i.post_type == 'Post' %>
<%= link_to "Post #" + i.post.id.to_s, generic_share_link(i.post)%>
<% elsif i.post_type == 'Comment' %>
<%= link_to "Comment thread: " + i.post.comment_thread.title, comment_link(i.post) %>
<% end %>
<% elsif i.post_type == 'Comment' %>
<%= link_to "Comment thread: " + i.post.comment_thread.title, comment_link(i.post) %>
<% end %>
</td>
<td class="h-fs-caption">
<%= i.reason[0..300] + ((i.reason.length > 300) ? "..." : "") %><br>
Expand All @@ -91,9 +75,7 @@
<%= i.status || "pending" %>
</td>
<% else %>
<td>
<span class="badge is-tag is-muted">Unknown</span>
</td>
<td class="wrap-word"><span class="badge is-tag is-muted">Unknown</span></td>
<td>&mdash;</td>
<td><%= i.class %></td>
<td>&mdash;</td>
Expand Down
18 changes: 13 additions & 5 deletions app/views/users/activity.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,28 @@
<h1>Activity for <%= user_link @user %></h1>

<div class="button-list is-gutterless h-m-v-4">
<a class="button is-muted is-outlined" href="?" role="button">
Show all events
<a class="button is-muted is-outlined <%= 'is-active' unless params[:filter].present? %>"
href="<%= user_activity_path %>"
role="button">
All events
</a>
<a class="button is-muted is-outlined <%= params[:filter] == 'posts' ? 'is-active' : '' %>" href="?filter=posts" role="button">
<a class="button is-muted is-outlined <%= 'is-active' if params[:filter] == 'posts' %>"
href="<%= user_activity_path(filter: :posts) %>"
role="button">
Posts
<% if @posts > 0 %><span class="badge is-status"><%= @posts %></span>
<% end %>
</a>
<a class="button is-muted is-outlined <%= params[:filter] == 'comments' ? 'is-active' : '' %>" href="?filter=comments" role="button">
<a class="button is-muted is-outlined <%= 'is-active' if params[:filter] == 'comments' %>"
href="<%= user_activity_path(filter: :comments) %>"
role="button">
Comments
<% if @comments > 0 %><span class="badge is-status"><%= @comments %></span>
<% end %>
</a>
<a class="button is-muted is-outlined <%= params[:filter] == 'edits' ? 'is-active' : '' %>" href="?filter=edits" role="button">
<a class="button is-muted is-outlined <%= 'is-active' if params[:filter] == 'edits' %>"
href="<%= user_activity_path(filter: :edits) %>"
role="button">
Edits
<% if @all_edits > 0 %><span class="badge is-status"><%= @all_edits %></span>
<% end %>
Expand Down