From a2bc6ddd35bf87854fa114d013d71a07a02aa5b7 Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 4 Sep 2024 13:54:57 +0100 Subject: [PATCH] change activity feed to a table --- app/views/activities/_create_actor.html.erb | 52 +++++++++---------- .../activities/_create_following.html.erb | 34 ++++++------ app/views/activities/_update_actor.html.erb | 50 +++++++++--------- app/views/home/index.html.erb | 14 +++-- 4 files changed, 70 insertions(+), 80 deletions(-) diff --git a/app/views/activities/_create_actor.html.erb b/app/views/activities/_create_actor.html.erb index fc4f015e2..94663b5c3 100644 --- a/app/views/activities/_create_actor.html.erb +++ b/app/views/activities/_create_actor.html.erb @@ -2,32 +2,28 @@ <%- object = activity&.entity %> <%- thing = object&.entity %> <% if thing && !thing.is_a?(User) && (thing.grants_permission_to?(["view", "edit", "own"], current_user) || thing.grants_permission_to?(["view", "edit", "own"], current_user&.roles)) %> -
-
-
-
- <%= icon icon_for(thing.class), thing.class.model_name.human %> -
-
- <%- if object.local? %> - <%= link_to thing.name, thing %> - <%- elsif object.profile_url %> - <%= link_to object.name, object.profile_url %> - <%- else %> - <%= object.name %> - <%- end %> -
- <% if thing.is_a? Model %> -
- <%= status_badges(thing) %> -
- <% end %> -
- - <%= t("home.index.create_actor", time: time_ago_in_words(thing.created_at), name: subject.name) %> - -
-
-
-
+ + + <%= icon icon_for(thing.class), thing.class.model_name.human %> + + + <%- if object.local? %> + <%= link_to thing.name, thing %> + <%- elsif object.profile_url %> + <%= link_to object.name, object.profile_url %> + <%- else %> + <%= object.name %> + <%- end %> + + + <% if thing.is_a? Model %> + <%= status_badges(thing) %> + <% end %> + + + + <%= t("home.index.create_actor", time: time_ago_in_words(thing.created_at), name: subject.name) %> + + + <% end %> diff --git a/app/views/activities/_create_following.html.erb b/app/views/activities/_create_following.html.erb index e4f077f46..a4878a135 100644 --- a/app/views/activities/_create_following.html.erb +++ b/app/views/activities/_create_following.html.erb @@ -1,20 +1,18 @@ <%- follow = activity.entity %> -
-
-
-
- <% if follow.actor.entity == current_user %> - You - <% else %> - <%= follow.actor.name %> - <% end %> - followed - <%= link_to follow.target_actor.name, follow.target_actor.entity %> -
-
- <%= t("home.index.how_long_ago", time: time_ago_in_words(follow.created_at)) %> -
-
-
-
+ + + + <% if follow.actor.entity == current_user %> + You + <% else %> + <%= follow.actor.name %> + <% end %> + followed + <%= link_to follow.target_actor.name, follow.target_actor.entity %> + + + + <%= t("home.index.how_long_ago", time: time_ago_in_words(follow.created_at)) %> + + diff --git a/app/views/activities/_update_actor.html.erb b/app/views/activities/_update_actor.html.erb index 320121acf..430cf7743 100644 --- a/app/views/activities/_update_actor.html.erb +++ b/app/views/activities/_update_actor.html.erb @@ -2,32 +2,30 @@ <%- object = activity&.entity %> <%- thing = object&.entity %> <% if thing && !thing.is_a?(User) && (thing.grants_permission_to?(["view", "edit", "own"], current_user) || thing.grants_permission_to?(["view", "edit", "own"], current_user&.roles)) %> -
-
-
+ + + <%= icon icon_for(thing.class), thing.class.model_name.human %> + + + <%- if object.local? %> + <%= link_to thing.name, thing %> + <%- elsif object.profile_url %> + <%= link_to object.name, object.profile_url %> + <%- else %> + <%= object.name %> + <%- end %> + + + <% if thing.is_a? Model %>
- <%= icon icon_for(thing.class), thing.class.model_name.human %> + <%= status_badges(thing) %>
-
- <%- if object.local? %> - <%= link_to thing.name, thing %> - <%- elsif object.profile_url %> - <%= link_to object.name, object.profile_url %> - <%- else %> - <%= object.name %> - <%- end %> -
- <% if thing.is_a? Model %> -
- <%= status_badges(thing) %> -
- <% end %> -
- - <%= t("home.index.update_actor", time: time_ago_in_words(thing.updated_at), name: subject.name) %> - -
-
-
-
+ <% end %> + + + + <%= t("home.index.update_actor", time: time_ago_in_words(thing.updated_at), name: subject.name) %> + + + <% end %> diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 62f28881e..edbd9bc66 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -17,12 +17,10 @@ <% if !@feed.empty? %> -
-
-

<%= t(".recent_activity") %>

- <% @feed.each do |activity| %> - <%= render partial: "activities/#{activity.action.parameterize}_#{activity.entity_type.demodulize.parameterize}", locals: {activity: activity} %> - <% end %> -
-
+

<%= t(".recent_activity") %>

+ + <% @feed.each do |activity| %> + <%= render partial: "activities/#{activity.action.parameterize}_#{activity.entity_type.demodulize.parameterize}", locals: {activity: activity} %> + <% end %> +
<% end %>