geoblacklight 4.0.0.pre.rc1 → 4.0.0.pre.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +14 -58
  3. data/.solr_wrapper +1 -0
  4. data/app/models/concerns/geoblacklight/bbox_filter_field.rb +27 -8
  5. data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +7 -2
  6. data/app/views/shared/_header_navbar.html.erb +13 -3
  7. data/config/locales/geoblacklight.en.yml +1 -0
  8. data/geoblacklight.gemspec +1 -1
  9. data/lib/generators/geoblacklight/templates/catalog_controller.rb +21 -10
  10. data/lib/generators/geoblacklight/templates/settings.yml +7 -2
  11. data/lib/geoblacklight/bounding_box.rb +1 -1
  12. data/lib/geoblacklight/version.rb +1 -1
  13. data/spec/config/initializers/rails_config_spec.rb +1 -1
  14. data/spec/controllers/wms_controller_spec.rb +1 -1
  15. data/spec/features/relations_spec.rb +11 -0
  16. data/spec/fixtures/solr_documents/b1g_wabash_child_15.json +62 -0
  17. data/spec/fixtures/solr_documents/b1g_wabash_child_16.json +64 -0
  18. data/spec/fixtures/solr_documents/b1g_wabash_child_17.json +62 -0
  19. data/spec/fixtures/solr_documents/b1g_wabash_child_18.json +62 -0
  20. data/spec/fixtures/solr_documents/b1g_wabash_parent.json +59 -0
  21. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +1 -1
  22. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +1 -1
  23. data/spec/lib/geoblacklight/references_spec.rb +5 -3
  24. data/spec/lib/geoblacklight/wms_layer_spec.rb +1 -1
  25. data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +36 -17
  26. data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +6 -6
  27. data/spec/spec_helper.rb +2 -2
  28. data/vendor/assets/javascripts/leaflet-src.js.erb +10354 -10290
  29. data/vendor/assets/javascripts/leaflet-src.js.map +1 -1
  30. metadata +20 -10
@@ -0,0 +1,62 @@
1
+ {
2
+ "id": "b835efbd-ca27-41af-bae2-c22210e58a89",
3
+ "gbl_mdVersion_s": "Aardvark",
4
+ "dct_title_s": "Wabash Topo (18): Indiana, 1929",
5
+ "dct_description_sm": [
6
+ "The maps represented here are on tiff files owned by EAS library. The topos were scanned in color and are up to 550MB each. These images can be viewed and performed in the using either ArcGIS Desktop or QGIS (user choice), referencing against a number of known mapsets like the 2005 Indiana Orthophoto setand USGS DRGs. The geographic coordinate system reference of the maps included are applied in GCS_WGS_1984."
7
+ ],
8
+ "dct_language_sm": [
9
+ "eng"
10
+ ],
11
+ "dct_creator_sm": [
12
+ "Brock & Weymouth Inc.",
13
+ "United States Engineer Office"
14
+ ],
15
+ "dct_publisher_sm": [
16
+ "Purdue University Libraries"
17
+ ],
18
+ "gbl_resourceClass_sm": [
19
+ "Maps"
20
+ ],
21
+ "dcat_keyword_sm": [
22
+ "Topography",
23
+ "Purdue Georeferenced Imagery"
24
+ ],
25
+ "dcat_theme_sm": [
26
+ "Imagery and Base Maps"
27
+ ],
28
+ "dct_issued_s": "2015-10-30",
29
+ "dct_temporal_sm": [
30
+ "1929"
31
+ ],
32
+ "gbl_dateRange_drsim": [
33
+ "[1929 TO 1929]"
34
+ ],
35
+ "gbl_indexYear_im": [
36
+ 1929
37
+ ],
38
+ "dct_spatial_sm": [
39
+ "Indiana"
40
+ ],
41
+ "locn_geometry": "ENVELOPE(-87.4407,-87.2936,39.7429,39.6653)",
42
+ "dcat_bbox": "ENVELOPE(-87.4407,-87.2936,39.7429,39.6653)",
43
+ "dcat_centroid": "39.7041,-87.36715000000001",
44
+ "pcdm_memberOf_sm": [
45
+ "09d-01"
46
+ ],
47
+ "gbl_resourceType_sm": [
48
+ "Topographic maps"
49
+ ],
50
+ "dct_format_s": "GeoTIFF",
51
+ "dct_references_s": "{\"http://schema.org/downloadUrl\":\"https://mapsweb.lib.purdue.edu/datasets/Wabash1929/wabash_topo_18.tif.zip\",\"urn:x-esri:serviceType:ArcGIS#ImageMapLayer\":\"https://mapsweb.lib.purdue.edu/arcgis/rest/services/Purdue/wabashtopo/ImageServer\",\"http://schema.org/url\":\"https://mapsweb.lib.purdue.edu/wabashriver/\"}",
52
+ "dct_identifier_sm": [
53
+ "b835efbd-ca27-41af-bae2-c22210e58a89"
54
+ ],
55
+ "schema_provider_s": "Purdue University",
56
+ "dct_isPartOf_sm": [
57
+ "88cc9b19-3294-4da9-9edd-775c81fb1c59"
58
+ ],
59
+ "dct_accessRights_s": "Public",
60
+ "gbl_suppressed_b": true,
61
+ "gbl_mdModified_dt": "2021-05-07T23:00:10Z"
62
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "id": "88cc9b19-3294-4da9-9edd-775c81fb1c59",
3
+ "gbl_mdVersion_s": "Aardvark",
4
+ "dct_title_s": "Wabash River Topographic Maps: Indiana, 1929",
5
+ "dct_description_sm": [
6
+ "See Related Records below to download individual GeoTIFFs. The maps represented here are tiff files owned by Purdue University's EAS library. The topos were scanned in color and are up to 550MB each. These images can be viewed and performed in the using either ArcGIS Desktop or QGIS (user choice), referencing against a number of known mapsets like the 2005 Indiana Orthophoto setand USGS DRGs. The geographic coordinate system reference of the maps included are applied in GCS_WGS_1984."
7
+ ],
8
+ "dct_language_sm": [
9
+ "eng"
10
+ ],
11
+ "dct_creator_sm": [
12
+ "Brock & Weymouth Inc.",
13
+ "United States Engineer Office"
14
+ ],
15
+ "dct_publisher_sm": [
16
+ "Purdue University Libraries"
17
+ ],
18
+ "gbl_resourceClass_sm": [
19
+ "Maps"
20
+ ],
21
+ "dcat_keyword_sm": [
22
+ "Topography",
23
+ "Purdue Georeferenced Imagery"
24
+ ],
25
+ "dcat_theme_sm": [
26
+ "Imagery and Base Maps"
27
+ ],
28
+ "dct_issued_s": "2015-10-17",
29
+ "dct_temporal_sm": [
30
+ "1929"
31
+ ],
32
+ "gbl_dateRange_drsim": [
33
+ "[1929 TO 1929]"
34
+ ],
35
+ "gbl_indexYear_im": [
36
+ 1929
37
+ ],
38
+ "dct_spatial_sm": [
39
+ "Indiana"
40
+ ],
41
+ "locn_geometry": "ENVELOPE(-87.5291,-86.2066,40.8009,39.3999)",
42
+ "dcat_bbox": "ENVELOPE(-87.5291,-86.2066,40.8009,39.3999)",
43
+ "dcat_centroid": "40.1004,-86.86785",
44
+ "pcdm_memberOf_sm": [
45
+ "09d-01"
46
+ ],
47
+ "gbl_resourceType_sm": [
48
+ "Topographic maps"
49
+ ],
50
+ "dct_format_s": "Image Service",
51
+ "dct_references_s": "{\"urn:x-esri:serviceType:ArcGIS#ImageMapLayer\":\"https://mapsweb.lib.purdue.edu/arcgis/rest/services/Purdue/wabashtopo/ImageServer\",\"http://schema.org/url\":\"https://mapsweb.lib.purdue.edu/wabashriver/\"}",
52
+ "dct_identifier_sm": [
53
+ "88cc9b19-3294-4da9-9edd-775c81fb1c59"
54
+ ],
55
+ "schema_provider_s": "Purdue University",
56
+ "dct_accessRights_s": "Public",
57
+ "gbl_suppressed_b": false,
58
+ "gbl_mdModified_dt": "2021-05-07T23:00:10Z"
59
+ }
@@ -6,7 +6,7 @@ describe Geoblacklight::MetadataTransformer::Fgdc do
6
6
  described_class.new(metadata)
7
7
  end
8
8
  let(:fgdc_html) { File.read(Rails.root.join('spec', 'fixtures', 'metadata', 'fgdc.html')) }
9
- let(:metadata) { instance_double('Geoblacklight::Metadata::Fgdc') }
9
+ let(:metadata) { instance_double(Geoblacklight::Metadata::Fgdc) }
10
10
 
11
11
  describe '#transform' do
12
12
  before do
@@ -6,7 +6,7 @@ describe Geoblacklight::MetadataTransformer::Iso19139 do
6
6
  described_class.new(metadata)
7
7
  end
8
8
  let(:iso_html) { File.read(Rails.root.join('spec', 'fixtures', 'metadata', 'iso.html')) }
9
- let(:metadata) { instance_double('Geoblacklight::Metadata::Iso19139') }
9
+ let(:metadata) { instance_double(Geoblacklight::Metadata::Iso19139) }
10
10
 
11
11
  describe '#transform' do
12
12
  before do
@@ -132,10 +132,12 @@ describe Geoblacklight::References do
132
132
  expect(complex_shapefile.shown_metadata_refs.last.type.to_s).to eq 'iso19139'
133
133
  end
134
134
  context 'with an overridden order for the formats' do
135
- let(:settings_klass) { class_double('Settings').as_stubbed_const }
136
135
  before do
137
- allow(settings_klass).to receive(:METADATA_SHOWN).and_return %w[iso19139 mods]
138
- allow(settings_klass).to receive(:FIELDS).and_return OpenStruct.new(FORMAT: 'dct_format_s')
136
+ stub_const('Settings', Module.new)
137
+ allow(Settings).to receive_messages(
138
+ METADATA_SHOWN: %w[iso19139 mods],
139
+ FIELDS: OpenStruct.new(FORMAT: 'dct_format_s')
140
+ )
139
141
  end
140
142
  it 'is ordered by the configuration' do
141
143
  expect(complex_shapefile.shown_metadata_refs.first.type.to_s).to eq 'iso19139'
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
  describe Geoblacklight::WmsLayer do
5
5
  let(:wms_layer) { described_class.new(params) }
6
6
  let(:rails_4_params) { { 'URL' => 'http://www.example.com/', 'X' => '277' } }
7
- let(:rails_5_params) { instance_double('ActionController::Parameters') }
7
+ let(:rails_5_params) { instance_double(ActionController::Parameters) }
8
8
 
9
9
  before do
10
10
  allow(rails_5_params).to receive(:to_h).and_return('URL' => 'http://www.example.com/', 'X' => '277')
@@ -3,64 +3,83 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe Geoblacklight::BboxFilterField do
6
- let(:search_state) { Blacklight::SearchState.new(params.with_indifferent_access, blacklight_config, controller) }
6
+ subject(:filter) { search_state.filter('bbox') }
7
7
 
8
+ let(:bbox_value) { '140.143709 -65.487905 160.793791 86.107541' }
9
+ let(:search_state) { Blacklight::SearchState.new(params.with_indifferent_access, blacklight_config, controller) }
8
10
  let(:params) { {} }
9
11
  let(:blacklight_config) do
10
12
  Blacklight::Configuration.new.configure do |config|
11
13
  config.add_facet_field 'bbox', filter_class: described_class
12
14
  end
13
15
  end
16
+ let(:facet_config) { blacklight_config.facet_fields['bbox'] }
14
17
  let(:controller) { double }
15
18
 
16
19
  describe '#add' do
17
20
  context 'with a ordinary parameter' do
18
21
  it 'adds the parameter to the facets' do
19
- filter = search_state.filter('bbox')
20
- new_state = filter.add('140.143709 -65.487905 160.793791 86.107541')
22
+ new_state = filter.add(bbox_value)
21
23
 
22
- expect(new_state.params).to include bbox: '140.143709 -65.487905 160.793791 86.107541'
24
+ expect(new_state.params).to include bbox: bbox_value
23
25
  end
24
26
  end
25
27
 
26
28
  context 'with a bounding box' do
27
29
  it 'adds the parameter to the bbox parameter' do
28
- filter = search_state.filter('bbox')
29
- new_state = filter.add(Geoblacklight::BoundingBox.from_rectangle('140.143709 -65.487905 160.793791 86.107541'))
30
+ new_state = filter.add(Geoblacklight::BoundingBox.from_rectangle(bbox_value))
30
31
 
31
- expect(new_state.params).to include bbox: '140.143709 -65.487905 160.793791 86.107541'
32
+ expect(new_state.params).to include bbox: bbox_value
32
33
  end
33
34
  end
34
35
  end
35
36
 
36
37
  context 'with some existing data' do
37
- let(:params) { { bbox: '140.143709 -65.487905 160.793791 86.107541' } }
38
+ let(:params) { { bbox: bbox_value } }
38
39
 
39
40
  describe '#add' do
41
+ let(:bbox_replacement) { '100.143709 -70.487905 100.793791 96.107541' }
40
42
  it 'replaces the existing range' do
41
- filter = search_state.filter('bbox')
42
- new_state = filter.add(Geoblacklight::BoundingBox.from_rectangle('100.143709 -70.487905 100.793791 96.107541'))
43
+ new_state = filter.add(Geoblacklight::BoundingBox.from_rectangle(bbox_replacement))
43
44
 
44
- expect(new_state.params).to include bbox: '100.143709 -70.487905 100.793791 96.107541'
45
+ expect(new_state.params).to include bbox: bbox_replacement
45
46
  end
46
47
  end
47
48
 
48
49
  describe '#remove' do
49
50
  it 'removes the existing bbox' do
50
- filter = search_state.filter('bbox')
51
- new_state = filter.remove(Geoblacklight::BoundingBox.from_rectangle('140.143709 -65.487905 160.793791 86.107541'))
51
+ new_state = filter.remove(Geoblacklight::BoundingBox.from_rectangle(bbox_value))
52
52
 
53
53
  expect(new_state.params[:bbox]).to be_nil
54
54
  end
55
55
  end
56
56
 
57
57
  describe '#values' do
58
- let(:params) { { bbox: '140.143709 -65.487905 160.793791 86.107541' } }
59
-
60
58
  it 'converts the parameters to a Geoblacklight::BoundingBox' do
61
- filter = search_state.filter('bbox')
59
+ expect(filter.values.first).to be_a(Geoblacklight::BoundingBox).and(have_attributes(to_param: bbox_value))
60
+ end
61
+ end
62
+
63
+ describe '#needs_normalization?' do
64
+ it 'returns false for the expected keyed representation of the bounding box' do
65
+ expect(filter.needs_normalization?(search_state.params)).to be false
66
+ end
67
+ end
68
+
69
+ context 'when array param represented by facebook as a Hash' do
70
+ let(:filter) { described_class.new(facet_config, search_state) }
71
+ let(:params) { { bbox: { '0' => bbox_value } } }
72
+
73
+ describe '#normalize' do
74
+ it 'converts the parameters to a list' do
75
+ expect(filter.normalize(search_state.params[:bbox])).to eql [bbox_value]
76
+ end
77
+ end
62
78
 
63
- expect(filter.values.first).to be_a(Geoblacklight::BoundingBox).and(have_attributes(to_param: '140.143709 -65.487905 160.793791 86.107541'))
79
+ describe '#needs_normalization?' do
80
+ it 'returns true for the hash-as-array keyed representation of the bounding box' do
81
+ expect(filter.needs_normalization?(search_state.params[:bbox])).to be true
82
+ end
64
83
  end
65
84
  end
66
85
  end
@@ -9,18 +9,18 @@ RSpec.describe Geoblacklight::BboxFilterQuery do
9
9
  let(:solr_params) { {} }
10
10
 
11
11
  # Search State
12
- let(:search_state) { Blacklight::SearchState.new(params.with_indifferent_access, {}) }
12
+ let(:search_state) { Blacklight::SearchState.new(params.with_indifferent_access, blacklight_config) }
13
13
 
14
14
  let(:params) do
15
15
  { bbox: '-180 -80 120 80' }
16
16
  end
17
17
 
18
- let(:facet_config) do
19
- Blacklight::Configuration::FacetField.new(
20
- key: 'bbox',
21
- filter_class: Geoblacklight::BboxFilterField
22
- )
18
+ let(:blacklight_config) do
19
+ Blacklight::Configuration.new.configure do |config|
20
+ config.add_facet_field 'bbox', filter_class: Geoblacklight::BboxFilterField
21
+ end
23
22
  end
23
+ let(:facet_config) { blacklight_config.facet_fields['bbox'] }
24
24
 
25
25
  # Filter
26
26
  let(:filter) { Geoblacklight::BboxFilterField.new(facet_config, search_state) }
data/spec/spec_helper.rb CHANGED
@@ -4,8 +4,8 @@ ENV['RAILS_ENV'] ||= 'test'
4
4
  require 'simplecov'
5
5
  SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
6
6
 
7
- if ENV['CIRCLE_ARTIFACTS']
8
- dir = File.join(ENV['CIRCLE_ARTIFACTS'], 'coverage')
7
+ if ENV.fetch('CIRCLE_ARTIFACTS', false)
8
+ dir = File.join(ENV.fetch('CIRCLE_ARTIFACTS'), 'coverage')
9
9
  SimpleCov.coverage_dir(dir)
10
10
  end
11
11