geoblacklight 4.5.1 → 4.7.0
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 +1 -1
- data/Gemfile +0 -1
- data/app/assets/javascripts/geoblacklight/basemaps.js +60 -82
- data/app/assets/javascripts/geoblacklight/viewers/map.js +22 -5
- data/app/controllers/download_controller.rb +5 -0
- data/app/controllers/relation_controller.rb +1 -0
- data/app/helpers/arcgis_helper.rb +3 -0
- data/app/helpers/blacklight_helper.rb +4 -0
- data/app/helpers/carto_helper.rb +5 -0
- data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +7 -1
- data/app/helpers/geoblacklight_helper.rb +74 -21
- data/app/javascript/openlayers/basemaps.js +0 -20
- data/app/javascript/openlayers/ol_initializer.js +27 -2
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +7 -0
- data/app/models/concerns/geoblacklight/solr_document/citation.rb +7 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -1
- data/app/models/concerns/geoblacklight/solr_document.rb +30 -2
- data/app/presenters/geoblacklight/document_presenter.rb +9 -0
- data/app/views/catalog/_arcgis.html.erb +1 -1
- data/app/views/catalog/_carto.html.erb +1 -1
- data/app/views/catalog/_downloads_collapse.html.erb +3 -0
- data/app/views/catalog/_index_split_default.html.erb +1 -1
- data/app/views/catalog/_show_default_attribute_table.html.erb +1 -1
- data/app/views/catalog/_show_default_viewer_container.html.erb +3 -3
- data/app/views/catalog/_show_downloads.html.erb +3 -0
- data/app/views/catalog/_show_sidebar.html.erb +1 -1
- data/app/views/catalog/_show_sidebar_static_map.html.erb +3 -0
- data/app/views/catalog/_web_services.html.erb +1 -1
- data/geoblacklight.gemspec +2 -2
- data/lib/generators/geoblacklight/install_generator.rb +1 -1
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +3 -4
- data/lib/generators/geoblacklight/templates/settings.yml +19 -0
- data/lib/geoblacklight/deprecated_configuration.rb +519 -0
- data/lib/geoblacklight/download/hgl_download.rb +5 -0
- data/lib/geoblacklight/engine.rb +14 -0
- data/lib/geoblacklight/geometry.rb +7 -0
- data/lib/geoblacklight/item_viewer.rb +8 -1
- data/lib/geoblacklight/references.rb +15 -0
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight/view_helper_override.rb +12 -1
- data/lib/geoblacklight.rb +17 -0
- data/lib/tasks/geoblacklight.rake +17 -0
- data/package.json +3 -2
- data/spec/features/configurable_basemap_spec.rb +56 -0
- data/spec/lib/geoblacklight/deprecated_configuration_spec.rb +597 -0
- data/spec/lib/geoblacklight/geometry_spec.rb +15 -0
- data/spec/lib/geoblacklight/references_spec.rb +24 -0
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +16 -0
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +48 -0
- metadata +12 -13
data/lib/geoblacklight.rb
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "active_support/dependencies"
|
|
4
|
+
require "active_support/deprecation"
|
|
4
5
|
require "geoblacklight/engine"
|
|
5
6
|
|
|
6
7
|
module Geoblacklight
|
|
8
|
+
# Deprecator for GeoBlacklight's own deprecations. Anything deprecated here is
|
|
9
|
+
# slated for removal in GeoBlacklight 5.0.
|
|
10
|
+
#
|
|
11
|
+
# Downstream applications can configure its behavior the same way they would any
|
|
12
|
+
# other Rails deprecator, e.g. in config/application.rb:
|
|
13
|
+
#
|
|
14
|
+
# config.active_support.deprecation = :raise
|
|
15
|
+
#
|
|
16
|
+
# or directly:
|
|
17
|
+
#
|
|
18
|
+
# Geoblacklight.deprecation.behavior = :silence
|
|
19
|
+
def self.deprecation
|
|
20
|
+
@deprecation ||= ActiveSupport::Deprecation.new("5.0", "GeoBlacklight")
|
|
21
|
+
end
|
|
22
|
+
|
|
7
23
|
require "geoblacklight/bounding_box"
|
|
8
24
|
require "geoblacklight/constants"
|
|
25
|
+
require "geoblacklight/deprecated_configuration"
|
|
9
26
|
require "geoblacklight/exceptions"
|
|
10
27
|
require "geoblacklight/geometry"
|
|
11
28
|
require "geoblacklight/view_helper_override"
|
|
@@ -24,6 +24,9 @@ namespace :geoblacklight do
|
|
|
24
24
|
|
|
25
25
|
desc "Run Solr and GeoBlacklight for interactive development with Webpack enabled"
|
|
26
26
|
task :webpack do |_t|
|
|
27
|
+
Geoblacklight.deprecation.warn(
|
|
28
|
+
"The geoblacklight:webpack rake task is deprecated and will be removed without replacement in GeoBlacklight 5"
|
|
29
|
+
)
|
|
27
30
|
require "solr_wrapper"
|
|
28
31
|
SolrWrapper.wrap(port: "8983") do |solr|
|
|
29
32
|
solr.with_collection(name: "blacklight-core", dir: File.join(File.expand_path("../../", File.dirname(__FILE__)), "solr", "conf")) do
|
|
@@ -48,6 +51,11 @@ namespace :geoblacklight do
|
|
|
48
51
|
docs = []
|
|
49
52
|
|
|
50
53
|
if args.remote
|
|
54
|
+
Geoblacklight.deprecation.warn(
|
|
55
|
+
"The [:remote] argument to geoblacklight:index:seed is deprecated and will be " \
|
|
56
|
+
"removed in GeoBlacklight 5; the task always indexes the fixtures bundled with " \
|
|
57
|
+
"the installed gem"
|
|
58
|
+
)
|
|
51
59
|
puts "Indexing - Remote test fixtures"
|
|
52
60
|
JSON.parse(
|
|
53
61
|
URI.parse("https://api.github.com/repos/geoblacklight/geoblacklight/contents/spec/fixtures/solr_documents").open.read
|
|
@@ -67,6 +75,9 @@ namespace :geoblacklight do
|
|
|
67
75
|
|
|
68
76
|
desc "Ingests a GeoHydra transformed.json"
|
|
69
77
|
task ingest_all: :environment do
|
|
78
|
+
Geoblacklight.deprecation.warn(
|
|
79
|
+
"The geoblacklight:index:ingest_all rake task is deprecated and will be removed without replacement in GeoBlacklight 5"
|
|
80
|
+
)
|
|
70
81
|
docs = JSON.parse(File.read(Rails.root.join("tmp", "transformed.json")))
|
|
71
82
|
docs.each do |doc|
|
|
72
83
|
Blacklight.default_index.connection.add doc
|
|
@@ -76,6 +87,9 @@ namespace :geoblacklight do
|
|
|
76
87
|
|
|
77
88
|
desc "Ingests a directory of geoblacklight.json files"
|
|
78
89
|
task :ingest, [:directory] => :environment do |_t, args|
|
|
90
|
+
Geoblacklight.deprecation.warn(
|
|
91
|
+
"The geoblacklight:index:ingest rake task is deprecated and will be removed without replacement in GeoBlacklight 5"
|
|
92
|
+
)
|
|
79
93
|
args.with_defaults(directory: "data")
|
|
80
94
|
Dir.glob(File.join(args[:directory], "**", "geoblacklight.json")).each do |fn|
|
|
81
95
|
puts "Ingesting #{fn}"
|
|
@@ -121,6 +135,9 @@ namespace :geoblacklight do
|
|
|
121
135
|
namespace :solr do
|
|
122
136
|
desc "Put sample data into solr"
|
|
123
137
|
task seed: :environment do
|
|
138
|
+
Geoblacklight.deprecation.warn(
|
|
139
|
+
"The geoblacklight:solr:seed rake task is deprecated and will be removed in GeoBlacklight 5; use geoblacklight:index:seed instead"
|
|
140
|
+
)
|
|
124
141
|
Rake::Task["geoblacklight:index:seed"].invoke
|
|
125
142
|
end
|
|
126
143
|
end
|
data/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geoblacklight/frontend",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.7.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"@samvera/clover-iiif": "^2.3.2",
|
|
29
29
|
"ol": "8.1.0",
|
|
30
30
|
"ol-pmtiles": "^0.3.0",
|
|
31
|
-
"react": "^18.2.0"
|
|
31
|
+
"react": "^18.2.0",
|
|
32
|
+
"react-dom": "^18.2.0"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"vite": "^5.0.0"
|
|
@@ -34,4 +34,60 @@ feature "Configurable basemap", js: true do
|
|
|
34
34
|
expect(page).to have_css "img[src*='hot']"
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
|
+
feature "with a configured tile URL for a shipped basemap" do
|
|
38
|
+
before do
|
|
39
|
+
CatalogController.blacklight_config.basemap_provider = "positron"
|
|
40
|
+
Settings.LEAFLET.BASEMAPS = {
|
|
41
|
+
positron: {
|
|
42
|
+
url: "https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png?key=fake-carto-key"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
after { Settings.LEAFLET.BASEMAPS = nil }
|
|
47
|
+
|
|
48
|
+
scenario "requests tiles from the configured URL" do
|
|
49
|
+
visit root_path
|
|
50
|
+
expect(page).to have_css "img[src*='key=fake-carto-key']"
|
|
51
|
+
end
|
|
52
|
+
scenario "keeps the attribution from the shipped definition" do
|
|
53
|
+
visit root_path
|
|
54
|
+
expect(page).to have_css ".leaflet-control-attribution", text: "Carto"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
feature "with a basemap the application defines itself" do
|
|
58
|
+
before do
|
|
59
|
+
CatalogController.blacklight_config.basemap_provider = "myBasemap"
|
|
60
|
+
Settings.LEAFLET.BASEMAPS = {
|
|
61
|
+
myBasemap: {
|
|
62
|
+
url: "/tiles/{z}/{x}/{y}.png",
|
|
63
|
+
attribution: "Tiles courtesy of Example University",
|
|
64
|
+
maxZoom: 18
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
after { Settings.LEAFLET.BASEMAPS = nil }
|
|
69
|
+
|
|
70
|
+
scenario "requests tiles from the application's basemap" do
|
|
71
|
+
visit root_path
|
|
72
|
+
# visible: :all because these tiles 404, so the images have no dimensions
|
|
73
|
+
expect(page).to have_css "img[src*='/tiles/']", visible: :all
|
|
74
|
+
end
|
|
75
|
+
scenario "credits the application's basemap" do
|
|
76
|
+
visit root_path
|
|
77
|
+
expect(page).to have_css ".leaflet-control-attribution",
|
|
78
|
+
text: "Tiles courtesy of Example University"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
feature "using a basemap GeoBlacklight no longer ships" do
|
|
82
|
+
before do
|
|
83
|
+
# worldEco was one of the CARTO basemaps served from the retired
|
|
84
|
+
# cartocdn fastly endpoints; applications still naming one should get a
|
|
85
|
+
# working basemap rather than none
|
|
86
|
+
CatalogController.blacklight_config.basemap_provider = "worldEco"
|
|
87
|
+
end
|
|
88
|
+
scenario "falls back to positron rather than drawing no basemap" do
|
|
89
|
+
visit root_path
|
|
90
|
+
expect(page).to have_css "img[src*='light_all']", visible: :all
|
|
91
|
+
end
|
|
92
|
+
end
|
|
37
93
|
end
|