Allow filtering activity by user via user profile

This commit is contained in:
Jason Zimdars
2025-05-21 21:57:58 -05:00
parent 4247f8dabc
commit d79f2f903f
3 changed files with 14 additions and 4 deletions
+5 -1
View File
@@ -27,7 +27,11 @@ class User::DayTimeline
private
def filtered_events
@filtered_events ||= Event.where(collection: collections)
@filtered_events ||= begin
events = Event.where(collection: collections)
events = events.where(creator_id: filter.creators.ids) if filter.creators.present?
events
end
end
def collections
+6 -1
View File
@@ -5,7 +5,12 @@
<div class="btn btn--circle btn--placeholder flex-item-justify-start"></div>
<div class="flex-inline flex-column center gap-half margin-block-end-double txt-align-center min-width">
<h2 class="font-black txt-large center overflow-ellipsis max-width"><%= Account.sole.name %> / Latest activity</h2>
<h2 class="font-black txt-large center overflow-ellipsis max-width">
<%= Account.sole.name %> / Latest activity
<% if @filter.creators.any? %>
by <%= @filter.creators.each_with_object([]) { |creator, names| names << creator.familiar_name }.to_sentence %>
<% end %>
</h2>
<%= render "events/filter", filter: @filter %>
</div>
+3 -2
View File
@@ -32,8 +32,9 @@
</div>
<div class="flex-inline center justify-center flex-wrap gap">
<%= link_to "See cards assigned to #{ Current.user == @user ? "you" : @user.first_name }", cards_path(assignee_ids: [@user.id], indexed_by: "newest"), class: "btn", data: { turbo_frame: "_top" } %>
<%= link_to "See cards added by #{ Current.user == @user ? "you" : @user.first_name }", cards_path(creator_ids: [@user.id], indexed_by: "newest"), class: "btn", data: { turbo_frame: "_top" } %>
<%= link_to "What #{ Current.user == @user ? "have you" : "#{ @user.first_name } has" } been up to?", events_path(creator_ids: [@user.id]), class: "btn", data: { turbo_frame: "_top" } %>
<%= link_to "Which cards are assigned to #{ Current.user == @user ? "you" : @user.first_name }?", cards_path(assignee_ids: [@user.id], indexed_by: "newest"), class: "btn", data: { turbo_frame: "_top" } %>
<%= link_to "Which cards were added by #{ Current.user == @user ? "you" : @user.first_name }?", cards_path(creator_ids: [@user.id], indexed_by: "newest"), class: "btn", data: { turbo_frame: "_top" } %>
</div>
</div>
</div>