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

Use collection_id for linking rather than inferring from eadid #1531

Merged
merged 1 commit into from
May 7, 2024
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
4 changes: 1 addition & 3 deletions app/components/arclight/collection_sidebar_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ def section_label(section)
end

def document_path
@document_path ||= solr_document_path(normalized_eadid)
@document_path ||= solr_document_path(document.collection_id)
end

def section_anchor(section)
"##{t("arclight.views.show.sections.#{section}").parameterize}"
end

delegate :normalized_eadid, to: :document
end
end
2 changes: 1 addition & 1 deletion app/models/arclight/parents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def as_parents
# @param [SolrDocument] document
def self.from_solr_document(document)
ids = document.parent_ids
legacy_ids = document.legacy_parent_ids.map { |legacy_id| document.eadid == legacy_id ? legacy_id : "#{document.eadid}#{legacy_id}" }
legacy_ids = document.legacy_parent_ids.map { |legacy_id| document.collection_id == legacy_id ? legacy_id : "#{document.collection_id}#{legacy_id}" }
labels = document.parent_labels
eadid = document.eadid
levels = document.parent_levels
Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/arclight/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module SolrDocument
attribute :total_component_count, :string, 'total_component_count_is'
attribute :online_item_count, :string, 'online_item_count_is'
attribute :last_indexed, :date, 'timestamp'
attribute :collection_id, :string, '_root_'
end

def repository_config
Expand Down
6 changes: 4 additions & 2 deletions spec/components/arclight/breadcrumb_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
parent_ids_ssim: %w[abc123 abc123_def abc123_ghi],
parent_unittitles_ssm: %w[ABC123 DEF GHI],
ead_ssi: 'abc123',
repository_ssm: 'my repository'
repository_ssm: 'my repository',
_root_: 'abc123'
)
end

Expand Down Expand Up @@ -62,7 +63,8 @@
parent_ssim: %w[abc123 def ghi],
parent_unittitles_ssm: %w[ABC123 DEF GHI],
ead_ssi: 'abc123',
repository_ssm: 'my repository'
repository_ssm: 'my repository',
_root_: 'abc123'
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
render_inline(component)
end

let(:document) { instance_double(SolrDocument, normalized_eadid: 'foo') }
let(:document) { instance_double(SolrDocument, collection_id: 'foo') }
let(:collection_presenter) { instance_double(Arclight::ShowPresenter, with_field_group: group_presenter) }
let(:group_presenter) { instance_double(Arclight::ShowPresenter, fields_to_render: [double]) }

Expand Down
2 changes: 2 additions & 0 deletions spec/models/arclight/parents_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
parent_ids_ssim: %w[abc123 abc123_def abc123_ghi],
parent_unittitles_ssm: %w[ABC123 DEF GHI],
ead_ssi: 'abc123',
_root_: 'abc123',
parent_levels_ssm: %w[collection]
)
end
Expand All @@ -17,6 +18,7 @@
parent_ssim: %w[abc123 def ghi],
parent_unittitles_ssm: %w[ABC123 DEF GHI],
ead_ssi: 'abc123',
_root_: 'abc123',
parent_levels_ssm: %w[collection]
)
end
Expand Down
1 change: 1 addition & 0 deletions spec/models/concerns/arclight/solr_document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
it { expect(document).to respond_to(:parent_ids) }
it { expect(document).to respond_to(:parent_labels) }
it { expect(document).to respond_to(:eadid) }
it { expect(document).to respond_to(:collection_id) }
end

describe '#repository_config' do
Expand Down