geoblacklight 4.5.1 → 4.6.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/download_controller.rb +5 -0
  3. data/app/helpers/arcgis_helper.rb +3 -0
  4. data/app/helpers/blacklight_helper.rb +4 -0
  5. data/app/helpers/carto_helper.rb +5 -0
  6. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +7 -1
  7. data/app/helpers/geoblacklight_helper.rb +74 -21
  8. data/app/models/concerns/geoblacklight/solr_document/carto.rb +7 -0
  9. data/app/models/concerns/geoblacklight/solr_document/citation.rb +7 -0
  10. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -1
  11. data/app/models/concerns/geoblacklight/solr_document.rb +30 -2
  12. data/app/presenters/geoblacklight/document_presenter.rb +8 -0
  13. data/app/views/catalog/_arcgis.html.erb +1 -1
  14. data/app/views/catalog/_carto.html.erb +1 -1
  15. data/app/views/catalog/_downloads_collapse.html.erb +3 -0
  16. data/app/views/catalog/_index_split_default.html.erb +1 -1
  17. data/app/views/catalog/_show_default_attribute_table.html.erb +1 -1
  18. data/app/views/catalog/_show_default_viewer_container.html.erb +3 -3
  19. data/app/views/catalog/_show_downloads.html.erb +3 -0
  20. data/app/views/catalog/_show_sidebar.html.erb +1 -1
  21. data/app/views/catalog/_show_sidebar_static_map.html.erb +3 -0
  22. data/app/views/catalog/_web_services.html.erb +1 -1
  23. data/lib/geoblacklight/deprecated_configuration.rb +519 -0
  24. data/lib/geoblacklight/download/hgl_download.rb +5 -0
  25. data/lib/geoblacklight/engine.rb +14 -0
  26. data/lib/geoblacklight/geometry.rb +7 -0
  27. data/lib/geoblacklight/item_viewer.rb +8 -1
  28. data/lib/geoblacklight/references.rb +15 -0
  29. data/lib/geoblacklight/version.rb +1 -1
  30. data/lib/geoblacklight/view_helper_override.rb +12 -1
  31. data/lib/geoblacklight.rb +17 -0
  32. data/lib/tasks/geoblacklight.rake +17 -0
  33. data/package.json +3 -2
  34. data/spec/lib/geoblacklight/deprecated_configuration_spec.rb +597 -0
  35. data/spec/lib/geoblacklight/geometry_spec.rb +15 -0
  36. data/spec/lib/geoblacklight/references_spec.rb +24 -0
  37. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +16 -0
  38. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +48 -0
  39. metadata +5 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70ec0fdb43d31e4d9c2d4d5902e5a5d19ea35a6171e6b37f74d9a3fbfd937661
4
- data.tar.gz: f4b212c5ec24ee1c4c0263e8c0e1ba2c51c0ebcd7e70cf32ae5ccfe6e0a78d15
3
+ metadata.gz: 3edf2add9fde8d7a1c2989e1270f37643cbb122193e3600b53b10a321a49e902
4
+ data.tar.gz: 6d0d433f55915af261e636ea4cf640515ffa3fec5a09379949ea992407f18ce6
5
5
  SHA512:
6
- metadata.gz: 9a6612a445ce525cd2610b4cc0c83a509a523b13e27ea3ee6314ee5f48cbb6da479f9e103c50ae75312911780e39740db155c9d1b6015a05e5dddd71e2237710
7
- data.tar.gz: 0fc319d965119d9d7dd79456930fd6f4c32288d68967b9f408adf2da44c4096c7e99f39fe8e575021ef515f705a69e61f7513869774d7a87373972bcbfebebaa
6
+ metadata.gz: e07eec26c77cdfe96295c17821db3afef88dadfd4bc31be80b9a4c473ffc0104f7c3fec0d2e7895b7cb79b84654e93029f2d18466d96eb21e745382babc0fc72
7
+ data.tar.gz: 8b940bf6241ef7343f36855c312c3a3f1459ee6e754457ac01a7dfed56e01cb31c990b027a3d422ccc48c68d6cf9ace81102ec225a326825cbfe1d83ed902558
@@ -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
@@ -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
@@ -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
@@ -6,6 +6,13 @@ module Geoblacklight
6
6
  include ActionView::Helpers::OutputSafetyHelper
7
7
 
8
8
  def geoblacklight_citation(solr_document_url)
9
+ if Array(self[Settings.FIELDS.PUBLISHER]).size > 1
10
+ Geoblacklight.deprecation.warn(
11
+ "Geoblacklight::SolrDocument::Citation#geoblacklight_citation includes every value of " \
12
+ "#{Settings.FIELDS.PUBLISHER}; GeoBlacklight 5 reads the publisher as a single value and keeps " \
13
+ "only the first, so citations for this document will lose its other publishers"
14
+ )
15
+ end
9
16
  [
10
17
  fetch(Settings.FIELDS.CREATOR, nil),
11
18
  ("(#{issued})" if issued),
@@ -10,7 +10,7 @@ module Geoblacklight
10
10
  # @return [Boolean]
11
11
  def inspectable?
12
12
  %w[wms feature_layer dynamic_map_layer tiled_map_layer]
13
- .include? viewer_protocol
13
+ .include? Geoblacklight.deprecation.silence { viewer_protocol }
14
14
  end
15
15
  end
16
16
  end
@@ -24,6 +24,13 @@ module Geoblacklight
24
24
  end
25
25
 
26
26
  def restricted?
27
+ if key?(Settings.FIELDS.ACCESS_RIGHTS) && self[Settings.FIELDS.ACCESS_RIGHTS].blank?
28
+ Geoblacklight.deprecation.warn(
29
+ "Geoblacklight::SolrDocument#restricted? returns true for a document whose " \
30
+ "#{Settings.FIELDS.ACCESS_RIGHTS} is present but blank; GeoBlacklight 5 returns false for the " \
31
+ "same document, because it tests the value for nil rather than for blankness"
32
+ )
33
+ end
27
34
  rights_field_data.blank? || rights_field_data.casecmp("restricted").zero?
28
35
  end
29
36
 
@@ -43,9 +50,14 @@ module Geoblacklight
43
50
  fetch(Settings.FIELDS.DISPLAY_NOTE, "")
44
51
  end
45
52
 
53
+ # @deprecated
46
54
  def hgl_download
47
- references.hgl.to_hash if references.hgl.present?
55
+ Geoblacklight.deprecation.silence do
56
+ references.hgl.to_hash if references.hgl.present?
57
+ end
48
58
  end
59
+ Geoblacklight.deprecation.deprecate_methods(Geoblacklight::SolrDocument,
60
+ hgl_download: "the Harvard Geospatial Library download integration is removed without replacement in GeoBlacklight 5")
49
61
 
50
62
  def oembed
51
63
  references.oembed.endpoint if references.oembed.present?
@@ -76,14 +88,16 @@ module Geoblacklight
76
88
  end
77
89
 
78
90
  def geom_field
91
+ warn_about_blank_default(Settings.FIELDS.GEOMETRY, "geom_field")
79
92
  fetch(Settings.FIELDS.GEOMETRY, "")
80
93
  end
81
94
 
82
95
  def geometry
83
- @geometry ||= Geoblacklight::Geometry.new(geom_field)
96
+ @geometry ||= Geoblacklight::Geometry.new(Geoblacklight.deprecation.silence { geom_field })
84
97
  end
85
98
 
86
99
  def wxs_identifier
100
+ warn_about_blank_default(Settings.FIELDS.WXS_IDENTIFIER, "wxs_identifier")
87
101
  fetch(Settings.FIELDS.WXS_IDENTIFIER, "")
88
102
  end
89
103
 
@@ -103,6 +117,20 @@ module Geoblacklight
103
117
 
104
118
  private
105
119
 
120
+ ##
121
+ # In GeoBlacklight 5 these readers are Blacklight `attribute` declarations, which
122
+ # return nil rather than "" when the Solr field is missing.
123
+ # @param field [String] the Solr field backing the reader
124
+ # @param reader [String] the name of the reader, for the warning
125
+ def warn_about_blank_default(field, reader)
126
+ return if key?(field)
127
+
128
+ Geoblacklight.deprecation.warn(
129
+ "Geoblacklight::SolrDocument##{reader} returns \"\" for a document with no #{field}; " \
130
+ "GeoBlacklight 5 returns nil instead, so calls like ##{reader}.empty? or ##{reader}.split will raise"
131
+ )
132
+ end
133
+
106
134
  def rights_field_data
107
135
  fetch(Settings.FIELDS.ACCESS_RIGHTS, "")
108
136
  end
@@ -3,6 +3,11 @@
3
3
  module Geoblacklight
4
4
  ##
5
5
  # Adds custom functionality for Geoblacklight document presentation
6
+ #
7
+ # @deprecated This class is removed in GeoBlacklight 5. Applications that set
8
+ # `config.index.document_presenter_class = Geoblacklight::DocumentPresenter`
9
+ # in their CatalogController must drop that line, because the constant no
10
+ # longer exists.
6
11
  class DocumentPresenter < Blacklight::IndexPresenter
7
12
  include ActionView::Helpers::OutputSafetyHelper
8
13
  ##
@@ -10,6 +15,7 @@ module Geoblacklight
10
15
  # configured helper_method. Multivalued fields separated by presenter
11
16
  # field_value_separator (default: comma). Fields separated by period.
12
17
  # @return [String]
18
+ # @deprecated
13
19
  def index_fields_display
14
20
  fields_values = []
15
21
  @configuration.index_fields.each do |_field_name, field_config|
@@ -21,5 +27,7 @@ module Geoblacklight
21
27
  end
22
28
  safe_join(fields_values, " ")
23
29
  end
30
+ Geoblacklight.deprecation.deprecate_methods(Geoblacklight::DocumentPresenter,
31
+ index_fields_display: "use Geoblacklight::SearchResultComponent instead")
24
32
  end
25
33
  end
@@ -1,4 +1,4 @@
1
1
  <% document ||= @document %>
2
- <%= link_to(arcgis_link(document.arcgis_urls)) do %>
2
+ <%= link_to(Geoblacklight.deprecation.silence { arcgis_link(document.arcgis_urls) }) do %>
3
3
  <%= blacklight_icon('esri-globe') %><%= t('geoblacklight.tools.open_arcgis') %>
4
4
  <% end %>
@@ -1,4 +1,4 @@
1
1
  <% document ||= @document %>
2
- <%= link_to carto_link(document.carto_reference), target: '_blank' do %>
2
+ <%= link_to Geoblacklight.deprecation.silence { carto_link(document.carto_reference) }, target: '_blank' do %>
3
3
  <span class='geoblacklight geoblacklight-carto'></span><%= t('geoblacklight.tools.open_carto') %>
4
4
  <% end %>
@@ -1,3 +1,5 @@
1
+ <%# This template is removed in GeoBlacklight 5. The deprecated download 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
  <%# Renders the options of the downloads dropdown button %>
2
4
  <% document ||= @document %>
3
5
 
@@ -25,3 +27,4 @@
25
27
  <%= download_link_generated(type.first, document) %>
26
28
  <% end %>
27
29
  <% end %>
30
+ <% end %>
@@ -24,7 +24,7 @@
24
24
  <div class='more-info-area'>
25
25
  <div id="doc-<%= document.id %>-fields-collapse" class='collapse'>
26
26
  <small itemprop="description">
27
- <%= geoblacklight_present(:index_fields_display, document) %>
27
+ <%= Geoblacklight.deprecation.silence { geoblacklight_present(:index_fields_display, document) } %>
28
28
  </small>
29
29
  </div>
30
30
  </div>
@@ -1,4 +1,4 @@
1
- <% if show_attribute_table? %>
1
+ <% if Geoblacklight.deprecation.silence { show_attribute_table? } %>
2
2
  <div class='row'>
3
3
  <div id='table-container' class='col-md-12'>
4
4
  <table id="attribute-table" class="table table-hover table-condensed table-striped table-bordered col-md-12">
@@ -2,8 +2,8 @@
2
2
  <div class='row'>
3
3
  <div id='viewer-container' class="col-md-12">
4
4
 
5
- <% if show_help_text?('viewer_protocol', document.viewer_protocol) %>
6
- <%= render_help_text_entry('viewer_protocol', document.viewer_protocol) %>
5
+ <% if Geoblacklight.deprecation.silence { show_help_text?('viewer_protocol', document.viewer_protocol) } %>
6
+ <%= Geoblacklight.deprecation.silence { render_help_text_entry('viewer_protocol', document.viewer_protocol) } %>
7
7
  <% end %>
8
8
 
9
9
  <% if document.item_viewer.index_map %>
@@ -23,6 +23,6 @@
23
23
  </div>
24
24
  <% end %>
25
25
 
26
- <%= viewer_container %>
26
+ <%= Geoblacklight.deprecation.silence { viewer_container } %>
27
27
  </div>
28
28
  </div>
@@ -1,3 +1,5 @@
1
+ <%# This template is removed in GeoBlacklight 5. The deprecated download 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 ||= @document %>
2
4
 
3
5
  <% if document_downloadable? %>
@@ -21,3 +23,4 @@
21
23
  </div>
22
24
  </div>
23
25
  <% end %>
26
+ <% end %>
@@ -1,4 +1,4 @@
1
- <%= render :partial => 'show_sidebar_static_map' if render_sidebar_map?(@document) %>
1
+ <%= render :partial => 'show_sidebar_static_map' if Geoblacklight.deprecation.silence { render_sidebar_map?(@document) } %>
2
2
  <%= render :partial => 'show_tools' %>
3
3
 
4
4
  <div class="sidebar-buttons">
@@ -1,3 +1,5 @@
1
+ <%# Rendered by GeoBlacklight itself, so the deprecated helpers and accessors it calls are silenced here; Geoblacklight::DeprecatedConfiguration warns at boot if an application overrides it. %>
2
+ <% Geoblacklight.deprecation.silence do %>
1
3
  <div class="card">
2
4
  <div class="card-header">
3
5
  <%= I18n.t('geoblacklight.location') %>
@@ -8,3 +10,4 @@
8
10
  <% end %>
9
11
  </div>
10
12
  </div>
13
+ <% end %>
@@ -3,7 +3,7 @@
3
3
  <% document.references.refs.each do |reference| %>
4
4
  <% if Settings.WEBSERVICES_SHOWN.include? reference.type.to_s %>
5
5
  <div class="web-services-modal-entry">
6
- <%= render_web_services(reference) %>
6
+ <%= Geoblacklight.deprecation.silence { render_web_services(reference) } %>
7
7
  </div>
8
8
  <% end %>
9
9
  <% end %>