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

Make suggested metadata elements optional #871

Merged
merged 5 commits into from
Feb 12, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/assets/javascripts/geoblacklight/modules/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ Blacklight.onLoad(function() {
// set hover listeners on map
$('#content')
.on('mouseenter', '#documents [data-layer-id]', function() {
var bounds = L.bboxToBounds($(this).data('bbox'));
geoblacklight.addBoundsOverlay(bounds);
if($(this).data('bbox').length > 0) {
var bounds = L.bboxToBounds($(this).data('bbox'));
geoblacklight.addBoundsOverlay(bounds);
}
})
.on('mouseleave', '#documents [data-layer-id]', function() {
geoblacklight.removeBoundsOverlay();
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/geoblacklight/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def oembed
end

def same_institution?
fetch(Settings.FIELDS.PROVENANCE).casecmp(Settings.INSTITUTION.downcase).zero?
fetch(Settings.FIELDS.PROVENANCE, '').casecmp(Settings.INSTITUTION.downcase).zero?
end

def iiif_download
Expand Down
12 changes: 12 additions & 0 deletions spec/features/missing_metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,16 @@
visit solr_document_path('aster-global-emissivity-dataset-1-kilometer-v003-ag1kmcad20')
expect(page).to have_css('#map')
end
scenario 'Yields error free show page for no layer_geom_type_s' do
visit solr_document_path('05d-03-noGeomType')
expect(page).to have_css('#map')
end
scenario 'Yields error free show page for no dct_provenance_s' do
visit solr_document_path('99-0001-noProvenance')
expect(page).to have_css('#map')
end
scenario 'Yields error free show page for no solr_geom' do
visit solr_document_path('05d-p16022coll246-noGeo')
expect(page).to have_css('#map')
end
end
30 changes: 30 additions & 0 deletions spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"geoblacklight_version": "1.0",
"layer_modified_dt": "2019-12-16T15:57:35Z",
"layer_slug_s": "99-0001-noProvenance",
"dc_identifier_s": "99-0001-noProvenance",
"dc_title_s": "Social Explorer",
"dct_temporal_sm": [
"1790-present"
],
"dc_description_s": "Requires creating a free account or logging in through an organization with licensed access. This interactive website includes the entire US census history from 1790 to 2000, the American Community Survey (ACS), and the Religious Congregations and Membership Study (RCMS) from 1980 to 2000? the most complete census available on religion in the U.S. Overall, the site contains 39 billion data points, 200,000 variables, and 15,000 interactive maps",
"dc_subject_sm": [
"Society"
],
"dc_type_sm": [
"Interactive Resource"
],
"dc_rights_s": "Restricted",
"layer_geom_type_s": "Table",
"solr_geom": "ENVELOPE(-179.9,-64.4,71.6,-14.8)",
"dc_publisher_sm": [
"Social Explorer"
],
"dc_creator_sm": [
"Queens College (New York, N.Y.). Department of Sociology"
],
"dct_spatial_sm": [
"United States"
],
"dct_references_s": "{\"http://schema.org/url\":\"https://www.socialexplorer.com/\"}"
}
17 changes: 17 additions & 0 deletions spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"geoblacklight_version": "1.0",
"layer_modified_dt": "2020-01-17T15:31:30Z",
"layer_slug_s": "05d-03-noGeomType",
"dc_identifier_s": "05d-03-noGeomType",
"dc_title_s": "University of Minnesota Digital Conservancy DRUM",
"dc_description_s": "DRUM is a publicly available collection of digital research data generated by University of Minnesota researchers, students, and staff. Anyone can search and download the data housed in the repository, instantly or by request.",
"dc_publisher_sm": [
"University of Minnesota Digital Conservancy"
],
"dc_type_sm": [
"Collection"
],
"dct_provenance_s": "Minnesota",
"dc_rights_s": "Public",
"dct_references_s": "{\"http://schema.org/url\":\"https://conservancy.umn.edu/handle/11299/166578\"}"
}
23 changes: 23 additions & 0 deletions spec/fixtures/solr_documents/metadata_no_solr_geom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"geoblacklight_version": "1.0",
"layer_modified_dt": "2020-01-23T14:01:19Z",
"layer_slug_s": "05d-p16022coll246-noGeo",
"dc_identifier_s": "05d-p16022coll246-noGeo",
"dc_title_s": "Ames Library of South Asia Maps",
"dc_description_s": "A collection of maps covering Asia held by the University of Minnesota's Ames Library of South Asia.",
"dc_publisher_sm": [
"University of Minnesota"
],
"dc_type_sm": [
"Collection"
],
"layer_geom_type_s": "Table",
"dct_provenance_s": "Minnesota",
"dct_spatial_sm": [
"Asia",
"India",
"Afghanistan"
],
"dc_rights_s": "Public",
"dct_references_s": "{\"http://schema.org/url\":\"https://umedia.lib.umn.edu/search?facets[collection_name_s][]=Ames+Library+of+South+Asia+Maps\"}"
}