-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #418 from nla/blac-682-adjust-collection-level-hea…
…ding BLAC-682: adjust collection level heading
- Loading branch information
Showing
9 changed files
with
248 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<ol class="breadcrumb"> | ||
<li class="breadcrumb-home-link"> | ||
<%= link_to t("arclight.routes.home"), root_path %> | ||
</li> | ||
<li class="breadcrumb-item breadcrumb-item-1"> | ||
<span aria-hidden="true"><%= blacklight_icon :repository, classes: "al-repository-content-icon" %></span> | ||
<span class="breadcrumb-text"><%= repository %></span> | ||
<ol class="breadcrumb"> | ||
<% if collection %> | ||
<li class="breadcrumb-item breadcrumb-item-2"> | ||
<span aria-hidden="true"><%= blacklight_icon :collection, classes: "al-collection-content-icon" %></span> | ||
<span class="breadcrumb-text"><%= link_to "#{t("collection_prefix")}#{collection.label}", solr_document_path(collection.global_id) %></span> | ||
|
||
<ol class="breadcrumb"> | ||
<% parents_under_collection.each do |parent| %> | ||
<li class="breadcrumb-item breadcrumb-item-3"> | ||
<span class="breadcrumb-text"><%= link_to parent.label, solr_document_path(parent.global_id) %></span> | ||
</li> | ||
<% end %> | ||
|
||
<li class="breadcrumb-item breadcrumb-item-4"> | ||
<span class="breadcrumb-text"><%= @presenter.heading %></span> | ||
</li> | ||
</ol> | ||
</li> | ||
<% else # this is a collection %> | ||
<li class="breadcrumb-item breadcrumb-item-4"> | ||
<span aria-hidden="true"><%= blacklight_icon :collection, classes: "al-collection-content-icon" %></span> | ||
<span class="breadcrumb-text"><%= @presenter.heading %></span> | ||
</li> | ||
<% end %> | ||
</ol> | ||
</li> | ||
</ol> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class BreadcrumbsHierarchyComponent < Arclight::BreadcrumbsHierarchyComponent | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
spec/components/arclight/breadcrumbs_hierarchy_component_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe BreadcrumbsHierarchyComponent, type: :component do | ||
let(:document) do | ||
SolrDocument.new( | ||
ead_ssi: "abc123", | ||
repository_ssm: "National Library of Australia", | ||
_root_: "abc123", | ||
normalized_title_ssm: "ABC123", | ||
level_ssm: "collection" | ||
) | ||
end | ||
let(:view_context) { ActionView::Base.new(nil, {}, nil) } | ||
let(:config) { Blacklight::Configuration.new } | ||
let(:show_presenter) { ShowPresenter.new(document, view_context, config) } | ||
|
||
context "when viewing collection" do | ||
it "renders collection title with prefix" do | ||
render_inline(described_class.new(presenter: show_presenter)) | ||
|
||
expect(page).to have_css "li", text: "National Library of Australia" | ||
expect(page).to have_css "li", text: "Guide to the ABC123" | ||
expect(page).not_to have_link "Guide to the ABC123" | ||
end | ||
end | ||
|
||
context "when viewing series" do | ||
let(:document) do | ||
SolrDocument.new( | ||
parent_ssim: %w[abc123 abc123_def], | ||
parent_unittitles_ssm: %w[ABC123 DEF], | ||
parent_levels_ssm: %w[collection Series], | ||
ead_ssi: "abc123", | ||
repository_ssm: "National Library of Australia", | ||
_root_: "abc123", | ||
normalized_title_ssm: "GHI", | ||
level_ssm: "Subseries" | ||
) | ||
end | ||
|
||
it "renders series titles without prefix" do | ||
render_inline(described_class.new(presenter: show_presenter)) | ||
|
||
expect(page).to have_css "li", text: "National Library of Australia" | ||
expect(page).to have_link "Guide to the ABC123", href: "/finding-aids/catalog/abc123" | ||
|
||
expect(page).to have_link "DEF", href: "/finding-aids/catalog/abc123abc123_def" | ||
expect(page).not_to have_link "Guide to the DEF", href: "/finding-aids/catalog/abc123abc123_def" | ||
|
||
expect(page).to have_css "li", text: "GHI" | ||
expect(page).not_to have_link "GHI" | ||
expect(page).not_to have_link "Guide to the GHI" | ||
end | ||
end | ||
|
||
context "when viewing file" do | ||
let(:document) do | ||
SolrDocument.new( | ||
parent_ssim: %w[abc123 abc123_def abc123_ghi], | ||
parent_unittitles_ssm: %w[ABC123 DEF GHI], | ||
parent_levels_ssm: %w[collection Series Subseries], | ||
ead_ssi: "abc123", | ||
repository_ssm: "National Library of Australia", | ||
_root_: "abc123", | ||
normalized_title_ssm: "JKL", | ||
level_ssm: "file" | ||
) | ||
end | ||
|
||
it "renders file titles without prefix" do | ||
render_inline(described_class.new(presenter: show_presenter)) | ||
|
||
expect(page).to have_css "li", text: "National Library of Australia" | ||
expect(page).to have_link "Guide to the ABC123", href: "/finding-aids/catalog/abc123" | ||
|
||
expect(page).to have_link "DEF", href: "/finding-aids/catalog/abc123abc123_def" | ||
expect(page).not_to have_link "Guide to the DEF", href: "/finding-aids/catalog/abc123abc123_def" | ||
|
||
expect(page).to have_link "GHI", href: "/finding-aids/catalog/abc123abc123_ghi" | ||
expect(page).not_to have_link "Guide to the GHI", href: "/finding-aids/catalog/abc123abc123_ghi" | ||
|
||
expect(page).to have_css "li", text: "JKL" | ||
expect(page).not_to have_link "Guide to the JKL" | ||
expect(page).not_to have_link "JKL" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "Document components" do | ||
before do | ||
solr_response = IO.read("spec/files/solr/280011976.json") | ||
|
||
WebMock.stub_request(:get, /solr:8983/) | ||
.with( | ||
headers: { | ||
"Accept" => "*/*", | ||
"Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" | ||
} | ||
) | ||
.to_return(status: 200, body: solr_response, headers: {}) | ||
end | ||
|
||
it "has correct tab title, including the collection prefix" do | ||
visit solr_document_path(id: "280011976") | ||
|
||
expect(page).to have_title(I18n.t("collection_prefix") + "19th century currency items, c1868-1895 - Finding Aids") | ||
end | ||
|
||
it "has correct breadcrumbs, including the collection prefix" do | ||
visit solr_document_path(id: "280011976") | ||
|
||
expect(page).to have_css("span.breadcrumb-text", text: I18n.t("collection_prefix") + "19th century currency items, c1868-1895") | ||
end | ||
|
||
it "has correct title, including the collection prefix" do | ||
visit solr_document_path(id: "280011976") | ||
|
||
expect(page).to have_css("div.title-container h1", text: I18n.t("collection_prefix") + "19th century currency items, c1868-1895") | ||
context "when at the collection level" do | ||
before do | ||
solr_response = IO.read("spec/files/solr/280011976.json") | ||
|
||
WebMock.stub_request(:get, /solr:8983/) | ||
.with( | ||
headers: { | ||
"Accept" => "*/*", | ||
"Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" | ||
} | ||
) | ||
.to_return(status: 200, body: solr_response, headers: {}) | ||
end | ||
|
||
it "has correct tab title, including the collection prefix" do | ||
visit solr_document_path(id: "280011976") | ||
|
||
expect(page).to have_title(I18n.t("collection_prefix") + "19th century currency items, c1868-1895 - Finding Aids") | ||
end | ||
|
||
it "has correct title, including the collection prefix" do | ||
visit solr_document_path(id: "280011976") | ||
|
||
expect(page).to have_css("div.title-container h1", text: I18n.t("collection_prefix") + "19th century currency items, c1868-1895") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"responseHeader":{ | ||
"zkConnected":true, | ||
"status":0, | ||
"QTime":1, | ||
"params":{ | ||
"q":"id:367300335367601811", | ||
"fl":"*", | ||
"_forwardedCount":"1", | ||
"wt":"json"}}, | ||
"response":{"numFound":1,"start":0,"numFoundExact":true,"docs":[ | ||
{ | ||
"id":"367300335367601811", | ||
"fav_obj_id_ssi":"nla.obj-367710222", | ||
"ref_ssi":"367601811", | ||
"ref_ssm":["367601811"], | ||
"component_level_isim":[2], | ||
"sort_isi":2, | ||
"bibid_ssi":"538326", | ||
"folio_instance_id_ssi":"2ff67ac1-fd2b-515c-ba93-248652d934c0", | ||
"parent_ssi":"367601771", | ||
"aspace_id_ssi":"aspace_8cf2270ccfec1a6513579cb137066c2f", | ||
"title_ssm":["Diaries, 1929, 1934; loose diary pages, 1916, 1929, 1930, 1935 and undated"], | ||
"title_tesim":["Diaries, 1929, 1934; loose diary pages, 1916, 1929, 1930, 1935 and undated"], | ||
"normalized_title_ssm":["Diaries, 1929, 1934; loose diary pages, 1916, 1929, 1930, 1935 and undated"], | ||
"text":["Diaries, 1929, 1934; loose diary pages, 1916, 1929, 1930, 1935 and undated", | ||
"1", | ||
"Braga, J.M. (José Maria)", | ||
"History"], | ||
"parent_ssim":["367300335", | ||
"367601771"], | ||
"parent_levels_ssm":["collection", | ||
"Series"], | ||
"parent_unittitles_ssm":["Papers of J.M. Braga, 1862-2000 (bulk 1920-1971)", | ||
"Diaries and notebooks, 1916-c.1972"], | ||
"parent_unittitles_tesim":["Papers of J.M. Braga, 1862-2000 (bulk 1920-1971)", | ||
"Diaries and notebooks, 1916-c.1972"], | ||
"collection_ssim":["Papers of J.M. Braga, 1862-2000 (bulk 1920-1971)"], | ||
"unitid_ssm":["1"], | ||
"ead_unitid_ssm":["367300335"], | ||
"repository_ssim":["National Library of Australia"], | ||
"collection_creator_ssm":["Braga, J.M. (José Maria)"], | ||
"has_online_content_ssim":["false"], | ||
"child_component_count_isi":0, | ||
"level_ssim":["File"], | ||
"level_ssm":["File"], | ||
"parent_access_restrict_tesm":["Available for research."], | ||
"parent_access_terms_tesm":["Copying and publishing of unpublished manuscript material is subject to copyright restrictions. For such material, written permission to publish must be obtained from the copyright holder(s). Copying of unpublished material for research purposes is permissible 50 years after the death of the creator of the material."], | ||
"names_ssim":["Braga, J.M. (José Maria)"], | ||
"access_subjects_ssim":["History"], | ||
"access_subjects_ssm":["History"], | ||
"acqinfo_ssim":["The bulk of the Braga Collection (including manuscripts, pictures, maps, newspapers, serials, periodicals, monographs and ephemera) was purchased from J.M. Braga in 1966. The component held in the Manuscript Collection at MS 4300 appears to have been formally accessioned as the J.M. Braga Papers in 1975. Several small additions have been made since the original instalment of papers was received. Most of these additions were transfers to the Manuscripts Collection from other collection areas, including a file of newspaper cuttings in May 1975, a set of microfilm reels in 1984, a file of manuscript material in 1985, lists of the Braga Collection in 1994, and two files of assorted printed material and other papers in 2009. As well, several small additions have been made by members of the Braga family. In 1992, various Braga family members donated a copy of the eulogy and order of service for Augusta Braga's memorial service, and in 2002 Angela Braga donated photographs of medals and decorations awarded to J.P. Braga, together with photocopies of early writings of J.M. Braga and eulogies for J.M. Braga and his grandson Michael Braga."], | ||
"_nest_path_":"/child#0/child#0", | ||
"_nest_parent_":"367300335367601771", | ||
"_root_":"367300335", | ||
"_version_":1796736391573405696, | ||
"timestamp":"2024-04-19T04:35:49.969Z"}] | ||
}, | ||
"facet_counts":{ | ||
"facet_queries":{}, | ||
"facet_fields":{ | ||
"level_ssim":[ | ||
"File",1], | ||
"creator_ssim":[], | ||
"date_range_ssim":[], | ||
"names_ssim":[ | ||
"Braga, J.M. (José Maria)",1], | ||
"geogname_ssim":[], | ||
"access_subjects_ssim":[ | ||
"History",1], | ||
"repository_ssim":[ | ||
"National Library of Australia",1], | ||
"collection_ssim":[ | ||
"Papers of J.M. Braga, 1862-2000 (bulk 1920-1971)",1]}, | ||
"facet_ranges":{}, | ||
"facet_intervals":{}, | ||
"facet_heatmaps":{}}, | ||
"spellcheck":{ | ||
"suggestions":[], | ||
"correctlySpelled":true}} |