geoblacklight 5.2.0 → 5.4.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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +4 -4
  3. data/app/assets/stylesheets/geoblacklight/modules/item.scss +20 -3
  4. data/app/components/geoblacklight/accordion_component.html.erb +16 -0
  5. data/app/components/geoblacklight/accordion_component.rb +11 -0
  6. data/app/components/geoblacklight/attribute_table_component.html.erb +15 -17
  7. data/app/components/geoblacklight/document/sidebar_component.html.erb +3 -0
  8. data/app/components/geoblacklight/document/sidebar_component.rb +7 -0
  9. data/app/components/geoblacklight/download_links_component.html.erb +3 -0
  10. data/app/components/geoblacklight/download_links_component.rb +1 -1
  11. data/app/components/geoblacklight/index_map_inspect_component.html.erb +4 -3
  12. data/app/components/geoblacklight/item_map_viewer_component.rb +2 -2
  13. data/app/components/geoblacklight/location_leaflet_map_component.rb +2 -2
  14. data/app/components/geoblacklight/relations_component.html.erb +1 -1
  15. data/app/components/geoblacklight/static_map_component.rb +2 -2
  16. data/app/controllers/download_controller.rb +6 -0
  17. data/app/controllers/relation_controller.rb +1 -1
  18. data/app/helpers/geoblacklight_helper.rb +31 -3
  19. data/app/javascript/geoblacklight/controllers/leaflet_viewer_controller.js +35 -6
  20. data/app/javascript/geoblacklight/controllers/openlayers_viewer_controller.js +33 -2
  21. data/app/javascript/geoblacklight/leaflet/basemaps.js +0 -32
  22. data/app/javascript/geoblacklight/leaflet/controls/sidebar.js +47 -0
  23. data/app/javascript/geoblacklight/leaflet/inspection.js +5 -4
  24. data/app/javascript/geoblacklight/openlayers/basemaps.js +0 -20
  25. data/app/javascript/geoblacklight/openlayers/layers.js +1 -1
  26. data/app/models/concerns/geoblacklight/solr_document.rb +19 -2
  27. data/app/views/catalog/_metadata.html.erb +3 -0
  28. data/config/importmap.rb +4 -10
  29. data/config/locales/geoblacklight.en.yml +1 -0
  30. data/geoblacklight.gemspec +2 -2
  31. data/lib/generators/geoblacklight/assets/importmap_generator.rb +10 -7
  32. data/lib/generators/geoblacklight/assets/vite_generator.rb +9 -2
  33. data/lib/generators/geoblacklight/assets_generator.rb +2 -2
  34. data/lib/generators/geoblacklight/templates/assets/application.scss +1 -1
  35. data/lib/generators/geoblacklight/templates/catalog_controller.rb +4 -5
  36. data/lib/generators/geoblacklight/templates/settings.yml +20 -0
  37. data/lib/geoblacklight/deprecated_configuration.rb +665 -0
  38. data/lib/geoblacklight/download.rb +3 -0
  39. data/lib/geoblacklight/engine.rb +13 -0
  40. data/lib/geoblacklight/references.rb +6 -1
  41. data/lib/geoblacklight/relation/ancestors.rb +3 -0
  42. data/lib/geoblacklight/relation/descendants.rb +3 -0
  43. data/lib/geoblacklight/relation/relation_response.rb +4 -1
  44. data/lib/geoblacklight/version.rb +1 -1
  45. data/lib/geoblacklight.rb +16 -0
  46. data/lib/tasks/geoblacklight.rake +9 -0
  47. data/package.json +4 -7
  48. data/schema/geoblacklight-schema-aardvark.json +2 -2
  49. data/solr/conf/solrconfig.xml +10 -10
  50. data/spec/features/configurable_basemap_spec.rb +68 -0
  51. data/spec/features/full_screen_control_spec.rb +4 -6
  52. data/spec/features/relations_spec.rb +2 -3
  53. data/spec/features/saved_searches_spec.rb +1 -8
  54. data/spec/lib/geoblacklight/deprecated_configuration_spec.rb +680 -0
  55. data/spec/solr_config_spec.rb +41 -0
  56. data/spec/spec_helper.rb +24 -1
  57. data/vite.config.ts +0 -3
  58. metadata +15 -10
  59. data/test/leaflet/layers.test.js +0 -17
@@ -14,26 +14,6 @@ export default {
14
14
  attributions: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributionss">Carto</a>',
15
15
  maxZoom: 18
16
16
  },
17
- worldAntique: {
18
- url: 'https://cartocdn_{a-d}.global.ssl.fastly.net/base-antique/{z}/{x}/{y}.png',
19
- attributions: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributionss">Carto</a>',
20
- maxZoom: 18
21
- },
22
- worldEco: {
23
- url: 'https://cartocdn_{a-d}.global.ssl.fastly.net/base-eco/{z}/{x}/{y}.png',
24
- attributions: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributionss">Carto</a>',
25
- maxZoom: 18
26
- },
27
- flatBlue: {
28
- url: 'https://cartocdn_{a-d}.global.ssl.fastly.net/base-flatblue/{z}/{x}/{y}.png',
29
- attributions: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributionss">Carto</a>',
30
- maxZoom: 18
31
- },
32
- midnightCommander: {
33
- url: 'https://cartocdn_{a-d}.global.ssl.fastly.net/base-midnight/{z}/{x}/{y}.png',
34
- attributions: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributionss">Carto</a>',
35
- maxZoom: 18
36
- },
37
17
  openstreetmapHot: {
38
18
  url: 'https://{a-c}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
39
19
  attributions: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>',
@@ -38,7 +38,7 @@ export const cogLayer = (url) => {
38
38
  return new WebGLTileLayer({
39
39
  source: new GeoTIFF({
40
40
  sources: [{ url }],
41
- convertToRGB: true,
41
+ convertToRGB: "auto",
42
42
  }),
43
43
  });
44
44
  };
@@ -31,6 +31,22 @@ module Geoblacklight
31
31
  attribute :format, :string, Settings.FIELDS.FORMAT
32
32
  end
33
33
 
34
+ ##
35
+ # Warn once per reader name rather than once per document: a search results page
36
+ # would otherwise emit one warning per result, because
37
+ # ActiveSupport::Deprecation does not deduplicate.
38
+ # @param method [Symbol]
39
+ def self.warn_about_url_reader(method)
40
+ @warned_url_readers ||= Set.new
41
+ return unless @warned_url_readers.add?(method)
42
+
43
+ Geoblacklight.deprecation.warn(
44
+ "SolrDocument##{method} is resolved dynamically by Geoblacklight::SolrDocument#method_missing, " \
45
+ "which GeoBlacklight 6 removes; call references.#{method.to_s.delete_suffix("_url")}&.endpoint " \
46
+ "instead"
47
+ )
48
+ end
49
+
34
50
  def available?
35
51
  public? || same_institution?
36
52
  end
@@ -44,7 +60,7 @@ module Geoblacklight
44
60
  end
45
61
 
46
62
  def downloadable?
47
- (direct_download || download_types.present? || iiif_download) && available?
63
+ Geoblacklight.deprecation.silence { direct_download || download_types.present? || iiif_download } && available?
48
64
  end
49
65
 
50
66
  def references
@@ -101,7 +117,8 @@ module Geoblacklight
101
117
 
102
118
  def method_missing(method, *args, &block)
103
119
  if /.*_url$/.match?(method.to_s)
104
- checked_endpoint(method.to_s.gsub("_url", ""))
120
+ Geoblacklight::SolrDocument.warn_about_url_reader(method)
121
+ Geoblacklight.deprecation.silence { checked_endpoint(method.to_s.gsub("_url", "")) }
105
122
  else
106
123
  super
107
124
  end
@@ -1,3 +1,5 @@
1
+ <%# Removed in GeoBlacklight 6. The deprecated helpers it calls are silenced here so that a stock application is not warned once per request; Geoblacklight::DeprecatedConfiguration warns at boot if an application overrides it. %>
2
+ <% Geoblacklight.deprecation.silence do %>
1
3
  <% document ||= @documents.first %>
2
4
 
3
5
  <div class='metadata-view'>
@@ -25,3 +27,4 @@
25
27
  <% end %>
26
28
  </div>
27
29
  </div>
30
+ <% end %>
data/config/importmap.rb CHANGED
@@ -3,18 +3,12 @@
3
3
  # OpenLayers viewer
4
4
  pin "ol", to: "https://esm.sh/ol@8.1.0"
5
5
  pin "ol/", to: "https://esm.sh/ol@8.1.0/"
6
- pin "ol-pmtiles", to: "https://cdn.skypack.dev/ol-pmtiles@0.3.0"
6
+ pin "ol-pmtiles", to: "https://cdn.jsdelivr.net/npm/ol-pmtiles@0.3.0/+esm"
7
7
 
8
8
  # Leaflet viewer
9
- pin "leaflet", to: "https://cdn.skypack.dev/leaflet@1.9.4"
10
- pin "esri-leaflet", to: "https://cdn.skypack.dev/esri-leaflet@3.0.12"
11
- pin "leaflet-fullscreen", to: "https://cdn.skypack.dev/leaflet-fullscreen@1.0.2"
12
-
13
- # Clover viewer
14
- pin "react", to: "https://esm.sh/react@18.3.1"
15
- pin "react-dom/client", to: "https://esm.sh/react-dom@18.3.1/client"
16
- pin "@samvera/clover-iiif/viewer", to: "https://esm.sh/@samvera/clover-iiif@2.10.0/dist/viewer"
17
- pin "@samvera/clover-iiif/image", to: "https://esm.sh/@samvera/clover-iiif@2.10.0/dist/image"
9
+ pin "leaflet", to: "https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet-src.esm.js"
10
+ pin "esri-leaflet", to: "https://cdn.jsdelivr.net/npm/esri-leaflet@3.0.19/+esm"
11
+ pin "leaflet.fullscreen", to: "https://cdn.jsdelivr.net/npm/leaflet.fullscreen@5.3.0/+esm"
18
12
 
19
13
  # Geoblacklight
20
14
  pin_all_from Geoblacklight::Engine.root.join("app", "javascript", "geoblacklight"), under: "geoblacklight"
@@ -93,6 +93,7 @@ en:
93
93
  attribute: 'Attribute'
94
94
  value: 'Value'
95
95
  click_map: 'Click on map to inspect values'
96
+ table_name: 'Map data'
96
97
  help_text:
97
98
  viewer_protocol:
98
99
  cog:
@@ -35,11 +35,11 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "rspec-rails"
36
36
  spec.add_development_dependency "engine_cart", "~> 2.0"
37
37
  spec.add_development_dependency "capybara", ">= 2.5.0"
38
- spec.add_development_dependency "selenium-webdriver"
38
+ spec.add_development_dependency "selenium-webdriver", ">= 4.11"
39
39
  spec.add_development_dependency "factory_bot_rails"
40
40
  spec.add_development_dependency "simplecov", "~> 0.22"
41
41
  spec.add_development_dependency "foreman"
42
- spec.add_development_dependency "standardrb", "1.0.1"
42
+ spec.add_development_dependency "standard", "~> 1.56.0"
43
43
  spec.add_development_dependency "webmock", "~> 3.14"
44
44
  spec.add_development_dependency "database_cleaner"
45
45
  spec.add_development_dependency "axe-core-rspec"
@@ -21,16 +21,19 @@ module Geoblacklight
21
21
  delivered via CDN.
22
22
  DESCRIPTION
23
23
 
24
- # Switch bootstrap import to ESM version so we can import individual parts
24
+ # Switch Blacklight's bootstrap and popper imports to ESM versions so we
25
+ # can import individual modules
25
26
  def use_bootstrap_esm
26
- gsub_file "config/importmap.rb", /dist\/js\/bootstrap\.js/, "dist/js/bootstrap.esm.js"
27
+ gsub_file "config/importmap.rb", %r{dist/js/bootstrap.js}, "dist/js/bootstrap.esm.js"
28
+ gsub_file "config/importmap.rb", %r{dist/umd/popper.min.js}, "dist/esm/popper.js"
27
29
  end
28
30
 
29
- # Add the customization overrides and insert before bootstrap import
31
+ # Add the SCSS customization overrides and insert before bootstrap import
30
32
  def add_customizations
31
33
  copy_file "assets/_customizations.scss", "app/assets/stylesheets/_customizations.scss"
32
34
  gsub_file "app/assets/stylesheets/_customizations.scss", "@geoblacklight/frontend/app/assets/", ""
33
- insert_into_file "app/assets/stylesheets/application.bootstrap.scss", "@import 'customizations';\n", before: "@import 'bootstrap/scss/bootstrap';"
35
+ insert_into_file "app/assets/stylesheets/application.bootstrap.scss", "@import 'customizations';\n",
36
+ before: "@import 'bootstrap/scss/bootstrap';"
34
37
  end
35
38
 
36
39
  # Add CDN imports for CSS files used by Geoblacklight (leaflet, openlayers)
@@ -38,9 +41,9 @@ module Geoblacklight
38
41
  insert_into_file "app/assets/stylesheets/application.bootstrap.scss", before: "@import 'customizations';\n" do
39
42
  <<~SCSS
40
43
  /* GeoBlacklight dependencies CSS */
41
- @import url("https://cdn.skypack.dev/leaflet@1.9.4/dist/leaflet.css");
42
- @import url("https://cdn.jsdelivr.net/npm/leaflet-fullscreen@1.0.2/dist/leaflet.fullscreen.css");
43
- @import url("https://cdn.skypack.dev/ol@8.1.0/ol.css");
44
+ @import url("https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.css");
45
+ @import url("https://cdn.jsdelivr.net/npm/leaflet.fullscreen@5.3.0/dist/Control.FullScreen.css");
46
+ @import url("https://cdn.jsdelivr.net/npm/ol@8.1.0/ol.css");
44
47
 
45
48
  SCSS
46
49
  end
@@ -16,8 +16,8 @@ module Geoblacklight
16
16
  SCSS entrypoint file, which will be bundled by Vite.
17
17
 
18
18
  Geoblacklight's frontend assets are installed from the npm package. In
19
- local development they automatically reference the versions from the
20
- outer directory (the Geoblacklight repository) via a yarn symlink.
19
+ CI they automatically reference the versions from the outer directory
20
+ (the Geoblacklight repository) via a yarn symlink.
21
21
  DESCRIPTION
22
22
 
23
23
  # Install Vite
@@ -26,6 +26,13 @@ module Geoblacklight
26
26
  run "bundle install"
27
27
  end
28
28
 
29
+ # Symlink geoblacklight's frontend assets in CI
30
+ def link_geoblacklight_package
31
+ if options[:test]
32
+ run "yarn link @geoblacklight/frontend"
33
+ end
34
+ end
35
+
29
36
  # Add our version of the Blacklight base layout with Vite helper tags
30
37
  def geoblacklight_base_layout
31
38
  copy_file "base.html.erb", "app/views/layouts/blacklight/base.html.erb"
@@ -4,7 +4,7 @@ module Geoblacklight
4
4
  # Run general asset setup and then delegate to the appropriate generator
5
5
  # Based on Blacklight::AssetsGenerator
6
6
  class AssetsGenerator < Rails::Generators::Base
7
- class_option :"asset-pipeline", type: :string, default: ENV.fetch("ASSET_PIPELINE", "vite"), desc: "Choose the asset pipeline to use (vite or importmap)"
7
+ class_option :"asset-pipeline", type: :string, default: ENV.fetch("ASSET_PIPELINE", "importmap"), desc: "Choose the asset pipeline to use (vite or importmap)"
8
8
  class_option :test, type: :boolean, default: ENV.fetch("CI", false), aliases: "-t", desc: "Indicates that app will be installed in a test environment"
9
9
 
10
10
  # Pick a version of the frontend asset package and install it.
@@ -27,7 +27,7 @@ module Geoblacklight
27
27
  generator = if options[:"asset-pipeline"]
28
28
  "geoblacklight:assets:#{options[:"asset-pipeline"]}"
29
29
  else
30
- "geoblacklight:assets:vite"
30
+ "geoblacklight:assets:importmap"
31
31
  end
32
32
 
33
33
  generate generator, generated_options
@@ -2,7 +2,7 @@
2
2
 
3
3
  // Leaflet, OpenLayers, GeoBlacklight (includes Blacklight and Bootstrap)
4
4
  @import "leaflet/dist/leaflet.css";
5
- @import "leaflet-fullscreen/dist/leaflet.fullscreen.css";
5
+ @import "leaflet.fullscreen/dist/Control.FullScreen.css";
6
6
  @import "ol/ol.css";
7
7
  @import "~/stylesheets/geoblacklight.scss";
8
8
 
@@ -224,7 +224,7 @@ class CatalogController < ApplicationController
224
224
 
225
225
  config.add_search_field "all_fields", label: "All Fields"
226
226
  # config.add_search_field 'dct_title_ti', :label => 'Title'
227
- # config.add_search_field 'dct_description_ti', :label => 'Description'
227
+ # config.add_search_field 'dct_description_tmi', :label => 'Description'
228
228
 
229
229
  # Now we see how to over-ride Solr request handler defaults, in this
230
230
  # case for a BL "search field", which is really a dismax aggregate
@@ -309,12 +309,11 @@ class CatalogController < ApplicationController
309
309
  # 'positron'
310
310
  # 'darkMatter'
311
311
  # 'positronLite'
312
- # 'worldAntique'
313
- # 'worldEco'
314
- # 'flatBlue'
315
- # 'midnightCommander'
316
312
  # 'openstreetmapHot'
317
313
  # 'openstreetmapStandard'
314
+ #
315
+ # To change one of these basemaps' tile URLs, or to add a basemap of your
316
+ # own and name it here, set LEAFLET.BASEMAPS in settings.yml
318
317
 
319
318
  config.basemap_provider = "positron"
320
319
 
@@ -231,6 +231,25 @@ WMS_PARAMS:
231
231
  # Settings for leaflet
232
232
  LEAFLET:
233
233
  MAP:
234
+ # Basemap definitions, keyed by the name config.basemap_provider selects.
235
+ # Anything set here is merged over the basemap GeoBlacklight ships with, so
236
+ # you can change just the url and keep the rest of the definition.
237
+ #
238
+ # CARTO now watermarks raster tiles requested without an API key, which
239
+ # affects the positron, positronLite and darkMatter basemaps. Request a free
240
+ # key at https://carto.com/basemaps/apikey/ and pass it as a key parameter:
241
+ # BASEMAPS:
242
+ # positron:
243
+ # url: 'https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png?key=YOUR_KEY'
244
+ # darkMatter:
245
+ # url: 'https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png?key=YOUR_KEY'
246
+ #
247
+ # You can also define a basemap of your own here and select it with
248
+ # config.basemap_provider = 'myBasemap' in your CatalogController:
249
+ # myBasemap:
250
+ # url: 'https://tiles.example.edu/{z}/{x}/{y}.png'
251
+ # attribution: 'Tiles courtesy of Example University'
252
+ # maxZoom: 18
234
253
  BOUNDSOVERLAY:
235
254
  INDEX:
236
255
  color: '#3388ff'
@@ -247,6 +266,7 @@ LEAFLET:
247
266
  HOVERTOWAKE: false
248
267
  MESSAGE: 'Click to Wake'
249
268
  BACKGROUND: 'rgba(214, 214, 214, .7)'
269
+ SIDEBAR: false # set to true to display attribute table as sidebar on map
250
270
  LAYERS:
251
271
  DETECT_RETINA: true
252
272
  INDEX: