geoblacklight 2.4.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +142 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +24 -23
- data/.rubocop_todo.yml +398 -12
- data/README.md +3 -3
- data/Rakefile +13 -4
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +1 -1
- data/app/assets/javascripts/geoblacklight/geoblacklight.js +18 -1
- data/app/assets/javascripts/geoblacklight/modules/bookmarks.js +43 -0
- data/app/assets/javascripts/geoblacklight/modules/metadata_download_button.js +6 -1
- data/app/assets/javascripts/geoblacklight/modules/results.js +7 -8
- data/app/assets/javascripts/geoblacklight/modules/svg_tooltips.js +31 -0
- data/app/assets/javascripts/geoblacklight/modules/util.js +5 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri.js +3 -3
- data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +1 -1
- data/app/assets/javascripts/geoblacklight/viewers/index_map.js +1 -1
- data/app/assets/javascripts/geoblacklight/viewers/map.js +12 -2
- data/app/assets/javascripts/geoblacklight/viewers/tms.js +10 -0
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +3 -3
- data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +2 -0
- data/app/assets/stylesheets/geoblacklight/modules/_base.scss +33 -0
- data/app/assets/stylesheets/geoblacklight/{_blacklight_overrides.scss → modules/_blacklight_overrides.scss} +1 -1
- data/app/assets/stylesheets/geoblacklight/{_styles.scss → modules/_styles.scss} +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +37 -54
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/results.scss +17 -29
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +12 -42
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +17 -59
- data/app/controllers/download_controller.rb +12 -12
- data/app/controllers/relation_controller.rb +1 -0
- data/app/controllers/wms_controller.rb +1 -0
- data/app/helpers/arcgis_helper.rb +1 -0
- data/app/helpers/blacklight_helper.rb +1 -0
- data/app/helpers/carto_helper.rb +1 -0
- data/app/helpers/geoblacklight_helper.rb +37 -72
- data/app/models/concerns/geoblacklight/solr_document.rb +15 -19
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +2 -1
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -13
- data/app/models/concerns/geoblacklight/solr_document/citation.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +2 -1
- data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +6 -4
- data/app/presenters/geoblacklight/document_presenter.rb +2 -1
- data/app/views/catalog/_arcgis.html.erb +4 -0
- data/app/views/catalog/_carto.html.erb +4 -0
- data/app/views/catalog/_document_split.html.erb +1 -1
- data/app/views/catalog/_downloads_primary.html.erb +8 -1
- data/app/views/catalog/_header_icons.html.erb +3 -3
- data/app/views/catalog/_home_text.html.erb +3 -0
- data/app/views/catalog/_index_split_default.html.erb +21 -21
- data/app/views/catalog/_show_default_viewer_container.html.erb +1 -1
- data/app/views/download/hgl.html.erb +13 -11
- data/app/views/relation/_ancestors.html.erb +3 -6
- data/app/views/relation/_descendants.html.erb +4 -7
- data/app/views/relation/index.html.erb +20 -8
- data/app/views/relation/index.json.jbuilder +2 -1
- data/app/views/shared/_header_navbar.html.erb +0 -2
- data/babel.config.json +4 -0
- data/bin/coverage.rb +36 -0
- data/config/initializers/new_gbl_settings_defaults_3_3.yml +10 -0
- data/config/initializers/rails_config.rb +5 -0
- data/config/locales/geoblacklight.en.yml +7 -2
- data/geoblacklight.gemspec +7 -9
- data/jest.config.js +25 -0
- data/lib/generators/geoblacklight/assets_generator.rb +46 -0
- data/lib/generators/geoblacklight/install_generator.rb +4 -10
- data/lib/generators/geoblacklight/templates/assets/_blacklight.scss +1 -0
- data/lib/generators/geoblacklight/templates/assets/_customizations.scss +28 -0
- data/{app/assets/stylesheets/geoblacklight/application.scss → lib/generators/geoblacklight/templates/assets/_geoblacklight.scss} +0 -1
- data/lib/generators/geoblacklight/templates/assets/application.scss +7 -0
- data/lib/generators/geoblacklight/templates/{geoblacklight.js → assets/geoblacklight.js} +0 -0
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +5 -3
- data/lib/generators/geoblacklight/templates/settings.yml +20 -17
- data/lib/generators/geoblacklight/webpacker_generator.rb +1 -0
- data/lib/geoblacklight.rb +2 -2
- data/lib/geoblacklight/bounding_box.rb +2 -1
- data/lib/geoblacklight/catalog_helper_override.rb +1 -0
- data/lib/geoblacklight/constants.rb +2 -0
- data/lib/geoblacklight/download.rb +2 -1
- data/lib/geoblacklight/download/geojson_download.rb +1 -0
- data/lib/geoblacklight/download/geotiff_download.rb +1 -0
- data/lib/geoblacklight/download/hgl_download.rb +1 -0
- data/lib/geoblacklight/download/kmz_download.rb +3 -2
- data/lib/geoblacklight/download/shapefile_download.rb +1 -0
- data/lib/geoblacklight/engine.rb +2 -2
- data/lib/geoblacklight/exceptions.rb +1 -0
- data/lib/geoblacklight/geoblacklight_helper_behavior.rb +1 -0
- data/lib/geoblacklight/geometry.rb +70 -0
- data/lib/geoblacklight/item_viewer.rb +6 -1
- data/lib/geoblacklight/metadata.rb +1 -0
- data/lib/geoblacklight/metadata/base.rb +2 -7
- data/lib/geoblacklight/metadata/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata/html.rb +2 -2
- data/lib/geoblacklight/metadata/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata_transformer.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
- data/lib/geoblacklight/reference.rb +1 -0
- data/lib/geoblacklight/references.rb +7 -3
- data/lib/geoblacklight/relation/ancestors.rb +3 -2
- data/lib/geoblacklight/relation/descendants.rb +2 -1
- data/lib/geoblacklight/relation/relation_response.rb +2 -1
- data/lib/geoblacklight/routes.rb +1 -0
- data/lib/geoblacklight/routes/downloadable.rb +1 -0
- data/lib/geoblacklight/routes/exportable.rb +1 -0
- data/lib/geoblacklight/routes/wms.rb +1 -0
- data/lib/geoblacklight/version.rb +2 -1
- data/lib/geoblacklight/view_helper_override.rb +1 -0
- data/lib/geoblacklight/wms_layer.rb +2 -4
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +1 -0
- data/lib/tasks/geoblacklight.rake +38 -32
- data/package.json +17 -1
- data/setupJest.js +14 -0
- data/solr/conf/schema.xml +1 -3
- data/spec/config/initializers/rails_config_spec.rb +14 -0
- data/spec/controllers/catalog_controller_spec.rb +7 -6
- data/spec/controllers/download_controller_spec.rb +1 -0
- data/spec/controllers/relation_controller_spec.rb +1 -0
- data/spec/controllers/wms_controller_spec.rb +1 -0
- data/spec/factories/user.rb +1 -0
- data/spec/features/bookmarks_spec.rb +1 -0
- data/spec/features/configurable_basemap_spec.rb +1 -0
- data/spec/features/data_dictionary_download_spec.rb +1 -0
- data/spec/features/download_layer_spec.rb +2 -1
- data/spec/features/empty_search_spec.rb +1 -0
- data/spec/features/esri_viewer_spec.rb +1 -5
- data/spec/features/exports_spec.rb +4 -12
- data/spec/features/help_text_spec.rb +1 -0
- data/spec/features/home_page_spec.rb +6 -0
- data/spec/features/iiif_viewer_spec.rb +1 -0
- data/spec/features/index_map_spec.rb +1 -0
- data/spec/features/layer_inspection_spec.rb +1 -0
- data/spec/features/layer_opacity_spec.rb +1 -0
- data/spec/features/layer_preview_spec.rb +1 -0
- data/spec/features/layer_with_no_references_spec.rb +1 -0
- data/spec/features/linkified_attribute_table_spec.rb +1 -0
- data/spec/features/metadata_panel_spec.rb +1 -0
- data/spec/features/missing_metadata_spec.rb +1 -0
- data/spec/features/multiple_downloads_spec.rb +15 -0
- data/spec/features/oembed_spec.rb +1 -0
- data/spec/features/relations_spec.rb +10 -29
- data/spec/features/saved_searches_spec.rb +1 -0
- data/spec/features/search_bar_spec.rb +1 -0
- data/spec/features/search_results_map_spec.rb +1 -6
- data/spec/features/search_results_overlap_ratio_spec.rb +6 -5
- data/spec/features/search_spec.rb +1 -0
- data/spec/features/show_page_metadata_spec.rb +1 -0
- data/spec/features/sms_spec.rb +1 -0
- data/spec/features/split_view.html.erb_spec.rb +3 -2
- data/spec/features/suppressed_records_spec.rb +1 -0
- data/spec/features/tms_spec.rb +10 -0
- data/spec/features/web_services_modal_spec.rb +1 -0
- data/spec/fixtures/solr_documents/multiple-downloads.json +30 -0
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
- data/spec/fixtures/solr_documents/tms.json +29 -0
- data/spec/helpers/arcgis_helper_spec.rb +1 -0
- data/spec/helpers/carto_helper_spec.rb +1 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +73 -14
- data/spec/javascripts/geoblacklight_spec.js +0 -6
- data/spec/javascripts/metadata_download_button_spec.js +5 -3
- data/spec/javascripts/util_spec.js +2 -4
- data/spec/lib/geoblacklight/bounding_box_spec.rb +1 -0
- data/spec/lib/geoblacklight/document_presenter_spec.rb +3 -2
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +3 -2
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download_spec.rb +3 -2
- data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
- data/spec/lib/geoblacklight/geometry_spec.rb +48 -0
- data/spec/lib/geoblacklight/item_viewer_spec.rb +13 -0
- data/spec/lib/geoblacklight/metadata/base_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata/html_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +4 -3
- data/spec/lib/geoblacklight/reference_spec.rb +1 -0
- data/spec/lib/geoblacklight/references_spec.rb +3 -4
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +2 -1
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +2 -1
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +1 -0
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +5 -4
- data/spec/lib/geoblacklight/wms_layer_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +1 -20
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +15 -2
- data/spec/routing/catalog_routing_spec.rb +1 -0
- data/spec/spec_helper.rb +12 -9
- data/spec/support/backport_test_helpers.rb +1 -0
- data/spec/support/features.rb +1 -0
- data/spec/support/features/session_helpers.rb +1 -0
- data/spec/support/fixtures.rb +1 -0
- data/spec/tasks/geoblacklight_spec.rb +4 -3
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -8
- data/spec/views/catalog/_document_split.html.erb_spec.rb +2 -1
- data/spec/views/catalog/_index_split.html.erb_spec.rb +2 -1
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +3 -5
- data/template.rb +4 -2
- metadata +74 -78
- data/.circleci/config.yml +0 -164
- data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +0 -36
- data/app/assets/stylesheets/geoblacklight/modules/relations.scss +0 -15
- data/app/views/catalog/_exports.html.erb +0 -3
- data/app/views/catalog/_show_tools.html.erb +0 -25
- data/lib/generators/geoblacklight/templates/geoblacklight.scss +0 -4
- data/spec/javascripts/spec_helper.js +0 -32
- data/spec/lib/geoblacklight/controller_override_spec.rb +0 -1
- data/spec/teaspoon_env.rb +0 -213
- data/vendor/assets/javascripts/readmore.js +0 -0
- data/vendor/assets/javascripts/readmore.min.js +0 -0
data/spec/features/sms_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
feature 'Index view', js: true do
|
@@ -9,7 +10,7 @@ feature 'Index view', js: true do
|
|
9
10
|
scenario 'should have documents and map on page' do
|
10
11
|
visit search_catalog_path(f: { Settings.FIELDS.PROVENANCE => ['Stanford'] })
|
11
12
|
expect(page).to have_css('#documents')
|
12
|
-
expect(page).to have_css('.document', count:
|
13
|
+
expect(page).to have_css('.document', count: 6)
|
13
14
|
expect(page).to have_css('#map')
|
14
15
|
end
|
15
16
|
|
@@ -51,7 +52,7 @@ feature 'Index view', js: true do
|
|
51
52
|
end
|
52
53
|
|
53
54
|
scenario 'click on a record area to expand collapse' do
|
54
|
-
within('
|
55
|
+
within('article', match: :first) do
|
55
56
|
expect(page).not_to have_css('.collapse')
|
56
57
|
find('button').click
|
57
58
|
expect(page).to have_css('.collapse', visible: true)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
feature 'tms layer' do
|
5
|
+
scenario 'displays tms layer', js: true do
|
6
|
+
visit solr_document_path('6f47b103-9955-4bbe-a364-387039623106')
|
7
|
+
expect(page).to have_css '.leaflet-control-zoom', visible: true
|
8
|
+
expect(page).to have_css "img[src*='earthquake.usgs.gov']"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
{
|
2
|
+
"geoblacklight_version": "1.0",
|
3
|
+
"dc_identifier_s": "https://cugir.library.cornell.edu/catalog/cugir-007950",
|
4
|
+
"dc_title_s": "Test record with additional download formats",
|
5
|
+
"dc_description_s": "This is a test record containing new-style references as nested child documents. In addition to the origianl shapefile download, the references section contains additional PDF and KMZ downloads.",
|
6
|
+
"dc_rights_s": "Public",
|
7
|
+
"dct_provenance_s": "Cornell",
|
8
|
+
"dct_references_s": "{\"http:\/\/schema.org\/downloadUrl\":[{\"url\":\"https:\/\/cugir-data.s3.amazonaws.com\/00\/79\/50\/cugir-007950.zip\",\"label\":\"Shapefile\"},{\"url\":\"https:\/\/cugir-data.s3.amazonaws.com\/00\/79\/50\/agBROO.pdf\",\"label\":\"PDF\"},{\"url\":\"https:\/\/cugir-data.s3.amazonaws.com\/00\/79\/50\/agBROO2011.kmz\",\"label\":\"KMZ\"}],\"http:\/\/www.opengis.net\/cat\/csw\/csdgm\":\"https:\/\/cugir-data.s3.amazonaws.com\/00\/79\/50\/fgdc.xml\",\"http:\/\/www.w3.org\/1999\/xhtml\":\"https:\/\/cugir-data.s3.amazonaws.com\/00\/79\/50\/fgdc.html\",\"http:\/\/www.opengis.net\/def\/serviceType\/ogc\/wfs\":\"https:\/\/cugir.library.cornell.edu\/geoserver\/cugir\/wfs\",\"http:\/\/www.opengis.net\/def\/serviceType\/ogc\/wms\":\"https:\/\/cugir.library.cornell.edu\/geoserver\/cugir\/wms\"}",
|
9
|
+
"layer_id_s": "cugir007950",
|
10
|
+
"layer_slug_s": "cugir-007950",
|
11
|
+
"dc_type_s": "Dataset",
|
12
|
+
"dc_format_s": "Shapefile",
|
13
|
+
"layer_geom_type_s": "Polygon",
|
14
|
+
"layer_modified_dt": "2019-05-24T00:00:00Z",
|
15
|
+
"dc_creator_sm": [
|
16
|
+
"Cornell Institute for Resource Information Sciences (Cornell IRIS)",
|
17
|
+
"NYS Department of Agriculture and Markets"
|
18
|
+
],
|
19
|
+
"dc_subject_sm": [
|
20
|
+
"New York State Agricultural District boundaries",
|
21
|
+
"Agriculture and Markets",
|
22
|
+
"Agricultural Districts Mapping Program"
|
23
|
+
],
|
24
|
+
"dct_spatial_sm": ["Broome County NY"],
|
25
|
+
"dct_issued_s": "2011-02-28",
|
26
|
+
"dct_temporal_sm": ["2011"],
|
27
|
+
"dct_isPartOf_sm": ["Agricultural Districts (NYS Ag and Markets)"],
|
28
|
+
"solr_geom": "ENVELOPE(-76.12987, -75.42034, 42.414648, 41.997963)",
|
29
|
+
"solr_year_i": 2011
|
30
|
+
}
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"Rogers, Henry Darwin",
|
17
17
|
"Pownall, Thomas"
|
18
18
|
],
|
19
|
-
"dct_references_s": "{\"http://schema.org/url\":\"http://arks.princeton.edu/ark:/88435/02870w62c\",\"http://schema.org/thumbnailUrl\":\"https://
|
19
|
+
"dct_references_s": "{\"http://schema.org/url\":\"http://arks.princeton.edu/ark:/88435/02870w62c\",\"http://schema.org/thumbnailUrl\":\"https://iiif-cloud.princeton.edu/iiif/2/6c%2F52%2F12%2F6c5212e81bc845f59bb1cdc740a88bad%2Fintermediate_file/full/!200,150/0/default.jpg\",\"http://iiif.io/api/image\":\"https://iiif-cloud.princeton.edu/iiif/2/6c%2F52%2F12%2F6c5212e81bc845f59bb1cdc740a88bad%2Fintermediate_file/info.json\"}",
|
20
20
|
"dct_spatial_sm": [
|
21
21
|
"New York (State)",
|
22
22
|
"New Jersey",
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"dc_identifier_s": "6f47b103-9955-4bbe-a364-387039623106",
|
3
|
+
"dc_title_s": "Quaternary Fault and Fold Database of the United States",
|
4
|
+
"dc_description_s": "Quaternary Fault and Fold Database of the United States",
|
5
|
+
"dc_rights_s": "Public",
|
6
|
+
"dct_provenance_s": "Stanford",
|
7
|
+
"dct_references_s": "{\"http://schema.org/url\":\"https://www.usgs.gov/natural-hazards/earthquake-hazards/faults\",\"https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification\":\"https://earthquake.usgs.gov/basemap/tiles/faults/{z}/{x}/{y}.png\",\"http://schema.org/downloadUrl\":\"https://earthquake.usgs.gov/static/lfs/nshm/qfaults/Qfaults_GIS.zip\"}",
|
8
|
+
"layer_slug_s": "6f47b103-9955-4bbe-a364-387039623106",
|
9
|
+
"layer_geom_type_s": "Polyline",
|
10
|
+
"dc_format_s": "Shapefile",
|
11
|
+
"dc_language_s": "English",
|
12
|
+
"dc_type_s": "Dataset",
|
13
|
+
"dc_publisher_s": "Geological Survey (U.S.)",
|
14
|
+
"dc_subject_sm": [
|
15
|
+
"Earthquakes",
|
16
|
+
"Faults"
|
17
|
+
],
|
18
|
+
"dct_issued_s": "2020",
|
19
|
+
"dct_temporal_sm": [
|
20
|
+
"2020"
|
21
|
+
],
|
22
|
+
"dct_spatial_sm": [
|
23
|
+
"Earth (Planet)",
|
24
|
+
"North America"
|
25
|
+
],
|
26
|
+
"solr_geom": "ENVELOPE(-156.02, -70.80, 65.59, 18.93)",
|
27
|
+
"solr_year_i": 2020,
|
28
|
+
"geoblacklight_version": "1.0"
|
29
|
+
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe GeoblacklightHelper, type: :helper do
|
@@ -8,7 +9,7 @@ describe GeoblacklightHelper, type: :helper do
|
|
8
9
|
let(:subject_field) { Settings.FIELDS.SUBJECT }
|
9
10
|
it 'contains unique links' do
|
10
11
|
expect(self).to receive(:search_catalog_path).exactly(3).times.and_return("http://example.com/catalog?f[#{subject_field}][]=category")
|
11
|
-
html = Capybara.string(render_facet_links(subject_field, %w
|
12
|
+
html = Capybara.string(render_facet_links(subject_field, %w[Test Test Earth Science]))
|
12
13
|
expect(html).to have_css 'a', count: 3
|
13
14
|
expect(html).to have_css 'a', text: 'Test', count: 1
|
14
15
|
expect(html).to have_css 'a', text: 'Earth', count: 1
|
@@ -52,6 +53,17 @@ describe GeoblacklightHelper, type: :helper do
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
56
|
+
describe '#download_link_file' do
|
57
|
+
let(:label) { 'Test Link Text' }
|
58
|
+
let(:id) { 'test-id' }
|
59
|
+
let(:url) { 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip' }
|
60
|
+
|
61
|
+
it 'generates a link to download the original file' do
|
62
|
+
puts download_link_file(label, id, url)
|
63
|
+
expect(download_link_file(label, id, url)).to eq '<a contentUrl="http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip" class="btn btn-default download download-original" data-download="trigger" data-download-type="direct" data-download-id="test-id" href="http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip">Test Link Text</a>'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
55
67
|
describe '#download_link_direct' do
|
56
68
|
let(:text) { 'Test Link Text' }
|
57
69
|
let(:references_field) { Settings.FIELDS.REFERENCES }
|
@@ -185,7 +197,7 @@ describe GeoblacklightHelper, type: :helper do
|
|
185
197
|
context 'as a multivalued Array' do
|
186
198
|
let(:document_attributes) do
|
187
199
|
{
|
188
|
-
value: %w
|
200
|
+
value: %w[short description]
|
189
201
|
}
|
190
202
|
end
|
191
203
|
it 'uses both values' do
|
@@ -204,9 +216,9 @@ describe GeoblacklightHelper, type: :helper do
|
|
204
216
|
allow(helper).to receive(:application_name).and_return('GeoBlacklight')
|
205
217
|
end
|
206
218
|
|
207
|
-
describe '#
|
219
|
+
describe '#carto_link' do
|
208
220
|
it 'aliases CartoHelper#carto_link' do
|
209
|
-
expect(helper.
|
221
|
+
expect(helper.carto_link('http://demo.org/wfs/layer.json')).to eq(helper.carto_link('http://demo.org/wfs/layer.json'))
|
210
222
|
end
|
211
223
|
end
|
212
224
|
end
|
@@ -240,7 +252,7 @@ describe GeoblacklightHelper, type: :helper do
|
|
240
252
|
|
241
253
|
describe '#render_value_as_truncate_abstract' do
|
242
254
|
context 'with multiple values' do
|
243
|
-
let(:document) { SolrDocument.new(value: %w
|
255
|
+
let(:document) { SolrDocument.new(value: %w[short description]) }
|
244
256
|
it 'wraps in correct DIV class' do
|
245
257
|
expect(helper.render_value_as_truncate_abstract(document)).to eq '<div class="truncate-abstract">short description</div>'
|
246
258
|
end
|
@@ -328,15 +340,62 @@ describe GeoblacklightHelper, type: :helper do
|
|
328
340
|
end
|
329
341
|
|
330
342
|
describe '#relations_icon' do
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
343
|
+
context 'when configured to use the geometry type' do
|
344
|
+
before do
|
345
|
+
allow(Settings).to receive(:USE_GEOM_FOR_RELATIONS_ICON).and_return(true)
|
346
|
+
end
|
347
|
+
|
348
|
+
it 'renders a goemetry type as the icon' do
|
349
|
+
html = Capybara.string(helper.relations_icon({ Settings.FIELDS.GEOM_TYPE => 'polygon' }, 'leaf'))
|
350
|
+
expect(html.title.strip).to eq 'Polygon'
|
351
|
+
end
|
352
|
+
|
353
|
+
it 'has the svg_tooltip class so that the Bootstrap tooltip is applied' do
|
354
|
+
html = Capybara.string(helper.relations_icon({ Settings.FIELDS.GEOM_TYPE => 'polygon' }, 'leaf'))
|
355
|
+
expect(html).to have_css('.blacklight-icons.svg_tooltip')
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
context 'when not confiugred to use the geometry type' do
|
360
|
+
before do
|
361
|
+
allow(Settings).to receive(:USE_GEOM_FOR_RELATIONS_ICON).and_return(false)
|
362
|
+
end
|
363
|
+
|
364
|
+
it 'renders the provided icon' do
|
365
|
+
html = Capybara.string(helper.relations_icon({ Settings.FIELDS.GEOM_TYPE => 'polygon' }, 'leaf'))
|
366
|
+
expect(html.title.strip).to eq 'Leaf'
|
367
|
+
end
|
368
|
+
|
369
|
+
it 'does not have the svg_tooltip class' do
|
370
|
+
html = Capybara.string(helper.relations_icon({ Settings.FIELDS.GEOM_TYPE => 'polygon' }, 'leaf'))
|
371
|
+
expect(html).not_to have_css('.blacklight-icons.svg_tooltip')
|
372
|
+
end
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
describe '#results_js_map_selector' do
|
377
|
+
context 'viewing bookmarks' do
|
378
|
+
let(:controller_name) { 'bookmarks' }
|
379
|
+
|
380
|
+
it 'returns bookmarks data-map selector' do
|
381
|
+
expect(results_js_map_selector(controller_name)).to eq 'bookmarks'
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
context 'viewing catalog results' do
|
386
|
+
let(:controller_name) { 'catalog' }
|
387
|
+
|
388
|
+
it 'returns index data-map selector' do
|
389
|
+
expect(results_js_map_selector(controller_name)).to eq 'index'
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
context 'calling outside of intended scope' do
|
394
|
+
let(:controller_name) { 'outside' }
|
395
|
+
|
396
|
+
it 'returns default data-map value' do
|
397
|
+
expect(results_js_map_selector(controller_name)).to eq 'index'
|
398
|
+
end
|
340
399
|
end
|
341
400
|
end
|
342
401
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
//= require geoblacklight
|
2
|
-
|
3
1
|
describe('GeoBlacklight', function() {
|
4
2
|
describe('loads and makes available libraries', function() {
|
5
3
|
it('Leaflet is defined', function() {
|
@@ -9,9 +7,5 @@ describe('GeoBlacklight', function() {
|
|
9
7
|
it('History.js is defined', function() {
|
10
8
|
expect(History).toBeDefined();
|
11
9
|
});
|
12
|
-
|
13
|
-
it('MetadataDownloadButton is defined', function() {
|
14
|
-
expect(GeoBlacklight.MetadataDownloadButton).toBeDefined();
|
15
|
-
});
|
16
10
|
});
|
17
11
|
});
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
const MetadataDownloadButton = require('../../app/assets/javascripts/geoblacklight/modules/metadata_download_button');
|
2
2
|
|
3
3
|
describe('MetadataDownloadButton', function() {
|
4
4
|
describe('initialize', function() {
|
5
|
-
|
5
|
+
beforeEach(() => {
|
6
|
+
document.body.innerHTML = '<button id="foo" data-ref-endpoint="http://testdomain" data-ref-download="#bar">test element</button><a href="http://testdomain" id="bar">another test element</a>';
|
7
|
+
});
|
6
8
|
|
7
9
|
it('creates a new instance and sets the download button @href value', function() {
|
8
|
-
var button = new
|
10
|
+
var button = new MetadataDownloadButton('#foo');
|
9
11
|
expect(button.$el.attr('id')).toBe('foo');
|
10
12
|
expect(button.$download.attr('id')).toBe('bar');
|
11
13
|
expect(button.$download.attr('href')).toBe('http://testdomain');
|
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
'use strict';
|
1
|
+
const Util = require('../../app/assets/javascripts/geoblacklight/modules/util');
|
4
2
|
|
5
3
|
describe('GeoBlacklight.Util', function() {
|
6
4
|
describe('linkify', function() {
|
7
5
|
it('returns a linkified string', function() {
|
8
|
-
expect(
|
6
|
+
expect(Util.linkify('http://www.example.com'))
|
9
7
|
.toEqual("<a href='http://www.example.com'>http://www.example.com</a>");
|
10
8
|
});
|
11
9
|
});
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::DocumentPresenter do
|
4
5
|
# Please see https://github.com/projectblacklight/blacklight/blob/v6.15.0/spec/presenters/index_presenter_spec.rb#L4
|
6
|
+
subject { presenter }
|
5
7
|
let(:request_context) { double(document_index_view_type: 'list') }
|
6
8
|
let(:blacklight_config) do
|
7
9
|
Blacklight::Configuration.new.configure do |config|
|
@@ -12,7 +14,6 @@ describe Geoblacklight::DocumentPresenter do
|
|
12
14
|
end
|
13
15
|
end
|
14
16
|
let(:solr_fields) { Settings.FIELDS }
|
15
|
-
subject { presenter }
|
16
17
|
let(:presenter) do
|
17
18
|
described_class.new(document, request_context, blacklight_config)
|
18
19
|
end
|
@@ -23,7 +24,7 @@ describe Geoblacklight::DocumentPresenter do
|
|
23
24
|
layer_id_s: 'druid:abc123',
|
24
25
|
non_index_field: 'do not render',
|
25
26
|
period: 'Ends with period.',
|
26
|
-
multi_display: %w
|
27
|
+
multi_display: %w[blue blah]
|
27
28
|
)
|
28
29
|
end
|
29
30
|
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::KmzDownload do
|
4
|
-
let(:document) { SolrDocument.new(
|
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
6
|
let(:download) { described_class.new(document) }
|
6
7
|
describe '#initialize' do
|
7
8
|
it 'initializes as a KmzDownload object with specific options' do
|
@@ -9,7 +10,7 @@ describe Geoblacklight::KmzDownload do
|
|
9
10
|
options = download.instance_variable_get(:@options)
|
10
11
|
expect(options[:content_type]).to eq 'application/vnd.google-earth.kmz'
|
11
12
|
expect(options[:request_params][:layers]).to eq 'stanford-test'
|
12
|
-
expect(options[:request_params][:bbox]).to eq '-180, -90, 180, 90'
|
13
|
+
expect(options[:request_params][:bbox]).to eq '-180.0, -90.0, 180.0, 90.0'
|
13
14
|
end
|
14
15
|
it 'merges custom options' do
|
15
16
|
download = described_class.new(document, timeout: 33)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::Download do
|
@@ -6,7 +7,7 @@ describe Geoblacklight::Download do
|
|
6
7
|
let(:faraday_connection) { instance_double(Faraday::Connection) }
|
7
8
|
let(:faraday_response) { instance_double(Faraday::Response) }
|
8
9
|
let(:references_field) { Settings.FIELDS.REFERENCES }
|
9
|
-
let(:document) { SolrDocument.new(
|
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
11
|
let(:options) { { type: 'shapefile', extension: 'zip', service_type: 'wms', content_type: 'application/zip' } }
|
11
12
|
|
12
13
|
describe '#initialize' do
|
@@ -31,7 +32,7 @@ describe Geoblacklight::Download do
|
|
31
32
|
end
|
32
33
|
describe '#file_path' do
|
33
34
|
it 'returns the path with name and extension' do
|
34
|
-
expect(download.class.file_path).to eq
|
35
|
+
expect(download.class.file_path).to eq Rails.root.join('tmp', 'cache', 'downloads')
|
35
36
|
end
|
36
37
|
it 'is configurable' do
|
37
38
|
expect(Settings).to receive(:DOWNLOAD_PATH).and_return('configured/path')
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Geoblacklight::Geometry do
|
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
|
+
let(:envelope_geom) { 'ENVELOPE(25, -168.35, 81.66, -12.93)' }
|
7
|
+
let(:invalid_geom) { 'INVALID' }
|
8
|
+
|
9
|
+
describe '#geojson' do
|
10
|
+
context 'with standard WKT geometry' do
|
11
|
+
it 'returns geojson' do
|
12
|
+
expect(described_class.new(wkt_geom).geojson).to include('MultiPolygon', 'coordinates', '[[[[-180.0,81.66]')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with envelope syntax geometry' do
|
17
|
+
it 'returns geojson' do
|
18
|
+
expect(described_class.new(envelope_geom).geojson).to include('Polygon', 'coordinates', '[[[25.0,81.66]')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'with an invalid geometry' do
|
23
|
+
it 'returns an empty string' do
|
24
|
+
expect(described_class.new(invalid_geom).geojson).to eq ''
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#bounding_box' do
|
30
|
+
context 'with standard WKT geometry' do
|
31
|
+
it 'returns a bounding_box' do
|
32
|
+
expect(described_class.new(wkt_geom).bounding_box).to eq '-180.0, -12.93, 180.0, 81.66'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'with envelope syntax geometry' do
|
37
|
+
it 'returns a bounding_box' do
|
38
|
+
expect(described_class.new(envelope_geom).bounding_box).to eq '-168.35, -12.93, 25.0, 81.66'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'with an invalid geometry' do
|
43
|
+
it 'returns an empty string' do
|
44
|
+
expect(described_class.new(invalid_geom).bounding_box).to eq ''
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|