geoblacklight 3.3.0 → 4.0.0.pre.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +34 -28
  3. data/.rubocop.yml +5 -0
  4. data/.rubocop_todo.yml +11 -6
  5. data/README.md +1 -1
  6. data/Rakefile +7 -8
  7. data/app/assets/images/blacklight/michigan-state-university.svg +6 -0
  8. data/app/assets/images/blacklight/pennsylvania-state-university.svg +6 -0
  9. data/app/assets/images/blacklight/purdue-university.svg +6 -0
  10. data/app/assets/images/blacklight/the-ohio-state-university.svg +7 -0
  11. data/app/assets/images/blacklight/university-of-chicago.svg +6 -0
  12. data/app/assets/images/blacklight/university-of-illinois-urbana-champaign.svg +6 -0
  13. data/app/assets/images/blacklight/university-of-iowa.svg +5 -0
  14. data/app/assets/images/blacklight/university-of-maryland.svg +5 -0
  15. data/app/assets/images/blacklight/university-of-michigan.svg +5 -0
  16. data/app/assets/images/blacklight/university-of-minnesota.svg +5 -0
  17. data/app/assets/images/blacklight/university-of-nebraska-lincoln.svg +8 -0
  18. data/app/assets/images/blacklight/university-of-wisconsin-madison.svg +5 -0
  19. data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +41 -0
  20. data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +6 -0
  21. data/app/components/geoblacklight/homepage_feature_facet_component.html.erb +11 -0
  22. data/app/components/geoblacklight/homepage_feature_facet_component.rb +13 -0
  23. data/{lib → app/helpers}/geoblacklight/geoblacklight_helper_behavior.rb +6 -4
  24. data/app/helpers/geoblacklight_helper.rb +1 -22
  25. data/app/models/concerns/geoblacklight/solr_document/citation.rb +2 -2
  26. data/app/models/concerns/geoblacklight/solr_document.rb +4 -4
  27. data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +3 -3
  28. data/app/views/catalog/_arcgis.html.erb +1 -1
  29. data/app/views/catalog/_data_dictionary.html.erb +1 -2
  30. data/app/views/catalog/_downloads_primary.html.erb +1 -1
  31. data/app/views/catalog/_header_icons.html.erb +1 -1
  32. data/app/views/catalog/_home_text.html.erb +7 -29
  33. data/app/views/catalog/_show_header_default.html.erb +1 -1
  34. data/app/views/relation/_relations.html.erb +15 -0
  35. data/app/views/relation/index.html.erb +4 -16
  36. data/app/views/relation/index.json.jbuilder +6 -2
  37. data/config/initializers/new_gbl_settings_defaults_3_4.yml +6 -0
  38. data/config/initializers/rails_config.rb +0 -4
  39. data/config/locales/geoblacklight.en.yml +8 -0
  40. data/geoblacklight.gemspec +1 -1
  41. data/lib/generators/geoblacklight/templates/catalog_controller.rb +82 -35
  42. data/lib/generators/geoblacklight/templates/settings.gbl_v1.yml +195 -0
  43. data/lib/generators/geoblacklight/templates/settings.yml +87 -22
  44. data/lib/geoblacklight/download/geojson_download.rb +1 -1
  45. data/lib/geoblacklight/download/geotiff_download.rb +1 -1
  46. data/lib/geoblacklight/download/hgl_download.rb +1 -1
  47. data/lib/geoblacklight/download/kmz_download.rb +1 -1
  48. data/lib/geoblacklight/download/shapefile_download.rb +1 -1
  49. data/lib/geoblacklight/engine.rb +0 -2
  50. data/lib/geoblacklight/geometry.rb +18 -3
  51. data/lib/geoblacklight/references.rb +1 -1
  52. data/lib/geoblacklight/relation/ancestors.rb +4 -3
  53. data/lib/geoblacklight/relation/descendants.rb +4 -3
  54. data/lib/geoblacklight/relation/relation_response.rb +21 -6
  55. data/lib/geoblacklight/version.rb +1 -1
  56. data/lib/geoblacklight/view_helper_override.rb +1 -1
  57. data/lib/geoblacklight.rb +0 -1
  58. data/schema/{geoblacklight-schema.json → geoblacklight-schema-1.0.json} +1 -1
  59. data/schema/geoblacklight-schema-aardvark.json +211 -0
  60. data/solr/conf/schema.xml +38 -30
  61. data/solr/conf/solrconfig.xml +15 -15
  62. data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +39 -0
  63. data/spec/config/initializers/rails_config_spec.rb +9 -8
  64. data/spec/controllers/catalog_controller_spec.rb +6 -6
  65. data/spec/features/download_layer_spec.rb +1 -1
  66. data/spec/features/esri_viewer_spec.rb +1 -1
  67. data/spec/features/home_page_spec.rb +4 -4
  68. data/spec/features/layer_opacity_spec.rb +1 -0
  69. data/spec/features/metadata_panel_spec.rb +1 -1
  70. data/spec/features/missing_metadata_spec.rb +2 -2
  71. data/spec/features/relations_spec.rb +2 -2
  72. data/spec/features/search_results_map_spec.rb +2 -1
  73. data/spec/features/search_results_overlap_ratio_spec.rb +2 -2
  74. data/spec/features/split_view.html.erb_spec.rb +15 -11
  75. data/spec/fixtures/solr_documents/README.md +48 -36
  76. data/spec/fixtures/solr_documents/actual-papermap1.json +41 -18
  77. data/spec/fixtures/solr_documents/actual-point1.json +47 -27
  78. data/spec/fixtures/solr_documents/actual-polygon1.json +43 -18
  79. data/spec/fixtures/solr_documents/actual-raster1.json +52 -23
  80. data/spec/fixtures/solr_documents/all-relationships.json +48 -0
  81. data/spec/fixtures/solr_documents/baruch_ancestor1.json +62 -37
  82. data/spec/fixtures/solr_documents/baruch_ancestor2.json +62 -37
  83. data/spec/fixtures/solr_documents/baruch_documentation_download.json +60 -34
  84. data/spec/fixtures/solr_documents/bbox-spans-180.json +34 -16
  85. data/spec/fixtures/solr_documents/cornell_html_metadata.json +46 -26
  86. data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +43 -25
  87. data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +45 -28
  88. data/spec/fixtures/solr_documents/esri-feature-layer.json +44 -34
  89. data/spec/fixtures/solr_documents/esri-image-map-layer.json +45 -31
  90. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +42 -17
  91. data/spec/fixtures/solr_documents/esri-wms-layer.json +46 -21
  92. data/spec/fixtures/solr_documents/harvard_raster.json +55 -36
  93. data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +35 -22
  94. data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +48 -27
  95. data/spec/fixtures/solr_documents/index-map-polygon.json +48 -27
  96. data/spec/fixtures/solr_documents/index-map-stanford.json +54 -25
  97. data/spec/fixtures/solr_documents/index_map_point.json +54 -26
  98. data/spec/fixtures/solr_documents/metadata_no_geom.json +27 -0
  99. data/spec/fixtures/solr_documents/metadata_no_provider.json +39 -0
  100. data/spec/fixtures/solr_documents/multiple-downloads.json +33 -20
  101. data/spec/fixtures/solr_documents/no_locn_geometry.json +25 -0
  102. data/spec/fixtures/solr_documents/no_spatial.json +37 -19
  103. data/spec/fixtures/solr_documents/oembed.json +34 -17
  104. data/spec/fixtures/solr_documents/princeton-child1.json +45 -28
  105. data/spec/fixtures/solr_documents/princeton-child2.json +45 -28
  106. data/spec/fixtures/solr_documents/princeton-child3.json +45 -28
  107. data/spec/fixtures/solr_documents/princeton-child4.json +45 -28
  108. data/spec/fixtures/solr_documents/princeton-parent.json +46 -23
  109. data/spec/fixtures/solr_documents/public_direct_download.json +48 -21
  110. data/spec/fixtures/solr_documents/public_iiif_princeton.json +49 -24
  111. data/spec/fixtures/solr_documents/public_polygon_mit.json +31 -15
  112. data/spec/fixtures/solr_documents/restricted-line.json +52 -21
  113. data/spec/fixtures/solr_documents/the-related-record.json +27 -0
  114. data/spec/fixtures/solr_documents/tms.json +33 -17
  115. data/spec/fixtures/solr_documents/umn_metro_result1.json +44 -28
  116. data/spec/fixtures/solr_documents/umn_state_result1.json +44 -26
  117. data/spec/fixtures/solr_documents/umn_state_result2.json +45 -24
  118. data/spec/fixtures/solr_documents/uva_slug_colon.json +43 -20
  119. data/spec/{lib → helpers}/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
  120. data/spec/helpers/geoblacklight_helper_spec.rb +0 -19
  121. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -1
  122. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -1
  123. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -1
  124. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +1 -1
  125. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -1
  126. data/spec/lib/geoblacklight/download_spec.rb +1 -1
  127. data/spec/lib/geoblacklight/geometry_spec.rb +15 -4
  128. data/spec/lib/geoblacklight/references_spec.rb +2 -2
  129. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +3 -3
  130. data/spec/lib/geoblacklight/relation/descendants_spec.rb +3 -3
  131. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +32 -17
  132. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +4 -4
  133. data/spec/spec_helper.rb +2 -0
  134. data/spec/support/view_component_capybara_test_helpers.rb +8 -0
  135. metadata +41 -29
  136. data/app/views/catalog/_document_action.html.erb +0 -6
  137. data/app/views/catalog/_facet_tag_item.html.erb +0 -3
  138. data/app/views/catalog/_facet_tag_layout.html.erb +0 -2
  139. data/app/views/relation/_ancestors.html.erb +0 -8
  140. data/app/views/relation/_descendants.html.erb +0 -15
  141. data/config/initializers/new_gbl_settings_defaults_3_3.yml +0 -10
  142. data/schema/format-values.md +0 -50
  143. data/schema/geoblacklight-schema-deprecated.md +0 -39
  144. data/schema/geoblacklight-schema.md +0 -323
  145. data/schema/geometry-type-values.md +0 -11
  146. data/schema/references.md +0 -23
  147. data/schema/schema-commentary.md +0 -198
  148. data/schema/subjects.md +0 -41
  149. data/schema/type-values.md +0 -10
  150. data/spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json +0 -30
  151. data/spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json +0 -17
  152. data/spec/fixtures/solr_documents/metadata_no_solr_geom.json +0 -23
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Geoblacklight::GeojsonDownload do
5
- let(:document) { SolrDocument.new(layer_slug_s: 'test', solr_wfs_url: 'http://www.example.com/wfs', layer_id_s: 'stanford-test', solr_geom: 'ENVELOPE(-180, 180, 90, -90)') }
5
+ let(:document) { SolrDocument.new(Settings.FIELDS.ID => 'test', solr_wfs_url: 'http://www.example.com/wfs', Settings.FIELDS.WXS_IDENTIFIER => 'stanford-test', Settings.FIELDS.SPATIAL_EXTENT => 'ENVELOPE(-180, 180, 90, -90)') }
6
6
  let(:download) { described_class.new(document) }
7
7
  describe '#initialize' do
8
8
  it 'initializes as a GeojsonDownload object with specific options' do
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Geoblacklight::GeotiffDownload do
5
- let(:document) { SolrDocument.new(layer_slug_s: 'test', layer_id_s: 'stanford-test', solr_geom: 'ENVELOPE(-180, 180, 90, -90)') }
5
+ let(:document) { SolrDocument.new(Settings.FIELDS.ID => 'test', Settings.FIELDS.WXS_IDENTIFIER => 'stanford-test', Settings.FIELDS.SPATIAL_EXTENT => 'ENVELOPE(-180, 180, 90, -90)') }
6
6
  let(:download) { described_class.new(document) }
7
7
  describe '#initialize' do
8
8
  it 'initializes as a GeotiffDownload object with specific options' do
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
  describe Geoblacklight::HglDownload do
5
5
  subject(:download) { described_class.new(document, options) }
6
6
 
7
- let(:document) { SolrDocument.new(layer_slug_s: 'test', layer_id_s: 'cite:harvard-test') }
7
+ let(:document) { SolrDocument.new(Settings.FIELDS.ID => 'test', Settings.FIELDS.WXS_IDENTIFIER => 'cite:harvard-test') }
8
8
  let(:options) { 'foo@example.com' }
9
9
 
10
10
  describe '#initialize' do
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Geoblacklight::KmzDownload do
5
- let(:document) { SolrDocument.new(Settings.FIELDS.UNIQUE_KEY => 'test', solr_wfs_url: 'http://www.example.com/wfs', Settings.FIELDS.WXS_IDENTIFIER => 'stanford-test', Settings.FIELDS.GEOMETRY => 'ENVELOPE(-180, 180, 90, -90)') }
5
+ let(:document) { SolrDocument.new(Settings.FIELDS.ID => 'test', solr_wfs_url: 'http://www.example.com/wfs', Settings.FIELDS.WXS_IDENTIFIER => 'stanford-test', Settings.FIELDS.SPATIAL_EXTENT => 'ENVELOPE(-180, 180, 90, -90)') }
6
6
  let(:download) { described_class.new(document) }
7
7
  describe '#initialize' do
8
8
  it 'initializes as a KmzDownload object with specific options' do
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Geoblacklight::ShapefileDownload do
5
- let(:document) { SolrDocument.new(layer_slug_s: 'test', solr_wfs_url: 'http://www.example.com/wfs', layer_id_s: 'stanford-test', solr_geom: 'ENVELOPE(-180, 180, 90, -90)') }
5
+ let(:document) { SolrDocument.new(Settings.FIELDS.ID => 'test', solr_wfs_url: 'http://www.example.com/wfs', Settings.FIELDS.WXS_IDENTIFIER => 'stanford-test', Settings.FIELDS.SPATIAL_EXTENT => 'ENVELOPE(-180, 180, 90, -90)') }
6
6
  let(:download) { described_class.new(document) }
7
7
  describe '#initialize' do
8
8
  it 'initializes as a ShapefileDownload object with specific options' do
@@ -7,7 +7,7 @@ describe Geoblacklight::Download do
7
7
  let(:faraday_connection) { instance_double(Faraday::Connection) }
8
8
  let(:faraday_response) { instance_double(Faraday::Response) }
9
9
  let(:references_field) { Settings.FIELDS.REFERENCES }
10
- let(:document) { SolrDocument.new("#{Settings.FIELDS.UNIQUE_KEY}": 'test', references_field => { 'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms' }.to_json) }
10
+ let(:document) { SolrDocument.new("#{Settings.FIELDS.ID}": 'test', references_field => { 'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms' }.to_json) }
11
11
  let(:options) { { type: 'shapefile', extension: 'zip', service_type: 'wms', content_type: 'application/zip' } }
12
12
 
13
13
  describe '#initialize' do
@@ -5,6 +5,7 @@ describe Geoblacklight::Geometry do
5
5
  let(:wkt_geom) { 'MULTIPOLYGON(((-180 81.66, -180 -12.93, -168.35 -12.93, -168.35 81.66, -180 81.66)), ((180 81.66, 25 81.66, 25 -12.93, 180 -12.93, 180 81.66)))' }
6
6
  let(:envelope_geom) { 'ENVELOPE(25, -168.35, 81.66, -12.93)' }
7
7
  let(:invalid_geom) { 'INVALID' }
8
+ let(:non_polygon_geom) { 'ENVELOPE(130, 130, 33, 33)' }
8
9
 
9
10
  describe '#geojson' do
10
11
  context 'with standard WKT geometry' do
@@ -20,8 +21,18 @@ describe Geoblacklight::Geometry do
20
21
  end
21
22
 
22
23
  context 'with an invalid geometry' do
23
- it 'returns an empty string' do
24
- expect(described_class.new(invalid_geom).geojson).to eq ''
24
+ it 'returns a default GeoJSON extent' do
25
+ expect(described_class.new(invalid_geom).geojson).to include('coordinates', '-180.0,90.0')
26
+ end
27
+ end
28
+
29
+ context 'with a non-polygon geometry' do
30
+ before do
31
+ allow(RGeo::GeoJSON).to receive(:encode).and_raise(RGeo::Error::InvalidGeometry)
32
+ end
33
+
34
+ it 'returns a default GeoJSON extent' do
35
+ expect(described_class.new(non_polygon_geom).geojson).to include('coordinates', '-180.0,90.0')
25
36
  end
26
37
  end
27
38
  end
@@ -40,8 +51,8 @@ describe Geoblacklight::Geometry do
40
51
  end
41
52
 
42
53
  context 'with an invalid geometry' do
43
- it 'returns an empty string' do
44
- expect(described_class.new(invalid_geom).bounding_box).to eq ''
54
+ it 'returns a default GeoJSON extent' do
55
+ expect(described_class.new(invalid_geom).bounding_box).to include('coordinates', '-180.0,90.0')
45
56
  end
46
57
  end
47
58
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  describe Geoblacklight::References do
5
5
  let(:references_field) { Settings.FIELDS.REFERENCES }
6
- let(:file_format_field) { Settings.FIELDS.FILE_FORMAT }
6
+ let(:file_format_field) { Settings.FIELDS.FORMAT }
7
7
  let(:typical_ogp_shapefile) do
8
8
  described_class.new(
9
9
  SolrDocument.new(
@@ -135,7 +135,7 @@ describe Geoblacklight::References do
135
135
  let(:settings_klass) { class_double('Settings').as_stubbed_const }
136
136
  before do
137
137
  allow(settings_klass).to receive(:METADATA_SHOWN).and_return %w[iso19139 mods]
138
- allow(settings_klass).to receive(:FIELDS).and_return OpenStruct.new(FILE_FORMAT: 'dc_format_s')
138
+ allow(settings_klass).to receive(:FIELDS).and_return OpenStruct.new(FORMAT: 'dc_format_s')
139
139
  end
140
140
  it 'is ordered by the configuration' do
141
141
  expect(complex_shapefile.shown_metadata_refs.first.type.to_s).to eq 'iso19139'
@@ -3,12 +3,12 @@ require 'spec_helper'
3
3
 
4
4
  describe Geoblacklight::Relation::Ancestors do
5
5
  let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
6
- let(:ancestors) { described_class.new('nyu_2451_34502', repository) }
7
- let(:empty_ancestors) { described_class.new('harvard-g7064-s2-1834-k3', repository) }
6
+ let(:ancestors) { described_class.new('nyu_2451_34502', Settings.FIELDS.SOURCE, repository) }
7
+ let(:empty_ancestors) { described_class.new('harvard-g7064-s2-1834-k3', Settings.FIELDS.SOURCE, repository) }
8
8
 
9
9
  describe '#create_search_params' do
10
10
  it 'assembles the correct search params for finding ancestor documents' do
11
- expect(ancestors.create_search_params).to eq(fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=#{Settings.FIELDS.UNIQUE_KEY}}#{Settings.FIELDS.UNIQUE_KEY}:nyu_2451_34502"], fl: [Settings.FIELDS.TITLE.to_s, Settings.FIELDS.UNIQUE_KEY, Settings.FIELDS.GEOM_TYPE])
11
+ expect(ancestors.create_search_params).to eq(fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=#{Settings.FIELDS.ID}}#{Settings.FIELDS.ID}:nyu_2451_34502"], fl: [Settings.FIELDS.TITLE.to_s, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE])
12
12
  end
13
13
  end
14
14
 
@@ -3,12 +3,12 @@ require 'spec_helper'
3
3
 
4
4
  describe Geoblacklight::Relation::Descendants do
5
5
  let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
6
- let(:descendants) { described_class.new('nyu_2451_34636', repository) }
7
- let(:empty_descendants) { described_class.new('harvard-g7064-s2-1834-k3', repository) }
6
+ let(:descendants) { described_class.new('nyu_2451_34636', Settings.FIELDS.SOURCE, repository) }
7
+ let(:empty_descendants) { described_class.new('harvard-g7064-s2-1834-k3', Settings.FIELDS.SOURCE, repository) }
8
8
 
9
9
  describe '#create_search_params' do
10
10
  it 'assembles the correct search params for finding descendant documents' do
11
- expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, Settings.FIELDS.UNIQUE_KEY, Settings.FIELDS.GEOM_TYPE])
11
+ expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE])
12
12
  end
13
13
  end
14
14
 
@@ -11,34 +11,49 @@ describe Geoblacklight::Relation::RelationResponse do
11
11
  end
12
12
  end
13
13
 
14
- describe '#ancestors' do
14
+ describe '#method_missing' do
15
15
  it 'returns a hash of ancestor documents' do
16
- expect(relation_resp.ancestors).to include('numFound')
17
- expect(relation_resp.ancestors).to include('docs')
16
+ expect(relation_resp.SOURCE_ANCESTORS).to include('numFound')
17
+ expect(relation_resp.SOURCE_ANCESTORS).to include('docs')
18
18
  end
19
- end
20
19
 
21
- describe '#descendants' do
22
20
  it 'returns a hash of descendant documents' do
23
- expect(relation_resp.ancestors).to include('numFound')
24
- expect(relation_resp.ancestors).to include('docs')
21
+ expect(relation_resp.SOURCE_DESCENDANTS).to include('numFound')
22
+ expect(relation_resp.SOURCE_DESCENDANTS).to include('docs')
23
+ end
24
+
25
+ it 'raises no method error' do
26
+ expect { relation_resp.FAIL }.to raise_error NoMethodError
25
27
  end
26
28
  end
27
29
 
28
- describe '#empty?' do
29
- it 'returns false if document has ancestors or descendants' do
30
- expect(relation_resp.empty?).to be false
30
+ describe '#respond_to_missing?' do
31
+ it 'returns true for configured relationships' do
32
+ Settings.RELATIONSHIPS_SHOWN.each_key do |key|
33
+ expect(relation_resp).to respond_to(key)
34
+ end
31
35
  end
32
- it 'returns true if document has neither ancestors nor descendants' do
33
- expect(empty_relation_resp.empty?).to be true
36
+
37
+ it 'returns false for non-configured options' do
38
+ expect(relation_resp).not_to respond_to('fail')
34
39
  end
40
+ end
35
41
 
36
- context 'with a layer slug containing a colon' do
37
- let(:empty_relation_resp) { described_class.new('uva-Norfolk:police_point', repository) }
42
+ describe '#query_type' do
43
+ it 'fails for a bad query type request' do
44
+ Settings.add_source!({
45
+ RELATIONSHIPS_SHOWN: {
46
+ BAD: {
47
+ field: 'dct_source_sm',
48
+ query_type: 'bad_query_type',
49
+ icon: 'pagelines-brands',
50
+ label: 'geoblacklight.relations.ancestor'
51
+ }
52
+ }
53
+ })
54
+ Settings.reload!
38
55
 
39
- it 'returns true if document has neither ancestors nor descendants' do
40
- expect(empty_relation_resp.empty?).to be true
41
- end
56
+ expect { relation_resp.BAD }.to raise_error(ArgumentError)
42
57
  end
43
58
  end
44
59
  end
@@ -3,8 +3,8 @@ require 'spec_helper'
3
3
 
4
4
  describe Geoblacklight::SolrDocument do
5
5
  let(:document) { SolrDocument.new(document_attributes) }
6
- let(:rights_field) { Settings.FIELDS.RIGHTS }
7
- let(:provenance_field) { Settings.FIELDS.PROVENANCE }
6
+ let(:rights_field) { Settings.FIELDS.ACCESS_RIGHTS }
7
+ let(:provider_field) { Settings.FIELDS.PROVIDER }
8
8
  let(:references_field) { Settings.FIELDS.REFERENCES }
9
9
  describe '#available?' do
10
10
  let(:document_attributes) { {} }
@@ -80,7 +80,7 @@ describe Geoblacklight::SolrDocument do
80
80
  end
81
81
  describe '#same_institution?' do
82
82
  describe 'within the same institution' do
83
- let(:document_attributes) { { provenance_field => 'STANFORD' } }
83
+ let(:document_attributes) { { provider_field => 'STANFORD' } }
84
84
  it 'is true' do
85
85
  allow(Settings).to receive('Institution').and_return('Stanford')
86
86
  expect(document.same_institution?).to be_truthy
@@ -91,7 +91,7 @@ describe Geoblacklight::SolrDocument do
91
91
  end
92
92
  end
93
93
  describe 'within a different institution' do
94
- let(:document_attributes) { { provenance_field => 'MIT' } }
94
+ let(:document_attributes) { { provider_field => 'MIT' } }
95
95
  it 'is false' do
96
96
  allow(Settings).to receive('Institution').and_return('Stanford')
97
97
  expect(document.same_institution?).to be_falsey
data/spec/spec_helper.rb CHANGED
@@ -79,4 +79,6 @@ RSpec.configure do |config|
79
79
  end
80
80
 
81
81
  config.include Devise::Test::ControllerHelpers, type: :controller
82
+ config.include ViewComponent::TestHelpers, type: :component
83
+ config.include ViewComponentCapybaraTestHelpers, type: :component
82
84
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ViewComponentCapybaraTestHelpers
4
+ # Work around for https://github.com/teamcapybara/capybara/issues/2466
5
+ def render_inline_to_capybara_node(component)
6
+ Capybara::Node::Simple.new(render_inline(component).to_s)
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 4.0.0.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-03-08 00:00:00.000000000 Z
14
+ date: 2021-10-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -39,14 +39,14 @@ dependencies:
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '7.0'
42
+ version: '7.8'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '7.0'
49
+ version: '7.8'
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: config
52
52
  requirement: !ruby/object:Gem::Requirement
@@ -416,6 +416,7 @@ files:
416
416
  - app/assets/images/blacklight/maryland.svg
417
417
  - app/assets/images/blacklight/massgis.svg
418
418
  - app/assets/images/blacklight/metadata.svg
419
+ - app/assets/images/blacklight/michigan-state-university.svg
419
420
  - app/assets/images/blacklight/michigan-state.svg
420
421
  - app/assets/images/blacklight/michigan.svg
421
422
  - app/assets/images/blacklight/minnesota.svg
@@ -429,11 +430,13 @@ files:
429
430
  - app/assets/images/blacklight/pagelines-brands.svg
430
431
  - app/assets/images/blacklight/paper-map.svg
431
432
  - app/assets/images/blacklight/penn-state.svg
433
+ - app/assets/images/blacklight/pennsylvania-state-university.svg
432
434
  - app/assets/images/blacklight/point.svg
433
435
  - app/assets/images/blacklight/polygon.svg
434
436
  - app/assets/images/blacklight/polyline.svg
435
437
  - app/assets/images/blacklight/princeton.svg
436
438
  - app/assets/images/blacklight/public.svg
439
+ - app/assets/images/blacklight/purdue-university.svg
437
440
  - app/assets/images/blacklight/purdue.svg
438
441
  - app/assets/images/blacklight/raster.svg
439
442
  - app/assets/images/blacklight/restricted.svg
@@ -442,8 +445,17 @@ files:
442
445
  - app/assets/images/blacklight/table.svg
443
446
  - app/assets/images/blacklight/tags.svg
444
447
  - app/assets/images/blacklight/texas.svg
448
+ - app/assets/images/blacklight/the-ohio-state-university.svg
445
449
  - app/assets/images/blacklight/tufts.svg
446
450
  - app/assets/images/blacklight/ucla.svg
451
+ - app/assets/images/blacklight/university-of-chicago.svg
452
+ - app/assets/images/blacklight/university-of-illinois-urbana-champaign.svg
453
+ - app/assets/images/blacklight/university-of-iowa.svg
454
+ - app/assets/images/blacklight/university-of-maryland.svg
455
+ - app/assets/images/blacklight/university-of-michigan.svg
456
+ - app/assets/images/blacklight/university-of-minnesota.svg
457
+ - app/assets/images/blacklight/university-of-nebraska-lincoln.svg
458
+ - app/assets/images/blacklight/university-of-wisconsin-madison.svg
447
459
  - app/assets/images/blacklight/uva.svg
448
460
  - app/assets/images/blacklight/web_services.svg
449
461
  - app/assets/images/blacklight/wisconsin.svg
@@ -507,12 +519,15 @@ files:
507
519
  - app/assets/stylesheets/geoblacklight/modules/sidebar.scss
508
520
  - app/assets/stylesheets/geoblacklight/modules/toolbar.scss
509
521
  - app/assets/stylesheets/geoblacklight/modules/web_services.scss
522
+ - app/components/geoblacklight/homepage_feature_facet_component.html.erb
523
+ - app/components/geoblacklight/homepage_feature_facet_component.rb
510
524
  - app/controllers/download_controller.rb
511
525
  - app/controllers/relation_controller.rb
512
526
  - app/controllers/wms_controller.rb
513
527
  - app/helpers/arcgis_helper.rb
514
528
  - app/helpers/blacklight_helper.rb
515
529
  - app/helpers/carto_helper.rb
530
+ - app/helpers/geoblacklight/geoblacklight_helper_behavior.rb
516
531
  - app/helpers/geoblacklight_helper.rb
517
532
  - app/models/concerns/geoblacklight/solr_document.rb
518
533
  - app/models/concerns/geoblacklight/solr_document/arcgis.rb
@@ -526,15 +541,12 @@ files:
526
541
  - app/views/catalog/_carto.html.erb
527
542
  - app/views/catalog/_citation.html.erb
528
543
  - app/views/catalog/_data_dictionary.html.erb
529
- - app/views/catalog/_document_action.html.erb
530
544
  - app/views/catalog/_document_split.html.erb
531
545
  - app/views/catalog/_download_generated_link.html.erb
532
546
  - app/views/catalog/_download_link.html.erb
533
547
  - app/views/catalog/_downloads_generated.html.erb
534
548
  - app/views/catalog/_downloads_primary.html.erb
535
549
  - app/views/catalog/_downloads_secondary.html.erb
536
- - app/views/catalog/_facet_tag_item.html.erb
537
- - app/views/catalog/_facet_tag_layout.html.erb
538
550
  - app/views/catalog/_header_icons.html.erb
539
551
  - app/views/catalog/_home_text.html.erb
540
552
  - app/views/catalog/_icon_facet.html.erb
@@ -559,14 +571,13 @@ files:
559
571
  - app/views/catalog/metadata/_missing.html.erb
560
572
  - app/views/catalog/web_services.html.erb
561
573
  - app/views/download/hgl.html.erb
562
- - app/views/relation/_ancestors.html.erb
563
- - app/views/relation/_descendants.html.erb
574
+ - app/views/relation/_relations.html.erb
564
575
  - app/views/relation/index.html.erb
565
576
  - app/views/relation/index.json.jbuilder
566
577
  - app/views/shared/_header_navbar.html.erb
567
578
  - babel.config.json
568
579
  - bin/coverage.rb
569
- - config/initializers/new_gbl_settings_defaults_3_3.yml
580
+ - config/initializers/new_gbl_settings_defaults_3_4.yml
570
581
  - config/initializers/rails_config.rb
571
582
  - config/locales/geoblacklight.en.yml
572
583
  - geoblacklight.gemspec
@@ -581,6 +592,7 @@ files:
581
592
  - lib/generators/geoblacklight/templates/assets/geoblacklight.js
582
593
  - lib/generators/geoblacklight/templates/catalog_controller.rb
583
594
  - lib/generators/geoblacklight/templates/package.json
595
+ - lib/generators/geoblacklight/templates/settings.gbl_v1.yml
584
596
  - lib/generators/geoblacklight/templates/settings.yml
585
597
  - lib/generators/geoblacklight/templates/webpacker.yml
586
598
  - lib/generators/geoblacklight/webpacker_generator.rb
@@ -596,7 +608,6 @@ files:
596
608
  - lib/geoblacklight/download/shapefile_download.rb
597
609
  - lib/geoblacklight/engine.rb
598
610
  - lib/geoblacklight/exceptions.rb
599
- - lib/geoblacklight/geoblacklight_helper_behavior.rb
600
611
  - lib/geoblacklight/geometry.rb
601
612
  - lib/geoblacklight/item_viewer.rb
602
613
  - lib/geoblacklight/metadata.rb
@@ -623,15 +634,8 @@ files:
623
634
  - lib/geoblacklight/wms_layer/feature_info_response.rb
624
635
  - lib/tasks/geoblacklight.rake
625
636
  - package.json
626
- - schema/format-values.md
627
- - schema/geoblacklight-schema-deprecated.md
628
- - schema/geoblacklight-schema.json
629
- - schema/geoblacklight-schema.md
630
- - schema/geometry-type-values.md
631
- - schema/references.md
632
- - schema/schema-commentary.md
633
- - schema/subjects.md
634
- - schema/type-values.md
637
+ - schema/geoblacklight-schema-1.0.json
638
+ - schema/geoblacklight-schema-aardvark.json
635
639
  - setupJest.js
636
640
  - solr/conf/_rest_managed.json
637
641
  - solr/conf/admin-extra.html
@@ -650,6 +654,7 @@ files:
650
654
  - solr/conf/xslt/example_atom.xsl
651
655
  - solr/conf/xslt/example_rss.xsl
652
656
  - solr/conf/xslt/luke.xsl
657
+ - spec/components/geoblacklight/homepage_feature_facet_component_spec.rb
653
658
  - spec/config/initializers/rails_config_spec.rb
654
659
  - spec/controllers/catalog_controller_spec.rb
655
660
  - spec/controllers/download_controller_spec.rb
@@ -697,6 +702,7 @@ files:
697
702
  - spec/fixtures/solr_documents/actual-point1.json
698
703
  - spec/fixtures/solr_documents/actual-polygon1.json
699
704
  - spec/fixtures/solr_documents/actual-raster1.json
705
+ - spec/fixtures/solr_documents/all-relationships.json
700
706
  - spec/fixtures/solr_documents/baruch_ancestor1.json
701
707
  - spec/fixtures/solr_documents/baruch_ancestor2.json
702
708
  - spec/fixtures/solr_documents/baruch_documentation_download.json
@@ -714,10 +720,10 @@ files:
714
720
  - spec/fixtures/solr_documents/index-map-polygon.json
715
721
  - spec/fixtures/solr_documents/index-map-stanford.json
716
722
  - spec/fixtures/solr_documents/index_map_point.json
717
- - spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json
718
- - spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json
719
- - spec/fixtures/solr_documents/metadata_no_solr_geom.json
723
+ - spec/fixtures/solr_documents/metadata_no_geom.json
724
+ - spec/fixtures/solr_documents/metadata_no_provider.json
720
725
  - spec/fixtures/solr_documents/multiple-downloads.json
726
+ - spec/fixtures/solr_documents/no_locn_geometry.json
721
727
  - spec/fixtures/solr_documents/no_spatial.json
722
728
  - spec/fixtures/solr_documents/oembed.json
723
729
  - spec/fixtures/solr_documents/princeton-child1.json
@@ -729,6 +735,7 @@ files:
729
735
  - spec/fixtures/solr_documents/public_iiif_princeton.json
730
736
  - spec/fixtures/solr_documents/public_polygon_mit.json
731
737
  - spec/fixtures/solr_documents/restricted-line.json
738
+ - spec/fixtures/solr_documents/the-related-record.json
732
739
  - spec/fixtures/solr_documents/tms.json
733
740
  - spec/fixtures/solr_documents/umn_metro_result1.json
734
741
  - spec/fixtures/solr_documents/umn_state_result1.json
@@ -736,6 +743,7 @@ files:
736
743
  - spec/fixtures/solr_documents/uva_slug_colon.json
737
744
  - spec/helpers/arcgis_helper_spec.rb
738
745
  - spec/helpers/carto_helper_spec.rb
746
+ - spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb
739
747
  - spec/helpers/geoblacklight_helper_spec.rb
740
748
  - spec/javascripts/geoblacklight_spec.js
741
749
  - spec/javascripts/metadata_download_button_spec.js
@@ -748,7 +756,6 @@ files:
748
756
  - spec/lib/geoblacklight/download/kmz_download_spec.rb
749
757
  - spec/lib/geoblacklight/download/shapefile_download_spec.rb
750
758
  - spec/lib/geoblacklight/download_spec.rb
751
- - spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb
752
759
  - spec/lib/geoblacklight/geometry_spec.rb
753
760
  - spec/lib/geoblacklight/item_viewer_spec.rb
754
761
  - spec/lib/geoblacklight/metadata/base_spec.rb
@@ -778,6 +785,7 @@ files:
778
785
  - spec/support/features.rb
779
786
  - spec/support/features/session_helpers.rb
780
787
  - spec/support/fixtures.rb
788
+ - spec/support/view_component_capybara_test_helpers.rb
781
789
  - spec/tasks/geoblacklight_spec.rb
782
790
  - spec/test_app_templates/Gemfile.extra
783
791
  - spec/test_app_templates/lib/generators/test_app_generator.rb
@@ -824,11 +832,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
824
832
  - !ruby/object:Gem::Version
825
833
  version: 2.5.2
826
834
  requirements: []
827
- rubygems_version: 3.2.3
835
+ rubygems_version: 3.2.15
828
836
  signing_key:
829
837
  specification_version: 4
830
838
  summary: A discovery platform for geospatial holdings
831
839
  test_files:
840
+ - spec/components/geoblacklight/homepage_feature_facet_component_spec.rb
832
841
  - spec/config/initializers/rails_config_spec.rb
833
842
  - spec/controllers/catalog_controller_spec.rb
834
843
  - spec/controllers/download_controller_spec.rb
@@ -876,6 +885,7 @@ test_files:
876
885
  - spec/fixtures/solr_documents/actual-point1.json
877
886
  - spec/fixtures/solr_documents/actual-polygon1.json
878
887
  - spec/fixtures/solr_documents/actual-raster1.json
888
+ - spec/fixtures/solr_documents/all-relationships.json
879
889
  - spec/fixtures/solr_documents/baruch_ancestor1.json
880
890
  - spec/fixtures/solr_documents/baruch_ancestor2.json
881
891
  - spec/fixtures/solr_documents/baruch_documentation_download.json
@@ -893,10 +903,10 @@ test_files:
893
903
  - spec/fixtures/solr_documents/index-map-polygon.json
894
904
  - spec/fixtures/solr_documents/index-map-stanford.json
895
905
  - spec/fixtures/solr_documents/index_map_point.json
896
- - spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json
897
- - spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json
898
- - spec/fixtures/solr_documents/metadata_no_solr_geom.json
906
+ - spec/fixtures/solr_documents/metadata_no_geom.json
907
+ - spec/fixtures/solr_documents/metadata_no_provider.json
899
908
  - spec/fixtures/solr_documents/multiple-downloads.json
909
+ - spec/fixtures/solr_documents/no_locn_geometry.json
900
910
  - spec/fixtures/solr_documents/no_spatial.json
901
911
  - spec/fixtures/solr_documents/oembed.json
902
912
  - spec/fixtures/solr_documents/princeton-child1.json
@@ -908,6 +918,7 @@ test_files:
908
918
  - spec/fixtures/solr_documents/public_iiif_princeton.json
909
919
  - spec/fixtures/solr_documents/public_polygon_mit.json
910
920
  - spec/fixtures/solr_documents/restricted-line.json
921
+ - spec/fixtures/solr_documents/the-related-record.json
911
922
  - spec/fixtures/solr_documents/tms.json
912
923
  - spec/fixtures/solr_documents/umn_metro_result1.json
913
924
  - spec/fixtures/solr_documents/umn_state_result1.json
@@ -915,6 +926,7 @@ test_files:
915
926
  - spec/fixtures/solr_documents/uva_slug_colon.json
916
927
  - spec/helpers/arcgis_helper_spec.rb
917
928
  - spec/helpers/carto_helper_spec.rb
929
+ - spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb
918
930
  - spec/helpers/geoblacklight_helper_spec.rb
919
931
  - spec/javascripts/geoblacklight_spec.js
920
932
  - spec/javascripts/metadata_download_button_spec.js
@@ -927,7 +939,6 @@ test_files:
927
939
  - spec/lib/geoblacklight/download/kmz_download_spec.rb
928
940
  - spec/lib/geoblacklight/download/shapefile_download_spec.rb
929
941
  - spec/lib/geoblacklight/download_spec.rb
930
- - spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb
931
942
  - spec/lib/geoblacklight/geometry_spec.rb
932
943
  - spec/lib/geoblacklight/item_viewer_spec.rb
933
944
  - spec/lib/geoblacklight/metadata/base_spec.rb
@@ -957,6 +968,7 @@ test_files:
957
968
  - spec/support/features.rb
958
969
  - spec/support/features/session_helpers.rb
959
970
  - spec/support/fixtures.rb
971
+ - spec/support/view_component_capybara_test_helpers.rb
960
972
  - spec/tasks/geoblacklight_spec.rb
961
973
  - spec/test_app_templates/Gemfile.extra
962
974
  - spec/test_app_templates/lib/generators/test_app_generator.rb
@@ -1,6 +0,0 @@
1
- <%= link_to document_action_path(document_action_config, (local_assigns.has_key?(:url_opts) ? url_opts : {}).merge(({id: document} if document) || {})),
2
- id: document_action_config.fetch(:id, "#{document_action_config.key}Link"),
3
- data: {}.merge(({blacklight_modal: "trigger"} if document_action_config.modal != false) || {}) do %>
4
- <%= geoblacklight_icon(document_action_config.key, aria_hidden: true) %>
5
- <%= document_action_label(document_action_config.key, document_action_config) %>
6
- <% end %>
@@ -1,3 +0,0 @@
1
- <% display_facet.items.each do |item| %>
2
- <%= link_to item.value, search_catalog_path({f: {"#{facet_field.field}" => [item.value]}}), class: 'home-facet-link' %><%= "," %>
3
- <% end %>
@@ -1,2 +0,0 @@
1
- <%= yield %>
2
- <%= link_to t('blacklight.search.facets.more_html'), facet_catalog_path(display_facet.name), class: 'more_facets_link' %>
@@ -1,8 +0,0 @@
1
- <% @relations.ancestors['docs'].each do |ancestor| %>
2
- <li class="list-group-item border-bottom-0">
3
- <%= link_to solr_document_path(ancestor[Settings.FIELDS.UNIQUE_KEY]) do %>
4
- <%= relations_icon(ancestor, 'pagelines-brands') %>
5
- <%= ancestor[Settings.FIELDS.TITLE] %>
6
- <% end %>
7
- </li>
8
- <% end %>
@@ -1,15 +0,0 @@
1
- <% @relations.descendants['docs'][0..2].each do |descendant| %>
2
- <li class="list-group-item border-bottom-0">
3
- <%= link_to solr_document_path(descendant[Settings.FIELDS.UNIQUE_KEY]) do %>
4
- <%= relations_icon(descendant, 'leaf') %>
5
- <%= descendant[Settings.FIELDS.TITLE] %>
6
- <% end %>
7
- </li>
8
- <% end %>
9
- <% unless (@relations.descendants['numFound'].to_i <= 3) %>
10
- <li class="list-group-item border-bottom-0">
11
- <%= link_to search_catalog_path({f: {"#{Settings.FIELDS.SOURCE}" => [@relations.link_id]}}) do %>
12
- <%= t('geoblacklight.relations.browse_all', count: @relations.descendants['numFound']) %>
13
- <% end %>
14
- </li>
15
- <% end %>
@@ -1,10 +0,0 @@
1
- # New GeoBlacklight v3.3 Solr field mappings
2
- FIELDS:
3
- :IDENTIFIER: 'dc_identifier_s'
4
- :LANGUAGE: 'dc_language_s'
5
- :LAYER_MODIFIED: 'layer_modified_dt'
6
- :OVERLAP_FIELD: 'solr_bboxtype'
7
- :SOURCE: 'dc_source_sm'
8
- :SUPPRESSED: 'suppressed_b'
9
- :TYPE: 'dc_type_s'
10
- :UNIQUE_KEY: 'layer_slug_s'