diff --git a/app/helpers/collections_helper.rb b/app/helpers/collections_helper.rb new file mode 100644 index 000000000..ac1debab4 --- /dev/null +++ b/app/helpers/collections_helper.rb @@ -0,0 +1,5 @@ +module CollectionsHelper + def referenced_collections_from(records) + Current.user.collections.where id: records.pluck(:collection_id).uniq + end +end diff --git a/app/views/cards/_broadcasts.html.erb b/app/views/cards/_broadcasts.html.erb new file mode 100644 index 000000000..d2404ae68 --- /dev/null +++ b/app/views/cards/_broadcasts.html.erb @@ -0,0 +1,3 @@ +<% referenced_collections_from(records).each do |collection| %> + <%= turbo_stream_from collection %> +<% end %> diff --git a/app/views/cards/index.html.erb b/app/views/cards/index.html.erb index 8b496c670..d700b363a 100644 --- a/app/views/cards/index.html.erb +++ b/app/views/cards/index.html.erb @@ -1,7 +1,7 @@ <% @page_title = @user_filtering.selected_collections_label %> <% turbo_exempts_page_from_cache %> -<%= render "filters/broadcasts", filter: @filter %> +<%= render "cards/broadcasts", records: @page.records %> <% content_for :head do %> <%= tag.meta property: "og:title", content: @page_title %> diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb index d6a777d40..4868a5295 100644 --- a/app/views/events/index.html.erb +++ b/app/views/events/index.html.erb @@ -1,7 +1,7 @@ <% @page_title = "Home" %> <% @header_class = "header--events" %> -<%= render "filters/broadcasts", filter: @filter %> +<%= render "cards/broadcasts", records: @day_timeline.events %> <% content_for :header do %> <%= render "filters/menu" %> diff --git a/app/views/filters/_broadcasts.html.erb b/app/views/filters/_broadcasts.html.erb deleted file mode 100644 index a432280e6..000000000 --- a/app/views/filters/_broadcasts.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% if filter.collections.any? %> - <% filter.collections.each do |collection| %> - <%= turbo_stream_from collection %> - <% end %> -<% else %> - <%= turbo_stream_from :collections %> -<% end %>