Skip to content

Commit c83c8f7

Browse files
committed
Ensure the Access section is linked in the CollectionSidebarComponent
1 parent 614c418 commit c83c8f7

File tree

8 files changed

+53
-32
lines changed

8 files changed

+53
-32
lines changed

app/assets/stylesheets/arclight/modules/layout.scss

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,6 @@
9191
}
9292
}
9393

94-
// Show page metadata.
95-
// Indent to match terminal show page breadcrumb.
96-
@for $i from 1 to 20 {
97-
.al-metadata-section.breadcrumb-item-#{$i} {
98-
padding-left: 0;
99-
100-
@media (min-width: 768px) {
101-
padding-left: ($i * 10) + 10px;
102-
}
103-
}
104-
}
105-
10694
.bookmark-toggle .toggle-bookmark {
10795
display: inline;
10896
margin-bottom: 0;

app/components/arclight/collection_sidebar_component.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ def initialize(document:, partials:, collection_presenter:)
1414
attr_reader :document, :partials, :collection_presenter
1515

1616
def has_section?(section)
17+
# Access field data comes from repositories.yml not from solr, so handle it in a different way.
18+
return true if section == :access_field
19+
1720
collection_presenter.with_field_group(section).fields_to_render.any?
1821
end
1922

app/components/arclight/document_component.html.erb

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
<% end %>
3131
</div>
3232

33-
<%= render Arclight::MetadataSectionComponent.with_collection(component_metadata_partials, metadata_attr: { layout: Arclight::UpperMetadataLayoutComponent }, presenter: presenter, classes: ['al-metadata-section']) unless document.collection? %>
33+
<%= render Arclight::MetadataSectionComponent.with_collection(component_metadata_partials,
34+
metadata_attr: { layout: Arclight::UpperMetadataLayoutComponent },
35+
presenter: presenter) unless document.collection? %>
3436

3537
<div class='row'>
3638
<div class='col-md-12'>
@@ -41,7 +43,9 @@
4143
<% if document.collection? %>
4244
<div id="metadata">
4345
<h2 class="sr-only visually-hidden"><%= t 'arclight.views.show.context' %></h2>
44-
<%= render Arclight::MetadataSectionComponent.with_collection(metadata_partials, presenter: presenter, heading: true) %>
46+
<%= render Arclight::MetadataSectionComponent.with_collection(metadata_partials,
47+
metadata_attr: { layout: Arclight::UpperMetadataLayoutComponent },
48+
presenter: presenter, heading: true) %>
4549
</div>
4650
<% elsif document.children? %>
4751
<div id="contents">
@@ -52,15 +56,19 @@
5256

5357
<% access_content = capture do %>
5458
<% if @document.collection? %>
55-
<%= render Arclight::MetadataSectionComponent.with_collection(context_access_tab_items, presenter: presenter) %>
59+
<%= render Arclight::MetadataSectionComponent.with_collection(context_access_tab_items,
60+
metadata_attr: { layout: Arclight::UpperMetadataLayoutComponent },
61+
presenter: presenter) %>
5662
<% else %>
57-
<%= render Arclight::MetadataSectionComponent.with_collection(component_access_tab_items, presenter: presenter) %>
63+
<%= render Arclight::MetadataSectionComponent.with_collection(component_access_tab_items,
64+
metadata_attr: { layout: Arclight::UpperMetadataLayoutComponent },
65+
presenter: presenter) %>
5866
<% end %>
5967
<% end %>
6068

6169
<% if access_content.present? %>
62-
<div id="access">
63-
<h2 class="al-show-sub-heading"><%= t 'arclight.views.show.access' %></h2>
70+
<div id="<%= t('arclight.views.show.sections.access_field').parameterize %>">
71+
<h2 class="al-show-sub-heading"><%= t 'arclight.views.show.sections.access_field' %></h2>
6472

6573
<%= access_content%>
6674
</div>

app/components/arclight/upper_metadata_layout_component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# frozen_string_literal: true
22

33
module Arclight
4-
# Override upstream to remove bootstrap column classes
4+
# Override upstream to add an offset bootstrap column class
55
class UpperMetadataLayoutComponent < Blacklight::MetadataFieldLayoutComponent
6-
def initialize(field:, label_class: nil, value_class: nil)
6+
def initialize(field:, label_class: 'col-md-3 offset-md-1', value_class: 'col-md-8')
77
super
88
end
99
end

config/locales/arclight.en.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ en:
5252
view_all_collections: View all of our collections
5353
view_more: View more
5454
show:
55-
access: Access
5655
collection_id: 'Collection ID: %{id}'
5756
contents: Contents
5857
context: Collection context

lib/generators/arclight/templates/catalog_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ class CatalogController < ApplicationController
7878
config.show.document_presenter_class = Arclight::ShowPresenter
7979
config.show.metadata_partials = %i[
8080
summary_field
81-
access_field
8281
background_field
8382
related_field
8483
indexed_terms_field
84+
access_field
8585
]
8686

8787
config.show.context_access_tab_items = %i[
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
RSpec.describe Arclight::CollectionSidebarComponent, type: :component do
6+
subject(:component) do
7+
described_class.new(document: document,
8+
partials: CatalogController.blacklight_config.show.metadata_partials,
9+
collection_presenter: collection_presenter)
10+
end
11+
12+
before do
13+
render_inline(component)
14+
end
15+
16+
let(:document) { instance_double(SolrDocument, normalized_eadid: 'foo') }
17+
let(:collection_presenter) { instance_double(Arclight::ShowPresenter, with_field_group: group_presenter) }
18+
let(:group_presenter) { instance_double(Arclight::ShowPresenter, fields_to_render: [double]) }
19+
20+
it 'has navigation links' do
21+
expect(page).to have_link 'Summary'
22+
expect(page).to have_link 'Background'
23+
expect(page).to have_link 'Related'
24+
expect(page).to have_link 'Indexed Terms'
25+
expect(page).to have_link 'Access and Use'
26+
end
27+
end

spec/features/component_page_spec.rb

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,21 +209,17 @@
209209
end
210210
end
211211

212-
describe 'access tab', js: true do
213-
it 'has visitation notes' do
214-
expect(page).to have_css 'dt', text: 'LOCATION OF THIS COLLECTION:'
212+
describe 'access section' do
213+
it 'has access metadata' do
214+
expect(page).to have_css 'dt', text: 'Location of this collection:'
215215
expect(page).to have_css 'dd', text: 'Building 38, Room 1E-21'
216-
end
217216

218-
it 'has a restrictions and access' do
219-
expect(page).to have_css 'dt', text: 'PARENT RESTRICTIONS:'
217+
expect(page).to have_css 'dt', text: 'Parent Restrictions:'
220218
expect(page).to have_css 'dd', text: /^RESTRICTED: Access to these folders requires prior written approval./
221-
expect(page).to have_css 'dt', text: 'TERMS OF ACCESS:'
219+
expect(page).to have_css 'dt', text: 'Terms of Access:'
222220
expect(page).to have_css 'dd', text: /^Copyright was transferred to the public domain./
223-
end
224221

225-
it 'has a contact' do
226-
expect(page).to have_css 'dt', text: 'CONTACT:'
222+
expect(page).to have_css 'dt', text: 'Contact:'
227223
expect(page).to have_css 'dd', text: '[email protected]'
228224
end
229225
end

0 commit comments

Comments
 (0)