Skip to content

Commit

Permalink
Merge pull request #1486 from pulibrary/i1448_dimensions_subfield
Browse files Browse the repository at this point in the history
Added dimensions_ssm field to component view
  • Loading branch information
eliotjordan authored Jan 10, 2025
2 parents 425e983 + 0c3ed66 commit 39ff641
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def index
config.add_component_field "normalized_date_ssm", label: "Dates"
config.add_component_field "physloc_ssm", label: "Located In"
config.add_component_field "extent_ssm", label: "Extent"
config.add_component_field "dimensions_ssm", label: "Dimensions"
config.add_component_field "physfacet_ssm", label: "Physical Description", accessor: :fetch_html_safe
config.add_component_field "language_ssm", label: "Languages"
config.add_component_field "scopecontent_ssm", label: "Description", helper_method: :paragraph_separator, accessor: :fetch_html_safe
Expand Down
5 changes: 5 additions & 0 deletions app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def self.json_attributes
:date_created,
:created,
:extent,
:dimensions,
:container,
:heldBy,
:creator,
Expand Down Expand Up @@ -154,6 +155,10 @@ def extents
fetch("extent_ssm", [])
end

def dimensions
fetch("dimensions_ssm", [])
end

def fetch_html_safe(field)
fetch(field, []).map(&:html_safe)
end
Expand Down
4 changes: 4 additions & 0 deletions spec/features/catalog_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
expect(page).to have_css(".collection.title a span", text: "Harold B. Hoskins Papers, 1822-1982")
expect(page).not_to have_css(".collection-attributes h2.media span.col")
end
it "renders dimensions" do
visit "catalog/WC064_c1"
expect(page).to have_content("Dimensions:\n10 x 7 cm.")
end
it "renders a component title with a correctly formatted date" do
visit "catalog/C1588_c9"
expect(page).to have_css(".document-title > h2", text: "Unused AIC Supply Request Form, circa 1885")
Expand Down

0 comments on commit 39ff641

Please sign in to comment.