diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index cd8b69cbd..1fd336ce9 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -9,7 +9,7 @@ class CollectionsController < ApplicationController def show if @filter.used?(ignore_collections: true) - show_filtered_events + show_filtered_cards else show_columns end @@ -45,7 +45,7 @@ class CollectionsController < ApplicationController @collection = Current.user.collections.find params[:id] end - def show_filtered_events + def show_filtered_cards @filter.collection_ids = [ @collection.id ] set_page_and_extract_portion_from @filter.cards end diff --git a/app/helpers/collections_helper.rb b/app/helpers/collections_helper.rb index 1cb9d8a17..3342cb480 100644 --- a/app/helpers/collections_helper.rb +++ b/app/helpers/collections_helper.rb @@ -12,8 +12,4 @@ module CollectionsHelper icon_tag("settings") + tag.span("Settings for #{collection.name}", class: "for-screen-reader") end end - - def referenced_collections_from(records) - Current.user.collections.where id: records.pluck(:collection_id).uniq - end end diff --git a/app/javascript/controllers/multi_selection_combobox_controller.js b/app/javascript/controllers/multi_selection_combobox_controller.js index 80d7f0826..40f7c3459 100644 --- a/app/javascript/controllers/multi_selection_combobox_controller.js +++ b/app/javascript/controllers/multi_selection_combobox_controller.js @@ -13,8 +13,7 @@ export default class extends Controller { } connect() { - this.labelTarget.textContent = this.#selectedLabel - this.#updateHiddenFields() + this.refresh() } change(event) { @@ -24,6 +23,10 @@ export default class extends Controller { } } + refresh() { + this.labelTarget.textContent = this.#selectedLabel + this.#updateHiddenFields() + } clear(event) { this.#deselectAll() diff --git a/app/models/collection/broadcastable.rb b/app/models/collection/broadcastable.rb index f8ac71f83..e44adc0ac 100644 --- a/app/models/collection/broadcastable.rb +++ b/app/models/collection/broadcastable.rb @@ -3,5 +3,6 @@ module Collection::Broadcastable included do broadcasts_refreshes + broadcasts_refreshes_to ->(_) { :all_collections } end end diff --git a/app/views/cards/_broadcasts.html.erb b/app/views/cards/_broadcasts.html.erb index d2404ae68..e3a285f05 100644 --- a/app/views/cards/_broadcasts.html.erb +++ b/app/views/cards/_broadcasts.html.erb @@ -1,3 +1,7 @@ -<% referenced_collections_from(records).each do |collection| %> - <%= turbo_stream_from collection %> +<% if filter.collections.any? %> + <% filter.collections.each do |collection| %> + <%= turbo_stream_from collection %> + <% end %> +<% else %> + <%= turbo_stream_from :all_collections %> <% end %> diff --git a/app/views/cards/index.html.erb b/app/views/cards/index.html.erb index 35a2b3891..21045e866 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 "cards/broadcasts", records: @page.records %> +<%= render "cards/broadcasts", filter: @filter %> <% content_for :header do %>