From 42e8267da73b0004fc72348d4ec2b54231d8bd63 Mon Sep 17 00:00:00 2001 From: Dean Farrell Date: Wed, 6 Dec 2023 18:11:30 -0500 Subject: [PATCH] Fix issues with duplicate item ids (#1435) * Fix issues with duplicate item ids between the collection sidebar and the collection contents display. * Update test with new id structure --- .../document_collection_hierarchy_component.html.erb | 2 +- app/components/arclight/document_component.html.erb | 2 +- .../document_components_hierarchy_component.html.erb | 4 ++-- spec/features/aeon_web_ead_request_spec.rb | 2 +- spec/features/collection_page_spec.rb | 12 ++++++------ spec/features/component_page_spec.rb | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/components/arclight/document_collection_hierarchy_component.html.erb b/app/components/arclight/document_collection_hierarchy_component.html.erb index 40537fbe4..59c6f7181 100644 --- a/app/components/arclight/document_collection_hierarchy_component.html.erb +++ b/app/components/arclight/document_collection_hierarchy_component.html.erb @@ -1,5 +1,5 @@ <%= content_tag :li, - id: @document.id, + id: "#{@document.id}-hierarchy-item", data: { 'document-id': @document.id.to_s.parameterize, 'document-counter': @counter, diff --git a/app/components/arclight/document_component.html.erb b/app/components/arclight/document_component.html.erb index 193067acc..55d47ead3 100644 --- a/app/components/arclight/document_component.html.erb +++ b/app/components/arclight/document_component.html.erb @@ -32,7 +32,7 @@ <% elsif document.children? %>

<%= t 'arclight.views.show.contents' %>

- <%= helpers.turbo_frame_tag "al-hierarchy-#{document.id}", loading: 'lazy', src: helpers.hierarchy_solr_document_path(id: document.id, paginate: true, per_page: 50) %> + <%= helpers.turbo_frame_tag "al-hierarchy-#{document.id}-document", loading: 'lazy', src: helpers.hierarchy_solr_document_path(id: document.id, paginate: true, key: '-document', per_page: 50) %>
<% end %> diff --git a/app/components/arclight/document_components_hierarchy_component.html.erb b/app/components/arclight/document_components_hierarchy_component.html.erb index af6c485ab..a42663205 100644 --- a/app/components/arclight/document_components_hierarchy_component.html.erb +++ b/app/components/arclight/document_components_hierarchy_component.html.erb @@ -18,7 +18,7 @@ <% end %> <% elsif paginate? %> <%# render the first N documents, and let the user expand the remaining if desired %> - <%= helpers.turbo_frame_tag "al-hierarchy-#{@document.id}", loading: ('lazy' unless @target_index >= 0), src: hierarchy_path(limit: @maximum_left_gap) %> + <%= helpers.turbo_frame_tag "al-hierarchy-#{@document.id}-sidebar", loading: ('lazy' unless @target_index >= 0), src: hierarchy_path(limit: @maximum_left_gap, key: '-sidebar') %> <%= tag.turbo_frame id: "al-hierarchy-#{@document.id}-right" do %>