Skip to content

Commit

Permalink
Change default component_identifier_format to include underscore
Browse files Browse the repository at this point in the history
This breaking change closes #1318
  • Loading branch information
marlo-longley committed Dec 12, 2023
1 parent cd3631f commit 3de2de5
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 72 deletions.
2 changes: 1 addition & 1 deletion app/models/arclight/parent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def collection?
def global_id
return id if eadid == id

"#{eadid}#{id}"
"#{eadid}_#{id}"
end
end
end
2 changes: 1 addition & 1 deletion lib/arclight/traject/ead2_component_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
provide 'title_normalizer', 'Arclight::NormalizedTitle'
provide 'reader_class_name', 'Arclight::Traject::NokogiriNamespacelessReader'
provide 'logger', Logger.new($stderr)
provide 'component_identifier_format', '%<root_id>s%<ref_id>s'
provide 'component_identifier_format', '%<root_id>s_%<ref_id>s'
end

NAME_ELEMENTS = %w[corpname famname name persname].freeze
Expand Down
1 change: 0 additions & 1 deletion lib/arclight/traject/ead2_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
provide 'solr_writer.commit_on_close', 'true'
provide 'repository', ENV.fetch('REPOSITORY_ID', nil)
provide 'logger', Logger.new($stderr)
provide 'component_traject_config', File.join(__dir__, 'ead2_component_config.rb')
end

each_record do |_record, context|
Expand Down
12 changes: 6 additions & 6 deletions spec/components/arclight/breadcrumb_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

it 'renders only that many breadcrumb links' do
expect(rendered).to have_selector 'li', text: 'my repository'
expect(rendered).to have_link 'DEF', href: '/catalog/abc123def'
expect(rendered).not_to have_link 'GHI', href: '/catalog/abc123ghi'
expect(rendered).to have_link 'DEF', href: '/catalog/abc123_def'
expect(rendered).not_to have_link 'GHI', href: '/catalog/abc123_ghi'
end

it 'renders an ellipsis if there are more links than the count' do
Expand All @@ -43,14 +43,14 @@

it 'skips some breadcrumb links' do
expect(rendered).not_to have_selector 'li', text: 'my repository'
expect(rendered).not_to have_link 'DEF', href: '/catalog/abc123def'
expect(rendered).to have_link 'GHI', href: '/catalog/abc123ghi'
expect(rendered).not_to have_link 'DEF', href: '/catalog/abc123_def'
expect(rendered).to have_link 'GHI', href: '/catalog/abc123_ghi'
end
end

it 'renders breadcrumb links' do
expect(rendered).to have_selector 'li', text: 'my repository'
expect(rendered).to have_link 'DEF', href: '/catalog/abc123def'
expect(rendered).to have_link 'GHI', href: '/catalog/abc123ghi'
expect(rendered).to have_link 'DEF', href: '/catalog/abc123_def'
expect(rendered).to have_link 'GHI', href: '/catalog/abc123_ghi'
end
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-hierarchy-item' do
within '#m0198-xml_aspace_ref11_d0s-hierarchy-item' do
click_link 'Pages 1-78'
end
expect(page).to have_css(
Expand Down
2 changes: 1 addition & 1 deletion spec/features/arclight_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

describe 'eadid with a period' do
it 'is visitable with a hyphen' do
visit solr_document_path('m0198-xmlaspace_ref11_d0s')
visit solr_document_path('m0198-xml_aspace_ref11_d0s')
expect(page).to have_css 'h1', text: 'Pages 1-78'
end
end
Expand Down
14 changes: 7 additions & 7 deletions spec/features/collection_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

RSpec.describe 'Collection context', js: true do
let(:doc_id) { 'aoa271aspace_6ea193f778e553ca9ea0d00a3e5a1891' }
let(:doc_id) { 'aoa271_aspace_6ea193f778e553ca9ea0d00a3e5a1891' }

before do
visit solr_document_path(id: doc_id)
Expand All @@ -15,17 +15,17 @@
end

it 'siblings are not expanded' do
expect(page).to have_css '.al-toggle-view-children.collapsed[href="#collapsible-hierarchy-aoa271aspace_b70574c7229e6f237f780579cc04595d"]'
expect(page).to have_css '.al-toggle-view-children.collapsed[href="#collapsible-hierarchy-aoa271_aspace_b70574c7229e6f237f780579cc04595d"]'
end

it 'direct ancestors are expanded' do
expect(page).to have_css '#collapsible-hierarchy-aoa271aspace_f934f1add34289f28bd0feb478e68275.show', visible: :visible
expect(page).to have_css '#collapsible-hierarchy-aoa271aspace_238a0567431f36f49acea49ef576d408.show', visible: :visible
expect(page).to have_css '#collapsible-hierarchy-aoa271aspace_563a320bb37d24a9e1e6f7bf95b52671.show', visible: :visible
expect(page).to have_css '#collapsible-hierarchy-aoa271_aspace_f934f1add34289f28bd0feb478e68275.show', visible: :visible
expect(page).to have_css '#collapsible-hierarchy-aoa271_aspace_238a0567431f36f49acea49ef576d408.show', visible: :visible
expect(page).to have_css '#collapsible-hierarchy-aoa271_aspace_563a320bb37d24a9e1e6f7bf95b52671.show', visible: :visible
end

it 'siblings above are hidden' do
expect(page).not_to have_css '#aoa271aspace_843e8f9f22bac69872d0802d6fffbb04'
expect(page).not_to have_css '#aoa271_aspace_843e8f9f22bac69872d0802d6fffbb04'
end
end
end
end
6 changes: 3 additions & 3 deletions spec/features/collection_filtering_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@

context 'when on a record view' do
it 'has the a select input with the "this collection" option selected' do
visit solr_document_path('lc0100aspace_327a75c226d44aa1a769edb4d2f13c6e')
visit solr_document_path('lc0100_aspace_327a75c226d44aa1a769edb4d2f13c6e')

within 'form.search-query-form' do
expect(page).to have_select('Search', selected: 'this collection')
end
end

it 'searches within the collection context by default' do
visit solr_document_path('aoa271aspace_dba76dab6f750f31aa5fc73e5402e71d')
visit solr_document_path('aoa271_aspace_dba76dab6f750f31aa5fc73e5402e71d')

fill_in 'q', with: 'File'
click_button 'Search'
Expand All @@ -56,7 +56,7 @@
end

it 'allows the user to choose to search all collections' do
visit solr_document_path('aoa271aspace_dba76dab6f750f31aa5fc73e5402e71d')
visit solr_document_path('aoa271_aspace_dba76dab6f750f31aa5fc73e5402e71d')

select 'all collections', from: 'Search within'
fill_in 'q', with: 'File'
Expand Down
18 changes: 9 additions & 9 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-hierarchy-item' do
within '#aoa271_aspace_563a320bb37d24a9e1e6f7bf95b52671-hierarchy-item' do
click_link 'View'
within '#aoa271aspace_dc2aaf83625280ae2e193beb3f4aea78-hierarchy-item.al-collection-context' do
within '#aoa271_aspace_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-hierarchy-item')
el = find_by_id('aoa271_aspace_238a0567431f36f49acea49ef576d408-hierarchy-item')
evaluate_script "window.scrollTo(0,#{el.rect.y - 100})"
sleep 1
within '#aoa271aspace_238a0567431f36f49acea49ef576d408-hierarchy-item' do
within '#aoa271_aspace_238a0567431f36f49acea49ef576d408-hierarchy-item' do
click_link 'View'
expect(page).to have_link 'Expansion Plan'
within '#aoa271aspace_f934f1add34289f28bd0feb478e68275-hierarchy-item' do
within '#aoa271_aspace_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-hierarchy-item' do
within '#aoa271_aspace_563a320bb37d24a9e1e6f7bf95b52671-hierarchy-item' do
expect(page).to have_css(
'.al-number-of-children-badge',
text: /25/
Expand Down Expand Up @@ -243,7 +243,7 @@
end

context 'content with file downloads', js: true do
let(:doc_id) { 'a0011-xmlaspace_ref6_lx4' }
let(:doc_id) { 'a0011-xml_aspace_ref6_lx4' }

it 'renders links to the files for download' do
within '.al-show-actions-box-downloads-container' do
Expand All @@ -260,12 +260,12 @@
end

context 'with EAD documents which require Aeon requests' do
let(:doc_id) { 'm0198-xmlaspace_ref11_d0s' }
let(:doc_id) { 'm0198-xml_aspace_ref11_d0s' }

it 'renders links to the Aeon request form' do
expect(page).to have_css '.al-request'
expect(page).to have_css '.al-request a[href^="https://sample.request.com"]'
end
end
end
end
end
24 changes: 12 additions & 12 deletions spec/features/component_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

RSpec.describe 'Component Page' do
let(:doc_id) { 'aoa271aspace_843e8f9f22bac69872d0802d6fffbb04' }
let(:doc_id) { 'aoa271_aspace_843e8f9f22bac69872d0802d6fffbb04' }
let(:download_config) do
ActiveSupport::HashWithIndifferentAccess.new(
default: {
Expand Down Expand Up @@ -52,7 +52,7 @@
end

describe 'Indexed Terms subjects section' do
let(:doc_id) { 'aoa271aspace_01daa89087641f7fc9dbd7a10d3f2da9' }
let(:doc_id) { 'aoa271_aspace_01daa89087641f7fc9dbd7a10d3f2da9' }

it 'includes subjects dt subheading text' do
expect(page).to have_css('dt.blacklight-access_subjects', text: 'Subjects:')
Expand All @@ -70,7 +70,7 @@
end

describe 'metadata' do
let(:doc_id) { 'aoa271aspace_dc2aaf83625280ae2e193beb3f4aea78' }
let(:doc_id) { 'aoa271_aspace_dc2aaf83625280ae2e193beb3f4aea78' }

it 'uses our rules for displaying containers' do
expect(page).to have_css('dd', text: 'Box 1, Folder 4-5')
Expand Down Expand Up @@ -143,7 +143,7 @@
end

context 'duplicate titles' do
let(:doc_id) { 'lc0100aspace_c5ef89d4ae68bb77e7c641f3edb3f1c8' }
let(:doc_id) { 'lc0100_aspace_c5ef89d4ae68bb77e7c641f3edb3f1c8' }

it 'does not highlight duplicate titles' do
within '#collection-context .al-hierarchy-highlight' do
Expand All @@ -153,7 +153,7 @@
end

context 'when there are more than ten previous sibling documents for the current document' do
let(:doc_id) { 'lc0100aspace_ca60f0c03c4638b89e0348c3c6f7b50e' }
let(:doc_id) { 'lc0100_aspace_ca60f0c03c4638b89e0348c3c6f7b50e' }

it 'hides all but the first sibling document items' do
within '#collection-context' do
Expand All @@ -178,18 +178,18 @@
end

context 'when on a deeply nested component' do
let(:doc_id) { 'aoa271aspace_6ea193f778e553ca9ea0d00a3e5a1891' }
let(:doc_id) { 'aoa271_aspace_6ea193f778e553ca9ea0d00a3e5a1891' }

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

it 'includes ancestor\'s preceding sibling when clicking ancestor\'s Expand button' do
within '#collection-context' do
within('#collapsible-hierarchy-aoa271aspace_563a320bb37d24a9e1e6f7bf95b52671') do
within('#collapsible-hierarchy-aoa271_aspace_563a320bb37d24a9e1e6f7bf95b52671') do
first('.btn-secondary', text: 'Expand').click
end
expect(page).to have_css '.document-title-heading', text: 'Officers and directors - lists, 1961, n.d.'
Expand All @@ -198,11 +198,11 @@
end

context 'when on a component with an eadid with . normalized to -' do
let(:doc_id) { 'pc0170-xmlaspace_ref1_z0j' }
let(:doc_id) { 'pc0170-xml_aspace_ref1_z0j' }

it 'expands child nodes when clicked' do
within '#collection-context' do
find('#pc0170-xmlaspace_ref5_edi-hierarchy-item .al-toggle-view-children').click
find('#pc0170-xml_aspace_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 Expand Up @@ -237,7 +237,7 @@
end

context 'content with file downloads', js: true do
let(:doc_id) { 'a0011-xmlaspace_ref6_lx4' }
let(:doc_id) { 'a0011-xml_aspace_ref6_lx4' }

it 'renders links to the files for download' do
within '.al-show-actions-box-downloads-container' do
Expand All @@ -247,4 +247,4 @@
end
end
end
end
end
2 changes: 1 addition & 1 deletion spec/features/document_tools_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

context 'for components' do
let(:doc_id) { 'm0198-xmlaspace_ref11_d0s' }
let(:doc_id) { 'm0198-xml_aspace_ref11_d0s' }

pending 'renders the bookmark option' do
expect(page).to have_css('.al-document-title-bar form.bookmark-toggle')
Expand Down
10 changes: 5 additions & 5 deletions spec/features/google_form_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
context 'when container is present' do
context 'repository is requestable' do
it 'form is present with filled out values' do
visit solr_document_path 'aoa271aspace_843e8f9f22bac69872d0802d6fffbb04'
visit solr_document_path 'aoa271_aspace_843e8f9f22bac69872d0802d6fffbb04'

within 'form' do
expect(page).to have_css(
'input[name="entry.1980510262"][value$="catalog/aoa271aspace_843e8f9f22bac69872d0802d6fffbb04"]',
'input[name="entry.1980510262"][value$="catalog/aoa271_aspace_843e8f9f22bac69872d0802d6fffbb04"]',
visible: :hidden
)
expect(page).to have_css('input[name="entry.619150170"][value="Alpha Omega Alpha Archives, 1894-1992"]',
Expand All @@ -25,7 +25,7 @@

context 'repository is not requestable' do
it 'form is absent' do
visit solr_document_path 'm0198-xmlaspace_ref14_di4'
visit solr_document_path 'm0198-xml_aspace_ref14_di4'
expect(page).not_to have_css 'form'
end
end
Expand All @@ -34,7 +34,7 @@

context 'when container is absent' do
it 'form is absent' do
visit solr_document_path 'aoa271aspace_238a0567431f36f49acea49ef576d408'
visit solr_document_path 'aoa271_aspace_238a0567431f36f49acea49ef576d408'
expect(page).not_to have_css 'form'
end
end
Expand All @@ -57,7 +57,7 @@
end

it 'shows up in context' do
visit solr_document_path 'aoa271aspace_843e8f9f22bac69872d0802d6fffbb04'
visit solr_document_path 'aoa271_aspace_843e8f9f22bac69872d0802d6fffbb04'
within '#collection-context' do
expect(page).to have_css 'form[action*="https://docs.google.com"]', count: 3
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/item_breadcrumbs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

it 'show page breadcrumbs' do
visit solr_document_path id: 'aoa271aspace_e8755922a9336970292ca817983e7139'
visit solr_document_path id: 'aoa271_aspace_e8755922a9336970292ca817983e7139'
expect(page).to have_css 'li.breadcrumb-item a', count: 5
end
end
4 changes: 2 additions & 2 deletions spec/features/many_component_ead_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
within '#collection-context' do
click_link 'View'
click_link 'Expand'
within '#collapsible-hierarchy-lc0100aspace_327a75c226d44aa1a769edb4d2f13c6e' do
within '#collapsible-hierarchy-lc0100_aspace_327a75c226d44aa1a769edb4d2f13c6e' do
expect(page).to have_css 'li.al-collection-context', count: 202
end
end
end
end
end
end
6 changes: 3 additions & 3 deletions spec/features/online_content_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
require 'spec_helper'

RSpec.describe 'Online Content' do
let(:doc_id) { 'aoa271aspace_843e8f9f22bac69872d0802d6fffbb04' }
let(:doc_id) { 'aoa271_aspace_843e8f9f22bac69872d0802d6fffbb04' }

before { visit solr_document_path(id: doc_id) }

describe 'Viewer' do
context 'embedded content' do
let(:doc_id) { 'a0011-xmlaspace_ref6_lx4' }
let(:doc_id) { 'a0011-xml_aspace_ref6_lx4' }

it 'renders digital object viewer initialization markup', js: true do
expect(page).to have_css(
Expand All @@ -20,7 +20,7 @@
end

context 'non-embeddable content' do
let(:doc_id) { 'aoa271aspace_843e8f9f22bac69872d0802d6fffbb04' }
let(:doc_id) { 'aoa271_aspace_843e8f9f22bac69872d0802d6fffbb04' }

it 'renders a list of links', js: true do
expect(page).to have_link 'Folder of digitized stuff'
Expand Down
Loading

0 comments on commit 3de2de5

Please sign in to comment.