Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with duplicate item ids #1435

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/components/arclight/document_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<% elsif document.children? %>
<div id="contents">
<h2 class="al-show-sub-heading"><%= t 'arclight.views.show.contents' %></h2>
<%= 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) %>
</div>
<% end %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
<ul>
<li>
Expand All @@ -28,5 +28,5 @@
<% end %>
<% else %>
<%# there aren't enough to bother paginating, so load them all at once %>
<%= helpers.turbo_frame_tag "al-hierarchy-#{@document.id}", loading: ('lazy' unless @target_index >= 0), src: hierarchy_path %>
<%= helpers.turbo_frame_tag "al-hierarchy-#{@document.id}-sidebar", loading: ('lazy' unless @target_index >= 0), src: hierarchy_path(key: '-sidebar') %>
<% end %>
2 changes: 1 addition & 1 deletion spec/features/aeon_web_ead_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
it 'creates a request link' do
visit solr_document_path 'm0198-xml'

within '#m0198-xmlaspace_ref11_d0s' do
within '#m0198-xmlaspace_ref11_d0s-hierarchy-item' do
click_link 'Pages 1-78'
end
expect(page).to have_css(
Expand Down
12 changes: 6 additions & 6 deletions spec/features/collection_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,20 @@

it 'sub components are viewable and expandable' do
within '#collection-context' do
within '#aoa271aspace_563a320bb37d24a9e1e6f7bf95b52671' do
within '#aoa271aspace_563a320bb37d24a9e1e6f7bf95b52671-hierarchy-item' do
click_link 'View'
within '#aoa271aspace_dc2aaf83625280ae2e193beb3f4aea78.al-collection-context' do
within '#aoa271aspace_dc2aaf83625280ae2e193beb3f4aea78-hierarchy-item.al-collection-context' do
expect(page).to have_link 'Constitution and by-laws'
end
click_link 'Expand'
expect(page).to have_link 'Reports'
el = find_by_id('aoa271aspace_238a0567431f36f49acea49ef576d408')
el = find_by_id('aoa271aspace_238a0567431f36f49acea49ef576d408-hierarchy-item')
evaluate_script "window.scrollTo(0,#{el.rect.y - 100})"
sleep 1
within '#aoa271aspace_238a0567431f36f49acea49ef576d408' do
within '#aoa271aspace_238a0567431f36f49acea49ef576d408-hierarchy-item' do
click_link 'View'
expect(page).to have_link 'Expansion Plan'
within '#aoa271aspace_f934f1add34289f28bd0feb478e68275' do
within '#aoa271aspace_f934f1add34289f28bd0feb478e68275-hierarchy-item' do
click_link 'View'
expect(page).to have_link 'Initial Phase'
expect(page).to have_link 'Phase II: Expansion'
Expand All @@ -215,7 +215,7 @@
end

it 'includes the number of direct children of the component' do
within '#aoa271aspace_563a320bb37d24a9e1e6f7bf95b52671' do
within '#aoa271aspace_563a320bb37d24a9e1e6f7bf95b52671-hierarchy-item' do
expect(page).to have_css(
'.al-number-of-children-badge',
text: /25/
Expand Down
4 changes: 2 additions & 2 deletions spec/features/component_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@

it 'enables expanding nodes outside of own ancestor tree' do
within '#collection-context' do
find('#aoa271aspace_01daa89087641f7fc9dbd7a10d3f2da9 .al-toggle-view-children').click
find('#aoa271aspace_01daa89087641f7fc9dbd7a10d3f2da9-hierarchy-item .al-toggle-view-children').click
expect(page).to have_css '.document-title-heading', text: 'Miscellaneous 1999'
end
end
Expand All @@ -202,7 +202,7 @@

it 'expands child nodes when clicked' do
within '#collection-context' do
find('#pc0170-xmlaspace_ref5_edi .al-toggle-view-children').click
find('#pc0170-xmlaspace_ref5_edi-hierarchy-item .al-toggle-view-children').click
expect(page).to have_css '.document-title-heading', text: 'Restricted images, 1979-2000'
end
end
Expand Down