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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/Gemfile +0 -1
  4. data/app/assets/javascripts/geoblacklight/basemaps.js +60 -82
  5. data/app/assets/javascripts/geoblacklight/viewers/map.js +22 -5
  6. data/app/controllers/download_controller.rb +5 -0
  7. data/app/controllers/relation_controller.rb +1 -0
  8. data/app/helpers/arcgis_helper.rb +3 -0
  9. data/app/helpers/blacklight_helper.rb +4 -0
  10. data/app/helpers/carto_helper.rb +5 -0
  11. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +7 -1
  12. data/app/helpers/geoblacklight_helper.rb +74 -21
  13. data/app/javascript/openlayers/basemaps.js +0 -20
  14. data/app/javascript/openlayers/ol_initializer.js +27 -2
  15. data/app/models/concerns/geoblacklight/solr_document/carto.rb +7 -0
  16. data/app/models/concerns/geoblacklight/solr_document/citation.rb +7 -0
  17. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -1
  18. data/app/models/concerns/geoblacklight/solr_document.rb +30 -2
  19. data/app/presenters/geoblacklight/document_presenter.rb +9 -0
  20. data/app/views/catalog/_arcgis.html.erb +1 -1
  21. data/app/views/catalog/_carto.html.erb +1 -1
  22. data/app/views/catalog/_downloads_collapse.html.erb +3 -0
  23. data/app/views/catalog/_index_split_default.html.erb +1 -1
  24. data/app/views/catalog/_show_default_attribute_table.html.erb +1 -1
  25. data/app/views/catalog/_show_default_viewer_container.html.erb +3 -3
  26. data/app/views/catalog/_show_downloads.html.erb +3 -0
  27. data/app/views/catalog/_show_sidebar.html.erb +1 -1
  28. data/app/views/catalog/_show_sidebar_static_map.html.erb +3 -0
  29. data/app/views/catalog/_web_services.html.erb +1 -1
  30. data/geoblacklight.gemspec +2 -2
  31. data/lib/generators/geoblacklight/install_generator.rb +1 -1
  32. data/lib/generators/geoblacklight/templates/catalog_controller.rb +3 -4
  33. data/lib/generators/geoblacklight/templates/settings.yml +19 -0
  34. data/lib/geoblacklight/deprecated_configuration.rb +519 -0
  35. data/lib/geoblacklight/download/hgl_download.rb +5 -0
  36. data/lib/geoblacklight/engine.rb +14 -0
  37. data/lib/geoblacklight/geometry.rb +7 -0
  38. data/lib/geoblacklight/item_viewer.rb +8 -1
  39. data/lib/geoblacklight/references.rb +15 -0
  40. data/lib/geoblacklight/version.rb +1 -1
  41. data/lib/geoblacklight/view_helper_override.rb +12 -1
  42. data/lib/geoblacklight.rb +17 -0
  43. data/lib/tasks/geoblacklight.rake +17 -0
  44. data/package.json +3 -2
  45. data/spec/features/configurable_basemap_spec.rb +56 -0
  46. data/spec/lib/geoblacklight/deprecated_configuration_spec.rb +597 -0
  47. data/spec/lib/geoblacklight/geometry_spec.rb +15 -0
  48. data/spec/lib/geoblacklight/references_spec.rb +24 -0
  49. data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
  50. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +16 -0
  51. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +48 -0
  52. metadata +12 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70ec0fdb43d31e4d9c2d4d5902e5a5d19ea35a6171e6b37f74d9a3fbfd937661
4
- data.tar.gz: f4b212c5ec24ee1c4c0263e8c0e1ba2c51c0ebcd7e70cf32ae5ccfe6e0a78d15
3
+ metadata.gz: 34179258d33036e78dd04f3b8f5afc47b365bd3daba81c8873c48f97054ad8bf
4
+ data.tar.gz: b8302cd7bca3144905fb54aaa06f8d1999e96c6efebcde45046830e45031e1c6
5
5
  SHA512:
6
- metadata.gz: 9a6612a445ce525cd2610b4cc0c83a509a523b13e27ea3ee6314ee5f48cbb6da479f9e103c50ae75312911780e39740db155c9d1b6015a05e5dddd71e2237710
7
- data.tar.gz: 0fc319d965119d9d7dd79456930fd6f4c32288d68967b9f408adf2da44c4096c7e99f39fe8e575021ef515f705a69e61f7513869774d7a87373972bcbfebebaa
6
+ metadata.gz: 7572c629e6892753b88b05c32b3acbbdb9c2251a03373049139d523941c0c732b3a79116ba804f0b432e4bf0715b15b8558013251d714c1ab420271b6d6961d8
7
+ data.tar.gz: 5843078946e57b56b0717b25c403244e972b0d45c2b97276861506266c1e94e01c8443e0c022dd0a4f3f4c4daad60291525a7b818b925c08a2669153c6f89ce9
@@ -14,7 +14,7 @@ jobs:
14
14
  - name: Set up Ruby
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: 2.7
17
+ ruby-version: '3.2'
18
18
  - name: Install dependencies
19
19
  run: bundle install
20
20
  - name: Run linter
data/Gemfile CHANGED
@@ -18,7 +18,6 @@ group :test do
18
18
  gem "rspec-rails", require: false
19
19
  gem "simplecov", require: false
20
20
  gem "standardrb", require: false
21
- gem "webdrivers", require: false
22
21
  gem "webmock", require: false
23
22
  end
24
23
 
@@ -1,85 +1,63 @@
1
1
  // basemaps
2
2
 
3
- GeoBlacklight.Basemaps = {
4
- darkMatter: L.tileLayer(
5
- 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{retina}.png', {
6
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
7
- maxZoom: 18,
8
- worldCopyJump: true,
9
- retina: '@2x',
10
- detectRetina: false
11
- }
12
- ),
13
- positron: L.tileLayer(
14
- 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{retina}.png', {
15
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
16
- maxZoom: 18,
17
- worldCopyJump: true,
18
- retina: '@2x',
19
- detectRetina: false
20
- }
21
- ),
22
- positronLite: L.tileLayer(
23
- 'https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{retina}.png', {
24
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
25
- maxZoom: 18,
26
- worldCopyJump: true,
27
- retina: '@2x',
28
- detectRetina: false
29
- }
30
- ),
31
- worldAntique: L.tileLayer(
32
- 'https://cartocdn_{s}.global.ssl.fastly.net/base-antique/{z}/{x}/{y}{retina}.png', {
33
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
34
- maxZoom: 18,
35
- worldCopyJump: true,
36
- retina: '@2x',
37
- detectRetina: false
38
- }
39
- ),
40
- worldEco: L.tileLayer(
41
- 'https://cartocdn_{s}.global.ssl.fastly.net/base-eco/{z}/{x}/{y}{retina}.png', {
42
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
43
- maxZoom: 18,
44
- worldCopyJump: true,
45
- retina: '@2x',
46
- detectRetina: false
47
- }
48
- ),
49
- flatBlue: L.tileLayer(
50
- 'https://cartocdn_{s}.global.ssl.fastly.net/base-flatblue/{z}/{x}/{y}{retina}.png', {
51
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
52
- maxZoom: 18,
53
- worldCopyJump: true,
54
- retina: '@2x',
55
- detectRetina: false
56
- }
57
- ),
58
- midnightCommander: L.tileLayer(
59
- 'https://cartocdn_{s}.global.ssl.fastly.net/base-midnight/{z}/{x}/{y}{retina}.png', {
60
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
61
- maxZoom: 18,
62
- worldCopyJump: true,
63
- retina: '@2x',
64
- detectRetina: false
65
- }
66
- ),
67
- openstreetmapHot: L.tileLayer(
68
- 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
69
- attribution: '&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>',
70
- maxZoom: 19,
71
- worldCopyJump: true,
72
- retina: '@2x',
73
- detectRetina: false
74
- }
75
- ),
76
- openstreetmapStandard: L.tileLayer(
77
- 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
78
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
79
- maxZoom: 19,
80
- worldCopyJump: true,
81
- retina: '@2x',
82
- detectRetina: false
83
- }
84
- )
3
+ /**
4
+ * Raster XYZ tile definitions for the basemaps GeoBlacklight ships with. Each
5
+ * definition is passed to L.tileLayer as its options, so it carries the URL
6
+ * template alongside the layer options it needs.
7
+ *
8
+ * Applications can change any of these, or add their own, by setting
9
+ * LEAFLET.BASEMAPS in settings.yml. See selectBasemap in viewers/map.js.
10
+ */
11
+ GeoBlacklight.BasemapDefinitions = {
12
+ darkMatter: {
13
+ url: 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{retina}.png',
14
+ attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
15
+ maxZoom: 18,
16
+ worldCopyJump: true,
17
+ retina: '@2x',
18
+ detectRetina: false
19
+ },
20
+ positron: {
21
+ url: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{retina}.png',
22
+ attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
23
+ maxZoom: 18,
24
+ worldCopyJump: true,
25
+ retina: '@2x',
26
+ detectRetina: false
27
+ },
28
+ positronLite: {
29
+ url: 'https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{retina}.png',
30
+ attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
31
+ maxZoom: 18,
32
+ worldCopyJump: true,
33
+ retina: '@2x',
34
+ detectRetina: false
35
+ },
36
+ openstreetmapHot: {
37
+ url: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
38
+ attribution: '&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>',
39
+ maxZoom: 19,
40
+ worldCopyJump: true,
41
+ retina: '@2x',
42
+ detectRetina: false
43
+ },
44
+ openstreetmapStandard: {
45
+ url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
46
+ attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
47
+ maxZoom: 19,
48
+ worldCopyJump: true,
49
+ retina: '@2x',
50
+ detectRetina: false
51
+ }
85
52
  };
53
+
54
+ /**
55
+ * Layer instances for the shipped definitions. Kept so that applications
56
+ * referencing or replacing GeoBlacklight.Basemaps entries keep working.
57
+ */
58
+ GeoBlacklight.Basemaps = {};
59
+
60
+ Object.keys(GeoBlacklight.BasemapDefinitions).forEach(function(name) {
61
+ var definition = GeoBlacklight.BasemapDefinitions[name];
62
+ GeoBlacklight.Basemaps[name] = L.tileLayer(definition.url, definition);
63
+ });
@@ -65,13 +65,30 @@ GeoBlacklight.Viewer.Map = GeoBlacklight.Viewer.extend({
65
65
 
66
66
  /**
67
67
  * Selects basemap if specified in data options, if not return positron.
68
+ *
69
+ * Applications can change a basemap's URL -- to add a CARTO API key, for
70
+ * example -- or define basemaps of their own by setting LEAFLET.BASEMAPS in
71
+ * settings.yml. Those values are merged over the shipped definition, so an
72
+ * override that gives only a url keeps the shipped attribution and zoom.
68
73
  */
69
74
  selectBasemap: function() {
70
- var _this = this;
71
- if (_this.data.basemap) {
72
- return GeoBlacklight.Basemaps[_this.data.basemap];
73
- } else {
74
- return GeoBlacklight.Basemaps.positron;
75
+ var name = this.data.basemap || 'positron';
76
+ var options = this.data.leafletOptions || {};
77
+ var overrides = options.BASEMAPS || {};
78
+ var definition;
79
+
80
+ // A configured basemap wins, so an application can override a shipped one
81
+ if (overrides[name]) {
82
+ definition = L.extend(
83
+ {}, GeoBlacklight.BasemapDefinitions[name], overrides[name]
84
+ );
85
+ if (definition.url) {
86
+ return L.tileLayer(definition.url, definition);
87
+ }
75
88
  }
89
+
90
+ // Otherwise use the shipped layer, which an application may itself have
91
+ // replaced in GeoBlacklight.Basemaps
92
+ return GeoBlacklight.Basemaps[name] || GeoBlacklight.Basemaps.positron;
76
93
  }
77
94
  });
@@ -37,7 +37,12 @@ class DownloadController < ApplicationController
37
37
  send_file download_file_path_and_name, x_sendfile: true
38
38
  end
39
39
 
40
+ # @deprecated
40
41
  def hgl
42
+ Geoblacklight.deprecation.warn(
43
+ "DownloadController#hgl and the download_hgl route are deprecated; the Harvard " \
44
+ "Geospatial Library download integration is removed without replacement in GeoBlacklight 5"
45
+ )
41
46
  @response, @document = search_service.fetch params[:id]
42
47
  if params[:email]
43
48
  response = Geoblacklight::HglDownload.new(@document, params[:email]).get
@@ -2,6 +2,7 @@
2
2
 
3
3
  class RelationController < ApplicationController
4
4
  include Blacklight::Configurable
5
+
5
6
  # include Blacklight::SearchHelper
6
7
  copy_blacklight_config_from(CatalogController)
7
8
 
@@ -5,10 +5,13 @@ module ArcgisHelper
5
5
  # Generates an ArcGIS.com viewer url with params that can open content
6
6
  # directly
7
7
  # See: https://doc.arcgis.com/en/arcgis-online/reference/use-url-parameters.htm
8
+ # @deprecated
8
9
  def arcgis_link(arcgis_urls)
9
10
  params = URI.encode_www_form(
10
11
  urls: arcgis_urls
11
12
  )
12
13
  Settings.ARCGIS_BASE_URL + "?" + params
13
14
  end
15
+ Geoblacklight.deprecation.deprecate_methods(ArcgisHelper,
16
+ arcgis_link: "use Geoblacklight::ArcgisComponent instead")
14
17
  end
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # @deprecated GeoBlacklight 5 no longer ships a BlacklightHelper override. The
4
+ # relations container is rendered by Geoblacklight::Document::SidebarComponent
5
+ # instead. Applications that define their own BlacklightHelper are unaffected.
3
6
  module BlacklightHelper
4
7
  include Blacklight::BlacklightHelperBehavior
5
8
  include Geoblacklight::GeoblacklightHelperBehavior
6
9
  include Blacklight::CatalogHelperBehavior
7
10
 
11
+ # @deprecated
8
12
  def render_document_sidebar_partial(document = @document)
9
13
  super + (render "relations_container", document: document)
10
14
  end
@@ -5,6 +5,7 @@ module CartoHelper
5
5
  # Creates a Carto OneClick link, using the configuration link
6
6
  # @param [String] file_link
7
7
  # @return [String]
8
+ # @deprecated
8
9
  def carto_link(file_link)
9
10
  params = URI.encode_www_form(
10
11
  file: file_link,
@@ -17,9 +18,13 @@ module CartoHelper
17
18
  ##
18
19
  # Removes blank space from provider to accomodate Carto OneClick
19
20
  #
21
+ # @deprecated
20
22
  def carto_provider
21
23
  application_name.delete(" ")
22
24
  end
25
+ Geoblacklight.deprecation.deprecate_methods(CartoHelper,
26
+ carto_link: "the Carto OneClick integration is removed without replacement in GeoBlacklight 5",
27
+ carto_provider: "the Carto OneClick integration is removed without replacement in GeoBlacklight 5")
23
28
 
24
29
  private
25
30
 
@@ -3,6 +3,9 @@
3
3
  ##
4
4
  # Adds helper behavior logic for GeoBlacklight, to used alongside
5
5
  # BlacklightHelperBehavior
6
+ #
7
+ # @deprecated This module is removed in GeoBlacklight 5. Search result
8
+ # presentation moved to Geoblacklight::SearchResultComponent.
6
9
  module Geoblacklight
7
10
  module GeoblacklightHelperBehavior
8
11
  include Blacklight::BlacklightHelperBehavior
@@ -11,8 +14,11 @@ module Geoblacklight
11
14
  # Calls the presenter on the requested method
12
15
  # @param [Symbol, String] presenting_method
13
16
  # @return [String]
17
+ # @deprecated
14
18
  def geoblacklight_present(presenting_method, document = @document)
15
- document_presenter(document).try(presenting_method.to_sym) || ""
19
+ Geoblacklight.deprecation.silence { document_presenter(document).try(presenting_method.to_sym) } || ""
16
20
  end
21
+ Geoblacklight.deprecation.deprecate_methods(Geoblacklight::GeoblacklightHelperBehavior,
22
+ geoblacklight_present: "use Geoblacklight::SearchResultComponent instead")
17
23
  end
18
24
  end
@@ -5,14 +5,20 @@ module GeoblacklightHelper
5
5
  @document.public? || (@document.same_institution? && user_signed_in?)
6
6
  end
7
7
 
8
+ # @deprecated
8
9
  def document_downloadable?
9
10
  document_available? && @document.downloadable?
10
11
  end
11
12
 
13
+ # @deprecated
12
14
  def iiif_jpg_url
13
15
  @document.references.iiif.endpoint.sub! "info.json", "full/full/0/default.jpg"
14
16
  end
17
+ Geoblacklight.deprecation.deprecate_methods(GeoblacklightHelper,
18
+ document_downloadable?: "use Geoblacklight::DownloadLinksComponent instead",
19
+ iiif_jpg_url: "use Geoblacklight::DownloadLinksComponent instead")
15
20
 
21
+ # @deprecated
16
22
  def download_link_file(label, id, url)
17
23
  link_to(
18
24
  label,
@@ -26,6 +32,7 @@ module GeoblacklightHelper
26
32
  )
27
33
  end
28
34
 
35
+ # @deprecated
29
36
  def download_link_hgl(text, document)
30
37
  link_to(
31
38
  text,
@@ -41,20 +48,24 @@ module GeoblacklightHelper
41
48
 
42
49
  # Generates the link markup for the IIIF JPEG download
43
50
  # @return [String]
51
+ # @deprecated
44
52
  def download_link_iiif
45
- link_to(
46
- download_text("JPG"),
47
- iiif_jpg_url,
48
- "contentUrl" => iiif_jpg_url,
49
- :data => {
50
- download: "trigger"
51
- }
52
- )
53
+ Geoblacklight.deprecation.silence do
54
+ link_to(
55
+ download_text("JPG"),
56
+ iiif_jpg_url,
57
+ "contentUrl" => iiif_jpg_url,
58
+ :data => {
59
+ download: "trigger"
60
+ }
61
+ )
62
+ end
53
63
  end
54
64
 
65
+ # @deprecated
55
66
  def download_link_generated(download_type, document)
56
67
  link_to(
57
- t("geoblacklight.download.export_link", download_format: export_format_label(download_type)),
68
+ t("geoblacklight.download.export_link", download_format: Geoblacklight.deprecation.silence { export_format_label(download_type) }),
58
69
  "",
59
70
  data: {
60
71
  download_path: download_path(document.id, type: download_type),
@@ -64,6 +75,11 @@ module GeoblacklightHelper
64
75
  }
65
76
  )
66
77
  end
78
+ Geoblacklight.deprecation.deprecate_methods(GeoblacklightHelper,
79
+ download_link_file: "use Geoblacklight::DownloadLinksComponent instead",
80
+ download_link_iiif: "use Geoblacklight::DownloadLinksComponent instead",
81
+ download_link_generated: "use Geoblacklight::DownloadLinksComponent instead",
82
+ download_link_hgl: "the Harvard Geospatial Library download integration is removed without replacement in GeoBlacklight 5")
67
83
 
68
84
  ##
69
85
  # Blacklight catalog controller helper method to truncate field value to 150 chars
@@ -91,14 +107,19 @@ module GeoblacklightHelper
91
107
  ##
92
108
  # Looks up properly formatted names for formats
93
109
  #
110
+ # @deprecated
94
111
  def proper_case_format(format)
95
112
  t("geoblacklight.formats.#{format.to_s.parameterize(separator: "_")}")
96
113
  end
97
114
 
98
115
  # Format labels are customized for exports - look up the appropriate key.
116
+ # @deprecated
99
117
  def export_format_label(format)
100
118
  t("geoblacklight.download.export_#{format.to_s.parameterize(separator: "_")}_link")
101
119
  end
120
+ Geoblacklight.deprecation.deprecate_methods(GeoblacklightHelper,
121
+ proper_case_format: "use Geoblacklight::DownloadLinksComponent instead",
122
+ export_format_label: "use Geoblacklight::DownloadLinksComponent instead")
102
123
 
103
124
  ##
104
125
  # Looks up formatted names for references
@@ -111,15 +132,19 @@ module GeoblacklightHelper
111
132
  ##
112
133
  # Wraps download text with proper_case_format
113
134
  #
135
+ # @deprecated
114
136
  def download_text(format)
115
- download_format = proper_case_format(format)
137
+ download_format = Geoblacklight.deprecation.silence { proper_case_format(format) }
116
138
  value = t("geoblacklight.download.download_link", download_format: download_format)
117
139
  value.html_safe
118
140
  end
141
+ Geoblacklight.deprecation.deprecate_methods(GeoblacklightHelper,
142
+ download_text: "use Geoblacklight::DownloadLinksComponent instead")
119
143
 
120
144
  ##
121
145
  # Deteremines if a feature should include help text popover
122
146
  # @return [Boolean]
147
+ # @deprecated
123
148
  def show_help_text?(feature, key)
124
149
  Settings&.HELP_TEXT&.send(feature)&.include?(key)
125
150
  end
@@ -127,6 +152,7 @@ module GeoblacklightHelper
127
152
  ##
128
153
  # Render help text popover for a given feature and translation key
129
154
  # @return [HTML tag]
155
+ # @deprecated
130
156
  def render_help_text_entry(feature, key)
131
157
  if I18n.exists?("geoblacklight.help_text.#{feature}.#{key}", locale)
132
158
  help_text = I18n.t("geoblacklight.help_text.#{feature}.#{key}")
@@ -139,20 +165,29 @@ module GeoblacklightHelper
139
165
  tag.span class: "help-text translation-missing"
140
166
  end
141
167
  end
168
+ Geoblacklight.deprecation.deprecate_methods(GeoblacklightHelper,
169
+ show_help_text?: "use Geoblacklight::ViewerHelpTextComponent instead",
170
+ render_help_text_entry: "use Geoblacklight::ViewerHelpTextComponent instead")
142
171
 
143
172
  ##
144
173
  # Determines if item view should render the sidebar static map
145
174
  # @return [Boolean]
175
+ # @deprecated
146
176
  def render_sidebar_map?(document)
147
- Settings.SIDEBAR_STATIC_MAP&.any? { |vp| document.viewer_protocol == vp }
177
+ Geoblacklight.deprecation.silence { Settings.SIDEBAR_STATIC_MAP&.any? { |vp| document.viewer_protocol == vp } }
148
178
  end
179
+ Geoblacklight.deprecation.deprecate_methods(GeoblacklightHelper,
180
+ render_sidebar_map?: "use Geoblacklight::StaticMapComponent instead")
149
181
 
150
182
  ##
151
183
  # Deteremines if item view should include attribute table
152
184
  # @return [Boolean]
185
+ # @deprecated
153
186
  def show_attribute_table?
154
187
  document_available? && @document.inspectable?
155
188
  end
189
+ Geoblacklight.deprecation.deprecate_methods(GeoblacklightHelper,
190
+ show_attribute_table?: "use Geoblacklight::AttributeTableComponent instead")
156
191
 
157
192
  ##
158
193
  # Render value for a document's field as a truncate abstract
@@ -176,6 +211,7 @@ module GeoblacklightHelper
176
211
  # Renders the partials for a Geoblacklight::Reference in the web services
177
212
  # modal
178
213
  # @param [Geoblacklight::Reference]
214
+ # @deprecated
179
215
  def render_web_services(reference)
180
216
  render(
181
217
  partial: "web_services_#{reference.type}",
@@ -184,6 +220,8 @@ module GeoblacklightHelper
184
220
  rescue ActionView::MissingTemplate
185
221
  render partial: "web_services_default", locals: {reference: reference}
186
222
  end
223
+ Geoblacklight.deprecation.deprecate_methods(GeoblacklightHelper,
224
+ render_web_services: "use Geoblacklight::WebServicesComponent instead")
187
225
 
188
226
  ##
189
227
  # Returns a hash of the leaflet plugin settings to pass to the viewer.
@@ -246,28 +284,33 @@ module GeoblacklightHelper
246
284
  end
247
285
  end
248
286
 
287
+ # @deprecated
249
288
  def viewer_container
250
- if openlayers_container?
251
- ol_viewer
252
- elsif iiif_manifest_container?
253
- iiif_manifest_viewer
254
- else
255
- leaflet_viewer
289
+ Geoblacklight.deprecation.silence do
290
+ if openlayers_container?
291
+ ol_viewer
292
+ elsif iiif_manifest_container?
293
+ iiif_manifest_viewer
294
+ else
295
+ leaflet_viewer
296
+ end
256
297
  end
257
298
  end
258
299
 
300
+ # @deprecated
259
301
  def openlayers_container?
260
302
  return false unless @document
261
303
  @document.item_viewer.pmtiles || @document.item_viewer.cog
262
304
  end
263
305
 
306
+ # @deprecated
264
307
  def leaflet_viewer
265
308
  tag.div(nil,
266
309
  id: "map",
267
310
  data: {
268
- :map => "item", :protocol => @document.viewer_protocol.camelize,
311
+ :map => "item", :protocol => Geoblacklight.deprecation.silence { @document.viewer_protocol }.camelize,
269
312
  :url => @document.viewer_endpoint,
270
- "layer-id" => @document.wxs_identifier,
313
+ "layer-id" => Geoblacklight.deprecation.silence { @document.wxs_identifier },
271
314
  "map-geom" => @document.geometry.geojson,
272
315
  "catalog-path" => search_catalog_path,
273
316
  :available => document_available?,
@@ -276,13 +319,14 @@ module GeoblacklightHelper
276
319
  })
277
320
  end
278
321
 
322
+ # @deprecated
279
323
  def ol_viewer
280
324
  tag.div(nil,
281
325
  id: "ol-map",
282
326
  data: {
283
- :map => "item", :protocol => @document.viewer_protocol.camelize,
327
+ :map => "item", :protocol => Geoblacklight.deprecation.silence { @document.viewer_protocol }.camelize,
284
328
  :url => @document.viewer_endpoint,
285
- "layer-id" => @document.wxs_identifier,
329
+ "layer-id" => Geoblacklight.deprecation.silence { @document.wxs_identifier },
286
330
  "map-geom" => @document.geometry.geojson,
287
331
  "catalog-path" => search_catalog_path,
288
332
  :available => document_available?,
@@ -291,12 +335,21 @@ module GeoblacklightHelper
291
335
  })
292
336
  end
293
337
 
338
+ # @deprecated
294
339
  def iiif_manifest_container?
295
340
  return false unless @document
296
341
  @document&.item_viewer&.viewer_preference&.key?(:iiif_manifest)
297
342
  end
298
343
 
344
+ # @deprecated
299
345
  def iiif_manifest_viewer
300
346
  tag.div(nil, id: "clover-viewer", iiif_content: @document.viewer_endpoint)
301
347
  end
348
+ Geoblacklight.deprecation.deprecate_methods(GeoblacklightHelper,
349
+ viewer_container: "use Geoblacklight::ItemMapViewerComponent instead",
350
+ openlayers_container?: "use Geoblacklight::ItemMapViewerComponent instead",
351
+ leaflet_viewer: "use Geoblacklight::ItemMapViewerComponent instead",
352
+ ol_viewer: "use Geoblacklight::ItemMapViewerComponent instead",
353
+ iiif_manifest_container?: "use Geoblacklight::ItemMapViewerComponent instead",
354
+ iiif_manifest_viewer: "use Geoblacklight::ItemMapViewerComponent instead")
302
355
  end
@@ -14,26 +14,6 @@ export const openLayersBasemaps = {
14
14
  attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">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
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">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
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">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
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">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
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">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
  attribution: '&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>',
@@ -33,17 +33,42 @@ export default class OlInitializer {
33
33
  }
34
34
 
35
35
  baseLayer () {
36
- const basemap = openLayersBasemaps[this.data.basemap]
36
+ const basemap = this.basemapDefinition()
37
37
  const layer = new TileLayer({
38
38
  source: new XYZ({
39
39
  attributions: basemap["attribution"],
40
- url: basemap["url"],
40
+ url: this.normalizeUrl(basemap["url"]),
41
41
  maxZoom: basemap["maxZoom"]
42
42
  })
43
43
  })
44
44
  return layer
45
45
  }
46
46
 
47
+ // The basemap to draw, with any BASEMAPS values from settings.yml merged
48
+ // over the shipped definition. This lets an application change a basemap's
49
+ // URL -- to add a CARTO API key, for example -- without restating the rest
50
+ // of the definition, and lets it define basemaps of its own.
51
+ basemapDefinition () {
52
+ const name = this.data.basemap || 'positron'
53
+ const definition = {
54
+ ...openLayersBasemaps[name],
55
+ ...this.basemapOverrides()[name]
56
+ }
57
+ if (definition.url) return definition
58
+ return openLayersBasemaps.positron
59
+ }
60
+
61
+ basemapOverrides () {
62
+ return JSON.parse(this.data.leafletOptions || '{}').BASEMAPS || {}
63
+ }
64
+
65
+ // Leaflet and OpenLayers spell tile URL templates differently, so accept
66
+ // the Leaflet form a configured basemap is most likely to be written in:
67
+ // {s} becomes OpenLayers' subdomain range, and {retina} drops out.
68
+ normalizeUrl (url) {
69
+ return url.replace(/\{s\}/g, '{a-d}').replace(/\{retina\}/g, '')
70
+ }
71
+
47
72
  initializePmtiles () {
48
73
  const vectorLayer = new VectorTile({
49
74
  declutter: true,
@@ -4,14 +4,21 @@ module Geoblacklight
4
4
  module SolrDocument
5
5
  ##
6
6
  # Module for providing external Carto download references for a document
7
+ #
8
+ # @deprecated The Carto OneClick integration is removed without replacement
9
+ # in GeoBlacklight 5. Remove the `:carto` show tools partial from your
10
+ # CatalogController before upgrading.
7
11
  module Carto
8
12
  ##
9
13
  # Returns a url to a file that should be used with CartoDB integration
10
14
  # @return [String]
15
+ # @deprecated
11
16
  def carto_reference
12
17
  return unless public? && download_types.try(:[], :geojson).present?
13
18
  Geoblacklight::GeojsonDownload.new(self).url_with_params
14
19
  end
20
+ Geoblacklight.deprecation.deprecate_methods(Geoblacklight::SolrDocument::Carto,
21
+ carto_reference: "the Carto OneClick integration is removed without replacement in GeoBlacklight 5")
15
22
  end
16
23
  end
17
24
  end