geoblacklight 6.0.0.pre.beta.1 → 6.0.0.pre.beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +14 -3
- data/app/assets/stylesheets/geoblacklight/record.css +1 -2
- data/app/assets/stylesheets/geoblacklight/search.css +3 -4
- data/app/assets/stylesheets/geoblacklight.css +0 -1
- data/app/components/geoblacklight/document/download_link_component.html.erb +1 -1
- data/app/components/geoblacklight/document/download_links_component.html.erb +1 -1
- data/app/components/geoblacklight/document/download_links_component.rb +1 -1
- data/app/components/geoblacklight/document/preview_component.html.erb +1 -1
- data/app/components/geoblacklight/document/preview_component.rb +45 -0
- data/app/components/geoblacklight/iiif_drag_drop_component.html.erb +1 -1
- data/app/components/geoblacklight/iiif_drag_drop_component.rb +1 -1
- data/app/components/geoblacklight/login_link_component.html.erb +1 -1
- data/app/components/geoblacklight/login_link_component.rb +17 -1
- data/app/components/geoblacklight/metadata_description_markdown_component.rb +1 -1
- data/app/components/geoblacklight/relations/relation_component.html.erb +2 -4
- data/app/components/geoblacklight/relations/relation_component.rb +0 -4
- data/app/components/geoblacklight/search_result_component.html.erb +2 -4
- data/app/components/geoblacklight/search_result_component.rb +0 -3
- data/app/components/geoblacklight/static_map_component.rb +2 -3
- data/app/controllers/relations_controller.rb +2 -0
- data/app/controllers/viewer_record_controller.rb +2 -0
- data/app/helpers/geoblacklight_helper.rb +5 -19
- data/app/javascript/geoblacklight/controllers/overview_map_controller.js +4 -3
- data/app/javascript/geoblacklight/core.js +0 -2
- data/app/javascript/geoblacklight/initializers/field_truncation.js +1 -4
- data/app/models/concerns/geoblacklight/bbox_filter_field.rb +0 -13
- data/app/models/concerns/geoblacklight/solr_document/preview.rb +58 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +20 -23
- data/app/views/catalog/_document_split.html.erb +1 -1
- data/config/importmap.rb +5 -6
- data/geoblacklight.gemspec +1 -1
- data/lib/generators/geoblacklight/install_generator.rb +3 -6
- data/lib/generators/geoblacklight/templates/assets/customizations.css +13 -4
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +4 -6
- data/lib/generators/geoblacklight/templates/settings.yml +1 -25
- data/lib/geoblacklight/configuration/settings_builder.rb +0 -2
- data/lib/geoblacklight/configuration.rb +1 -19
- data/lib/geoblacklight/constants.rb +1 -0
- data/lib/geoblacklight/references.rb +0 -9
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight.rb +0 -1
- data/spec/components/geoblacklight/citation_component_spec.rb +2 -2
- data/spec/components/geoblacklight/{item_map_viewer_component_spec.rb → document/preview_component_spec.rb} +37 -1
- data/spec/components/geoblacklight/document/sidebar_component_spec.rb +1 -1
- data/spec/components/geoblacklight/document_component_spec.rb +1 -1
- data/spec/components/geoblacklight/download_links_component_spec.rb +1 -1
- data/spec/components/geoblacklight/iiif_drag_drop_component_spec.rb +7 -7
- data/spec/components/geoblacklight/login_link_component_spec.rb +20 -12
- data/spec/components/geoblacklight/relations/relation_component_spec.rb +3 -11
- data/spec/components/geoblacklight/search_result_component_spec.rb +4 -12
- data/spec/components/geoblacklight/static_map_component_spec.rb +19 -10
- data/spec/factories/user.rb +6 -1
- data/spec/features/axe_spec.rb +1 -0
- data/spec/features/restricted_viewer_spec.rb +1 -3
- data/spec/features/search_results_map_spec.rb +13 -0
- data/spec/features/search_spec.rb +1 -1
- data/spec/features/sign_in_spec.rb +26 -0
- data/spec/features/truncated_metadata_spec.rb +0 -5
- data/spec/fixtures/solr_documents/README.md +63 -57
- data/spec/fixtures/solr_documents/b1g_iiif_manifest.json +1 -1
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +1 -0
- data/spec/fixtures/solr_documents/bbox-spans-180.json +3 -3
- data/spec/fixtures/solr_documents/bluemarble.json +28 -0
- data/spec/fixtures/solr_documents/complex-geom.json +3 -3
- data/spec/fixtures/solr_documents/cornell-roads-fgdc.json +19 -0
- data/spec/fixtures/solr_documents/dalian.json +38 -0
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +2 -2
- data/spec/fixtures/solr_documents/metadata_no_provider.json +0 -1
- data/spec/fixtures/solr_documents/modis-ndvi.json +36 -0
- data/spec/fixtures/solr_documents/panama.json +37 -0
- data/spec/fixtures/solr_documents/public_cog_princeton.json +0 -2
- data/spec/fixtures/solr_documents/stanford-geojson.json +39 -0
- data/spec/fixtures/solr_documents/usgs-htmc-index-ca-24000.json +36 -0
- data/spec/fixtures/solr_documents/usgs-tnm-index-dem1.json +28 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +0 -32
- data/spec/lib/geoblacklight/references_spec.rb +8 -14
- data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +0 -24
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +30 -23
- data/spec/requests/bookmarks_spec.rb +1 -0
- data/spec/requests/catalog_search_spec.rb +1 -1
- data/spec/requests/catalog_show_spec.rb +2 -2
- data/spec/requests/index_view_spec.rb +6 -6
- data/spec/requests/metadata_spec.rb +1 -1
- data/spec/requests/missing_metadata_spec.rb +13 -13
- data/spec/requests/search_results_spec.rb +4 -3
- data/spec/requests/viewer_record_spec.rb +1 -3
- data/spec/requests/viewer_requests_spec.rb +3 -5
- data/spec/spec_helper.rb +11 -1
- data/spec/support/authentication.rb +37 -0
- data/spec/support/features/session_helpers.rb +15 -13
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/template.rb +1 -1
- metadata +17 -26
- data/app/assets/stylesheets/geoblacklight/index_maps.css +0 -29
- data/app/components/geoblacklight/item_map_viewer_component.html.erb +0 -1
- data/app/components/geoblacklight/item_map_viewer_component.rb +0 -52
- data/app/controllers/wms_controller.rb +0 -17
- data/app/javascript/geoblacklight/initializers/tooltips.js +0 -51
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +0 -17
- data/lib/geoblacklight/geometry.rb +0 -86
- data/lib/geoblacklight/item_viewer.rb +0 -84
- data/lib/geoblacklight/routes/wms.rb +0 -15
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +0 -37
- data/lib/geoblacklight/wms_layer.rb +0 -34
- data/spec/controllers/wms_controller_spec.rb +0 -34
- data/spec/fixtures/solr_documents/no_locn_geometry.json +0 -17
- data/spec/fixtures/solr_documents/no_spatial.json +0 -28
- data/spec/javascripts/metadata_download_button_spec.js +0 -17
- data/spec/lib/geoblacklight/geometry_spec.rb +0 -60
- data/spec/lib/geoblacklight/item_viewer_spec.rb +0 -77
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +0 -54
- data/spec/lib/geoblacklight/wms_layer_spec.rb +0 -115
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +0 -19
|
@@ -22,7 +22,8 @@ module Geoblacklight
|
|
|
22
22
|
|
|
23
23
|
def raise_unpermitted_params
|
|
24
24
|
inject_into_file "config/environments/test.rb",
|
|
25
|
-
"config.action_controller.action_on_unpermitted_parameters = :raise\n"
|
|
25
|
+
"config.action_controller.action_on_unpermitted_parameters = :raise\n" \
|
|
26
|
+
"config.action_controller.always_permitted_parameters = %w[controller action commit]\n", before: /^end/
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def mount_geoblacklight_engine
|
|
@@ -35,10 +36,6 @@ module Geoblacklight
|
|
|
35
36
|
resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do
|
|
36
37
|
concerns :gbl_exportable
|
|
37
38
|
end
|
|
38
|
-
concern :gbl_wms, Geoblacklight::Routes::Wms.new
|
|
39
|
-
namespace :wms do
|
|
40
|
-
concerns :gbl_wms
|
|
41
|
-
end
|
|
42
39
|
ROUTES
|
|
43
40
|
|
|
44
41
|
inject_into_file "config/routes.rb", routes, before: /^end/
|
|
@@ -58,7 +55,7 @@ module Geoblacklight
|
|
|
58
55
|
end
|
|
59
56
|
|
|
60
57
|
def add_rsolr_gem
|
|
61
|
-
gem "rsolr", ">= 1.0", "<
|
|
58
|
+
gem "rsolr", ">= 1.0", "< 4"
|
|
62
59
|
end
|
|
63
60
|
|
|
64
61
|
def docker_compose
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
/* Local Application Customizations */
|
|
2
2
|
|
|
3
3
|
/* Header Logo */
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/* Browsers that support light-dark() with images pick the logo from color-scheme */
|
|
5
|
+
@supports (background-image: light-dark(linear-gradient(#fff, #fff), linear-gradient(#000, #000))) {
|
|
6
|
+
:root {
|
|
7
|
+
--bl-logo-image: light-dark(url("geoblacklight/logo.svg"), url("geoblacklight/logo-dark.svg"));
|
|
8
|
+
}
|
|
6
9
|
}
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
@supports not (background-image: light-dark(linear-gradient(#fff, #fff), linear-gradient(#000, #000))) {
|
|
12
|
+
:root {
|
|
13
|
+
--bl-logo-image: url("geoblacklight/logo.svg");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[data-bs-theme="dark"] {
|
|
17
|
+
--bl-logo-image: url("geoblacklight/logo-dark.svg");
|
|
18
|
+
}
|
|
10
19
|
}
|
|
@@ -153,15 +153,13 @@ class CatalogController < ApplicationController
|
|
|
153
153
|
# The following fields all feature string values. If there is a value present in the metadata, they fields will show up on the item show page.
|
|
154
154
|
# The labels and order can be customized. Comment out fields to hide them.
|
|
155
155
|
|
|
156
|
-
config.add_show_field field_config.alternative_title, label: "Alternative Title",
|
|
157
|
-
itemprop: "alt_title"
|
|
158
156
|
config.add_show_field field_config.description, label: "Description", itemprop: "description",
|
|
159
157
|
component: Geoblacklight::MetadataDescriptionMarkdownComponent
|
|
160
|
-
config.add_show_field field_config.creator, label: "Creator", itemprop: "creator"
|
|
161
|
-
config.add_show_field field_config.publisher, label: "Publisher", itemprop: "publisher"
|
|
158
|
+
config.add_show_field field_config.creator, label: "Creator", itemprop: "creator", link_to_facet: true
|
|
159
|
+
config.add_show_field field_config.publisher, label: "Publisher", itemprop: "publisher", link_to_facet: true
|
|
162
160
|
config.add_show_field field_config.provider, label: "Provider", link_to_facet: true
|
|
163
|
-
config.add_show_field field_config.resource_class, label: "Resource Class", itemprop: "class"
|
|
164
|
-
config.add_show_field field_config.resource_type, label: "Resource Type", itemprop: "type"
|
|
161
|
+
config.add_show_field field_config.resource_class, label: "Resource Class", itemprop: "class", link_to_facet: true
|
|
162
|
+
config.add_show_field field_config.resource_type, label: "Resource Type", itemprop: "type", link_to_facet: true
|
|
165
163
|
config.add_show_field field_config.subject, label: "Subject", itemprop: "keywords",
|
|
166
164
|
link_to_facet: true, layout_component: Geoblacklight::TruncatableMetadataFieldLayoutComponent
|
|
167
165
|
config.add_show_field field_config.theme, label: "Theme", itemprop: "theme",
|
|
@@ -33,9 +33,7 @@
|
|
|
33
33
|
# homepage_map_geom: null
|
|
34
34
|
# # homepage_map_geom: '{"type":"Polygon","coordinates":[[[-73.58,42.93],[-73.58,41.20],[-69.90,41.20],[-69.90,42.93]]]}'
|
|
35
35
|
|
|
36
|
-
# # Non-search-field GeoBlacklight application permitted params
|
|
37
|
-
# # Values are left mixed-case on purpose: the uppercase symbols are WMS/OGC
|
|
38
|
-
# # request parameter names (BBOX, WIDTH, etc.) and must match what clients send.
|
|
36
|
+
# # Non-search-field GeoBlacklight application permitted params
|
|
39
37
|
# gbl_params:
|
|
40
38
|
# - :bbox
|
|
41
39
|
# - :email
|
|
@@ -45,14 +43,6 @@
|
|
|
45
43
|
# - :logo
|
|
46
44
|
# - :provider
|
|
47
45
|
# - :type
|
|
48
|
-
# - :BBOX
|
|
49
|
-
# - :HEIGHT
|
|
50
|
-
# - :LAYERS
|
|
51
|
-
# - :QUERY_LAYERS
|
|
52
|
-
# - :URL
|
|
53
|
-
# - :WIDTH
|
|
54
|
-
# - :X
|
|
55
|
-
# - :Y
|
|
56
46
|
|
|
57
47
|
# # Solr field mappings
|
|
58
48
|
# fields:
|
|
@@ -109,9 +99,6 @@
|
|
|
109
99
|
# - "iso19139"
|
|
110
100
|
# - "html"
|
|
111
101
|
|
|
112
|
-
# # (For WMS inspection) timeout and open_timeout parameters for Faraday
|
|
113
|
-
# timeout_wms: 4
|
|
114
|
-
|
|
115
102
|
# # Web services shown in tool panel
|
|
116
103
|
# webservices_shown:
|
|
117
104
|
# - "wms"
|
|
@@ -210,17 +197,6 @@
|
|
|
210
197
|
# label: geoblacklight.relations.version_of_descendants
|
|
211
198
|
# query_type: descendants
|
|
212
199
|
|
|
213
|
-
# # WMS Parameters. Keys are OGC WMS request parameter names and are sent to
|
|
214
|
-
# # remote WMS servers, so they are intentionally left uppercase.
|
|
215
|
-
# wms_params:
|
|
216
|
-
# SERVICE: "WMS"
|
|
217
|
-
# VERSION: "1.1.1"
|
|
218
|
-
# REQUEST: "GetFeatureInfo"
|
|
219
|
-
# STYLES: ""
|
|
220
|
-
# SRS: "EPSG:4326"
|
|
221
|
-
# EXCEPTIONS: "application/json"
|
|
222
|
-
# INFO_FORMAT: "application/json"
|
|
223
|
-
|
|
224
200
|
# iiif_drag_drop_link: "@manifest?manifest=@manifest"
|
|
225
201
|
|
|
226
202
|
# # Toggle thumbnail images in the search results (index) view
|
|
@@ -26,8 +26,6 @@ module Geoblacklight
|
|
|
26
26
|
assign(config, :webservices_shown, settings.WEBSERVICES_SHOWN)
|
|
27
27
|
assign(config, :relationships_shown, build_relationships)
|
|
28
28
|
assign(config, :gbl_params, settings.GBL_PARAMS)
|
|
29
|
-
assign(config, :wms_params, settings.WMS_PARAMS&.to_h)
|
|
30
|
-
assign(config, :timeout_wms, settings.TIMEOUT_WMS)
|
|
31
29
|
assign(config, :restricted_origins, settings.restricted_origins)
|
|
32
30
|
|
|
33
31
|
build_fields(config)
|
|
@@ -15,9 +15,6 @@ module Geoblacklight
|
|
|
15
15
|
# Institution deployed at
|
|
16
16
|
attribute :institution, :string, default: "Stanford"
|
|
17
17
|
|
|
18
|
-
# (For WMS inspection) timeout and open_timeout parameters for Faraday
|
|
19
|
-
attribute :timeout_wms, :integer, default: 4
|
|
20
|
-
|
|
21
18
|
# Services the item viewer should send cookies to when previewing restricted data a reader is
|
|
22
19
|
# allowed at, as URL prefixes - usually just the service's origin, e.g.
|
|
23
20
|
# config.restricted_origins = ["https://geoserver-restricted.example.edu/"]
|
|
@@ -34,9 +31,6 @@ module Geoblacklight
|
|
|
34
31
|
# Non-search-field GeoBlacklight application permitted params
|
|
35
32
|
attr_accessor :gbl_params # typed as Array
|
|
36
33
|
|
|
37
|
-
# WMS Parameters
|
|
38
|
-
attr_accessor :wms_params # typed as Hash
|
|
39
|
-
|
|
40
34
|
attribute :iiif_drag_drop_link, :string, default: "@manifest?manifest=@manifest"
|
|
41
35
|
|
|
42
36
|
# Toggle thumbnail images in the search results (index) view
|
|
@@ -71,19 +65,7 @@ module Geoblacklight
|
|
|
71
65
|
def initialize
|
|
72
66
|
super
|
|
73
67
|
@relationships_shown = RelationshipsConfig.new
|
|
74
|
-
@gbl_params = [
|
|
75
|
-
:bbox, :email, :file, :format, :id, :logo, :provider, :type,
|
|
76
|
-
:BBOX, :HEIGHT, :LAYERS, :QUERY_LAYERS, :URL, :WIDTH, :X, :Y
|
|
77
|
-
]
|
|
78
|
-
@wms_params = {
|
|
79
|
-
SERVICE: "WMS",
|
|
80
|
-
VERSION: "1.1.1",
|
|
81
|
-
REQUEST: "GetFeatureInfo",
|
|
82
|
-
STYLES: "",
|
|
83
|
-
SRS: "EPSG:4326",
|
|
84
|
-
EXCEPTIONS: "application/json",
|
|
85
|
-
INFO_FORMAT: "application/json"
|
|
86
|
-
}
|
|
68
|
+
@gbl_params = [:bbox, :email, :file, :format, :id, :logo, :provider, :type]
|
|
87
69
|
|
|
88
70
|
@restricted_origins = []
|
|
89
71
|
|
|
@@ -10,6 +10,7 @@ module Geoblacklight
|
|
|
10
10
|
html: "http://www.w3.org/1999/xhtml",
|
|
11
11
|
iiif: "http://iiif.io/api/image",
|
|
12
12
|
iiif_manifest: "http://iiif.io/api/presentation#manifest",
|
|
13
|
+
iiif_georeference: "https://iiif.io/api/extension/georef/1/context.json",
|
|
13
14
|
iso19139: "http://www.isotc211.org/schemas/2005/gmd",
|
|
14
15
|
mods: "http://www.loc.gov/mods/v3",
|
|
15
16
|
shapefile: "http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf",
|
|
@@ -29,13 +29,6 @@ module Geoblacklight
|
|
|
29
29
|
@shown_metadata ||= shown_metadata_refs.map { |ref| Geoblacklight::Metadata.instance(ref) }
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
##
|
|
33
|
-
# Accessor for a document's file format
|
|
34
|
-
# @return [String] file format for the document
|
|
35
|
-
def format
|
|
36
|
-
@document.file_format
|
|
37
|
-
end
|
|
38
|
-
|
|
39
32
|
##
|
|
40
33
|
# @param [String, Symbol] ref_type
|
|
41
34
|
# @return [Geoblacklight::Reference]
|
|
@@ -62,8 +55,6 @@ module Geoblacklight
|
|
|
62
55
|
end
|
|
63
56
|
end
|
|
64
57
|
|
|
65
|
-
private
|
|
66
|
-
|
|
67
58
|
##
|
|
68
59
|
# Parses the references field of a document
|
|
69
60
|
# @return [Hash]
|
data/lib/geoblacklight.rb
CHANGED
|
@@ -29,11 +29,11 @@ RSpec.describe Geoblacklight::Document::CitationComponent, type: :component do
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
context "when the identifier is not a URL and no reference schema.org URL is available" do
|
|
32
|
-
let(:fixture) { JSON.parse(read_fixture("solr_documents/
|
|
32
|
+
let(:fixture) { JSON.parse(read_fixture("solr_documents/display-note.json")) }
|
|
33
33
|
|
|
34
34
|
it "creates a citation with the solr document link" do
|
|
35
35
|
expect(page)
|
|
36
|
-
.to have_text "
|
|
36
|
+
.to have_text "FrobozzCo International. (1983-01-01). Building Footprints, Frobozz Headquarters, 781 GUE. [Shapefile]. FrobozzCo International. http://test.host/catalog/frobozz-111"
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
|
-
RSpec.describe Geoblacklight::
|
|
5
|
+
RSpec.describe Geoblacklight::Document::PreviewComponent, type: :component do
|
|
6
6
|
before do
|
|
7
7
|
render_inline(described_class.new(document: document))
|
|
8
8
|
end
|
|
@@ -10,6 +10,7 @@ RSpec.describe Geoblacklight::ItemMapViewerComponent, type: :component do
|
|
|
10
10
|
# One viewer for every protocol it can preview: what to show is the viewer's own decision, taken
|
|
11
11
|
# from the references in the record it fetches
|
|
12
12
|
["solr_documents/iiif-eastern-hemisphere.json",
|
|
13
|
+
"solr_documents/stanford-geojson.json",
|
|
13
14
|
"solr_documents/public_pmtiles_princeton.json",
|
|
14
15
|
"solr_documents/actual-polygon1.json"].each do |fixture_path|
|
|
15
16
|
context "with #{File.basename(fixture_path, ".json")}" do
|
|
@@ -45,11 +46,46 @@ RSpec.describe Geoblacklight::ItemMapViewerComponent, type: :component do
|
|
|
45
46
|
end
|
|
46
47
|
end
|
|
47
48
|
|
|
49
|
+
describe "restricted origins in reference URLs" do
|
|
50
|
+
# Restricted, and provided by this app's own institution
|
|
51
|
+
let(:document) { SolrDocument.new(JSON.parse(read_fixture("solr_documents/actual-raster1.json"))) }
|
|
52
|
+
|
|
53
|
+
before do
|
|
54
|
+
allow(Geoblacklight.configuration).to receive(:restricted_origins).and_return(["https://stacks.stanford.edu/"])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
context "when signed in" do
|
|
58
|
+
before do
|
|
59
|
+
allow(vc_test_controller).to receive(:current_user).and_return(instance_double(ActiveRecord::Base))
|
|
60
|
+
render_inline(described_class.new(document: document))
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "sends them to the viewer as a separate data param" do
|
|
64
|
+
expect(page).to have_css('ogm-viewer[data-restricted-origins=\'["https://stacks.stanford.edu/"]\']')
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
context "when not signed in" do
|
|
69
|
+
before do
|
|
70
|
+
allow(vc_test_controller).to receive(:current_user).and_return(nil)
|
|
71
|
+
render_inline(described_class.new(document: document))
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "does not send them to the viewer" do
|
|
75
|
+
expect(page).to have_css("ogm-viewer:not([data-restricted-origins])")
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
48
80
|
context "with an oembed record" do
|
|
49
81
|
let(:document) { SolrDocument.new(JSON.parse(read_fixture("solr_documents/oembed.json"))) }
|
|
50
82
|
|
|
51
83
|
it "uses the oembed viewer instead" do
|
|
52
84
|
expect(page).to have_css("div#oembed-viewer")
|
|
53
85
|
end
|
|
86
|
+
|
|
87
|
+
it "hands it the oembed endpoint" do
|
|
88
|
+
expect(page).to have_css("div#oembed-viewer[data-oembed-viewer-url-value='#{document.oembed}']")
|
|
89
|
+
end
|
|
54
90
|
end
|
|
55
91
|
end
|
|
@@ -17,7 +17,7 @@ RSpec.describe Geoblacklight::Document::SidebarComponent, type: :component do
|
|
|
17
17
|
allow_any_instance_of(Blacklight::DocumentHelperBehavior).to receive(:current_bookmarks).and_return([])
|
|
18
18
|
|
|
19
19
|
with_controller_class(CatalogController) do
|
|
20
|
-
allow(vc_test_controller).to receive_messages(current_or_guest_user:
|
|
20
|
+
allow(vc_test_controller).to receive_messages(current_or_guest_user: nil)
|
|
21
21
|
render_inline(component)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
@@ -20,7 +20,7 @@ RSpec.describe Geoblacklight::DocumentComponent, type: :component do
|
|
|
20
20
|
|
|
21
21
|
before do
|
|
22
22
|
vc_test_controller.action_name = "show"
|
|
23
|
-
allow(vc_test_controller).to receive_messages(view_context: view_context, current_or_guest_user:
|
|
23
|
+
allow(vc_test_controller).to receive_messages(view_context: view_context, current_or_guest_user: nil, blacklight_config: blacklight_config)
|
|
24
24
|
allow(view_context).to receive_messages(search_session: {}, current_search_session: nil, current_bookmarks: [])
|
|
25
25
|
render_inline(component)
|
|
26
26
|
end
|
|
@@ -15,7 +15,7 @@ RSpec.describe Geoblacklight::Document::DownloadLinksComponent, type: :component
|
|
|
15
15
|
downloadable?: downloadable,
|
|
16
16
|
direct_download: direct_download,
|
|
17
17
|
iiif_download: iiif_download,
|
|
18
|
-
|
|
18
|
+
format: file_format,
|
|
19
19
|
references: references
|
|
20
20
|
)
|
|
21
21
|
end
|
|
@@ -4,21 +4,21 @@ require "spec_helper"
|
|
|
4
4
|
|
|
5
5
|
RSpec.describe Geoblacklight::IiifDragDropComponent, type: :component do
|
|
6
6
|
describe "#iiifdragdropcomponet" do
|
|
7
|
-
let(:
|
|
8
|
-
let(:
|
|
9
|
-
let(:document) { instance_double(SolrDocument, id: 123, item_viewer: item_viewer) }
|
|
7
|
+
let(:references_field) { Geoblacklight.configuration.fields.references }
|
|
8
|
+
let(:document) { SolrDocument.new("id" => 123, references_field => references.to_json) }
|
|
10
9
|
let(:component) { described_class.new(document: document) }
|
|
11
10
|
|
|
12
|
-
context "does not have
|
|
13
|
-
let(:
|
|
11
|
+
context "does not have a manifest url" do
|
|
12
|
+
let(:references) { {"http://iiif.io/api/image" => "https://url.com/info.json"} }
|
|
14
13
|
|
|
15
14
|
it "does not render" do
|
|
16
15
|
expect(component.render?).to be false
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
|
|
20
|
-
context "has
|
|
21
|
-
let(:
|
|
19
|
+
context "has a manifest url" do
|
|
20
|
+
let(:references) { {"http://iiif.io/api/presentation#manifest" => "https://url.com/manifest.json"} }
|
|
21
|
+
|
|
22
22
|
it "renders iiif drag and drop icon" do
|
|
23
23
|
render_inline(component)
|
|
24
24
|
expect(component.render?).to be true
|
|
@@ -3,26 +3,34 @@
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
5
|
RSpec.describe Geoblacklight::LoginLinkComponent, type: :component do
|
|
6
|
-
let(:document) { instance_double(SolrDocument, id: 123) }
|
|
6
|
+
let(:document) { instance_double(SolrDocument, id: 123, restricted?: true, same_institution?: true) }
|
|
7
|
+
let(:login_path) { "/login" }
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
allow(document).to receive(:same_institution?).and_return(true)
|
|
13
|
-
end
|
|
9
|
+
before do
|
|
10
|
+
allow(vc_test_controller).to receive(:blacklight_login_path).and_return(login_path)
|
|
11
|
+
allow(vc_test_controller).to receive(:current_user).and_return(nil)
|
|
12
|
+
end
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
context "when the document is restricted to this institution and no one is signed in" do
|
|
15
|
+
it "links to the sign-in page" do
|
|
16
16
|
render_inline(described_class.new(document: document))
|
|
17
|
-
expect(page).to
|
|
17
|
+
expect(page).to have_link(I18n.t("geoblacklight.tools.login_to_view"), href: login_path)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
context "when
|
|
21
|
+
context "when signed in" do
|
|
22
22
|
before do
|
|
23
|
-
allow(
|
|
24
|
-
|
|
23
|
+
allow(vc_test_controller).to receive(:current_user).and_return(instance_double(ActiveRecord::Base))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "does not render anything" do
|
|
27
|
+
render_inline(described_class.new(document: document))
|
|
28
|
+
expect(page).not_to have_text(I18n.t("geoblacklight.tools.login_to_view"))
|
|
25
29
|
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
context "when the app has no authentication" do
|
|
33
|
+
let(:login_path) { nil }
|
|
26
34
|
|
|
27
35
|
it "does not render anything" do
|
|
28
36
|
render_inline(described_class.new(document: document))
|
|
@@ -25,7 +25,7 @@ RSpec.describe Geoblacklight::Relations::RelationComponent, type: :component do
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
it "does not render a description block when there is no description" do
|
|
28
|
-
expect(page).to have_no_css(".
|
|
28
|
+
expect(page).to have_no_css(".description")
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it "does not render a sibling browse link when no sibling_count is given" do
|
|
@@ -38,16 +38,8 @@ RSpec.describe Geoblacklight::Relations::RelationComponent, type: :component do
|
|
|
38
38
|
|
|
39
39
|
before { render_inline(described_class.new(document: document)) }
|
|
40
40
|
|
|
41
|
-
it "renders
|
|
42
|
-
expect(page).to have_css(".
|
|
43
|
-
expect(page).to have_content("First paragraph.")
|
|
44
|
-
expect(page).to have_content("Second paragraph.")
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "sets up the truncation data attributes for the JS initializer" do
|
|
48
|
-
expect(page).to have_css(
|
|
49
|
-
".truncate-abstract[data-max-lines='5'][data-read-more-text='Read more'][data-close-text='Close']"
|
|
50
|
-
)
|
|
41
|
+
it "renders the description as a single paragraph" do
|
|
42
|
+
expect(page).to have_css(".description", text: "First paragraph. Second paragraph.")
|
|
51
43
|
end
|
|
52
44
|
end
|
|
53
45
|
|
|
@@ -22,26 +22,18 @@ RSpec.describe Geoblacklight::SearchResultComponent, type: :component do
|
|
|
22
22
|
|
|
23
23
|
describe "#description" do
|
|
24
24
|
it "does not render a description block when there is no description" do
|
|
25
|
-
expect(page).to have_no_css(".
|
|
25
|
+
expect(page).to have_no_css(".description")
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
context "when the document has a description" do
|
|
29
29
|
let(:description) { ["First paragraph.", "Second paragraph."] }
|
|
30
30
|
|
|
31
|
-
it "renders
|
|
32
|
-
expect(page).to have_css(".
|
|
33
|
-
expect(page).to have_content("First paragraph.")
|
|
34
|
-
expect(page).to have_content("Second paragraph.")
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it "sets up the truncation data attributes for the JS initializer" do
|
|
38
|
-
expect(page).to have_css(
|
|
39
|
-
".truncate-abstract[data-max-lines='4'][data-read-more-text='Read more'][data-close-text='Close']"
|
|
40
|
-
)
|
|
31
|
+
it "renders the description as a single paragraph" do
|
|
32
|
+
expect(page).to have_css(".description", text: "First paragraph. Second paragraph.")
|
|
41
33
|
end
|
|
42
34
|
|
|
43
35
|
it "exposes the description as schema.org markup" do
|
|
44
|
-
expect(page).to have_css(".
|
|
36
|
+
expect(page).to have_css(".description[itemprop='description']")
|
|
45
37
|
end
|
|
46
38
|
end
|
|
47
39
|
end
|
|
@@ -9,20 +9,29 @@ RSpec.describe Geoblacklight::StaticMapComponent, type: :component do
|
|
|
9
9
|
render_inline(described_class.new(document: document))
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
allow(Geoblacklight.configuration).to receive(:sidebar_static_map).and_return(["map"])
|
|
12
|
+
it "renders a locator map of where the record is" do
|
|
13
|
+
expect(rendered.css("ogm-locator#locator-map")).to be_present
|
|
15
14
|
end
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
it "points it at the same endpoint the item viewer reads its own metadata from" do
|
|
17
|
+
map = rendered.css("ogm-locator").first
|
|
18
|
+
expect(map["record-url"]).to eq Rails.application.routes.url_helpers.viewer_solr_document_path(document)
|
|
19
|
+
expect(map["theme"]).to be_nil
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context "when the record has a map-previewable reference" do
|
|
23
|
+
let(:document) { SolrDocument.new(JSON.parse(read_fixture("solr_documents/actual-polygon1.json"))) }
|
|
24
|
+
|
|
25
|
+
it "does not render a locator map" do
|
|
26
|
+
expect(rendered.css("ogm-locator")).to be_empty
|
|
20
27
|
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context "when the record has a IIIF-previewable reference only" do
|
|
31
|
+
let(:document) { SolrDocument.new(JSON.parse(read_fixture("solr_documents/public_iiif_princeton.json"))) }
|
|
21
32
|
|
|
22
|
-
it "
|
|
23
|
-
|
|
24
|
-
expect(map["record-url"]).to eq Rails.application.routes.url_helpers.viewer_solr_document_path(document)
|
|
25
|
-
expect(map["theme"]).to be_nil
|
|
33
|
+
it "renders a locator map" do
|
|
34
|
+
expect(rendered.css("ogm-locator#locator-map")).to be_present
|
|
26
35
|
end
|
|
27
36
|
end
|
|
28
37
|
end
|
data/spec/factories/user.rb
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
FactoryBot.define do
|
|
4
4
|
factory :user do
|
|
5
|
-
|
|
5
|
+
# Rails' built-in authentication calls the column email_address, where Devise calls it email
|
|
6
|
+
if AuthenticationHelpers.provider == :rails
|
|
7
|
+
sequence(:email_address) { |n| "user#{n}@example.com" }
|
|
8
|
+
else
|
|
9
|
+
sequence(:email) { |n| "user#{n}@example.com" }
|
|
10
|
+
end
|
|
6
11
|
password { "password" }
|
|
7
12
|
password_confirmation { "password" }
|
|
8
13
|
end
|
data/spec/features/axe_spec.rb
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
5
|
RSpec.feature "Restricted item viewer", js: true do
|
|
6
|
-
scenario "
|
|
6
|
+
scenario "shows where the layer is rather than failing to load it" do
|
|
7
7
|
visit solr_document_path("stanford-dp018hs9766")
|
|
8
8
|
|
|
9
|
-
expect(page).to have_link("Login to View and Download")
|
|
10
|
-
|
|
11
9
|
# The viewer was handed a record with no service references, so the only preview it can offer
|
|
12
10
|
# is the record's own extent
|
|
13
11
|
previews = find("ogm-viewer").shadow_root.find("ogm-previews", visible: :all)
|
|
@@ -25,6 +25,19 @@ RSpec.feature "search results map", js: true do
|
|
|
25
25
|
expect(north).to be_within(1).of(45)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
scenario "draws a result that crosses the antimeridian across the Pacific, not the long way round" do
|
|
29
|
+
visit search_catalog_path(q: "Oceania")
|
|
30
|
+
|
|
31
|
+
# East Asia and Oceania is ENVELOPE(68, -124.73, 62.45, -53.23): its east edge is numerically west
|
|
32
|
+
# of its west edge, the way a box that crosses the antimeridian is written. If drawn the wrong way,
|
|
33
|
+
# it will cover the Americas and the Atlantic instead, which is the opposite of what it actually depicts.
|
|
34
|
+
place = find(".document[data-map-id='princeton-sx61dn82p']")["data-document-counter"].to_i
|
|
35
|
+
(west, _south), (east, _north) = drawn_extents[place - 1]
|
|
36
|
+
|
|
37
|
+
expect(west).to be_within(1).of(68)
|
|
38
|
+
expect(east).to be_within(1).of(-124.73 + 360)
|
|
39
|
+
end
|
|
40
|
+
|
|
28
41
|
scenario "comes back knowing the area the reader searched" do
|
|
29
42
|
# The line of text saying how to search goes up with the map
|
|
30
43
|
expect(find("#overview-map").shadow_root).to have_css(".maplibregl-ctrl-geosearch")
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
RSpec.feature "Signing in to see a restricted record" do
|
|
6
|
+
let(:restricted) { "stanford-dp018hs9766" }
|
|
7
|
+
|
|
8
|
+
scenario "brings the reader back to the record once they're signed in" do
|
|
9
|
+
skip_without_authentication
|
|
10
|
+
visit solr_document_path(restricted)
|
|
11
|
+
click_link "Login to View and Download"
|
|
12
|
+
fill_in_sign_in_form FactoryBot.create(:user)
|
|
13
|
+
|
|
14
|
+
expect(page).to have_current_path(solr_document_path(restricted))
|
|
15
|
+
expect(page).to have_link "Log Out"
|
|
16
|
+
expect(page).to have_no_link "Login to View and Download"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
scenario "is not offered when the app has no authentication" do
|
|
20
|
+
skip "the test app has authentication" if AuthenticationHelpers.provider
|
|
21
|
+
visit solr_document_path(restricted)
|
|
22
|
+
|
|
23
|
+
expect(page).to have_css "h1", text: "Elkhorn Slough"
|
|
24
|
+
expect(page).to have_no_link "Login to View and Download"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -53,11 +53,6 @@ RSpec.feature "Metadata fields that limit their values" do
|
|
|
53
53
|
scenario "The hidden values stay available to assistive technology", js: true do
|
|
54
54
|
visit solr_document_path("princeton-dc7h14b252v")
|
|
55
55
|
|
|
56
|
-
# visually-hidden leaves the values in the accessibility tree, so the button is of no use
|
|
57
|
-
# to assistive technology and says so rather than promising something it cannot deliver
|
|
58
|
-
expect(read_more[:"aria-disabled"]).to eq "true"
|
|
59
|
-
expect(read_more[:"aria-label"]).to include "assistive technology"
|
|
60
|
-
|
|
61
56
|
hidden = all("#{group} > dd.visually-hidden", visible: :all).last
|
|
62
57
|
expect(hidden.evaluate_script("getComputedStyle(this).display")).not_to eq "none"
|
|
63
58
|
expect(hidden.evaluate_script("getComputedStyle(this).visibility")).not_to eq "hidden"
|