From 00c77bbdf572a2f74fdc7ba67b4c5afd14894bd3 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Thu, 21 Aug 2025 14:44:17 -0500 Subject: [PATCH] Add unique IDs to all filter items --- app/assets/stylesheets/fizzy-menu.css | 1 + .../controllers/navigable_list_controller.js | 2 ++ app/views/cards/index/_collections_filter.html.erb | 6 +++--- app/views/events/filter/_header.html.erb | 14 +++++++------- app/views/events/filter/_places.html.erb | 14 +++++++------- app/views/events/filter/_tag.html.erb | 4 ++-- app/views/events/filter/_user.html.erb | 4 ++-- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/app/assets/stylesheets/fizzy-menu.css b/app/assets/stylesheets/fizzy-menu.css index cb7361a72..7a38895f3 100644 --- a/app/assets/stylesheets/fizzy-menu.css +++ b/app/assets/stylesheets/fizzy-menu.css @@ -52,6 +52,7 @@ flex-wrap: wrap; gap: var(--gap); inline-size: 100%; + list-style: none; justify-content: center; margin: var(--block-space) auto calc(var(--block-space-half) / 2); max-inline-size: 100%; diff --git a/app/javascript/controllers/navigable_list_controller.js b/app/javascript/controllers/navigable_list_controller.js index 533c3bb89..78a7e2176 100644 --- a/app/javascript/controllers/navigable_list_controller.js +++ b/app/javascript/controllers/navigable_list_controller.js @@ -74,6 +74,8 @@ export default class extends Controller { async #setCurrentFrom(element) { const selectedItem = this.#visibleItems.find(item => item.contains(element)) + console.log(selectedItem) + if (selectedItem) { this.#clearSelection() selectedItem.setAttribute(this.selectionAttributeValue, "true") diff --git a/app/views/cards/index/_collections_filter.html.erb b/app/views/cards/index/_collections_filter.html.erb index 7761ce1ad..3b3b6580f 100644 --- a/app/views/cards/index/_collections_filter.html.erb +++ b/app/views/cards/index/_collections_filter.html.erb @@ -5,14 +5,14 @@ <% end %> <% if Current.user.collections.one? %> - <%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "popup__group", data: { filter_target: "item", navigable_list_target: "item" } do %> + <%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "popup__group", id: "filter-collection-init", data: { filter_target: "item", navigable_list_target: "item" } do %> <%= tag.div class: "popup__item btn" do %> <%= Current.user.collections.first.name %> GO TO <% end %> <% end %> <% elsif Current.user.collections.many? %> - <%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "popup__group", data: { filter_target: "item", navigable_list_target: "item" } do %> + <%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "popup__group", id: "filter-collections-all", data: { filter_target: "item", navigable_list_target: "item" } do %>