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
|
@@ -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),
|
|
@@ -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
|
-
|
|
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,13 +3,20 @@
|
|
|
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
|
|
13
|
+
|
|
8
14
|
##
|
|
9
15
|
# Presents configured index fields in search results. Passes values through
|
|
10
16
|
# configured helper_method. Multivalued fields separated by presenter
|
|
11
17
|
# field_value_separator (default: comma). Fields separated by period.
|
|
12
18
|
# @return [String]
|
|
19
|
+
# @deprecated
|
|
13
20
|
def index_fields_display
|
|
14
21
|
fields_values = []
|
|
15
22
|
@configuration.index_fields.each do |_field_name, field_config|
|
|
@@ -21,5 +28,7 @@ module Geoblacklight
|
|
|
21
28
|
end
|
|
22
29
|
safe_join(fields_values, " ")
|
|
23
30
|
end
|
|
31
|
+
Geoblacklight.deprecation.deprecate_methods(Geoblacklight::DocumentPresenter,
|
|
32
|
+
index_fields_display: "use Geoblacklight::SearchResultComponent instead")
|
|
24
33
|
end
|
|
25
34
|
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 %>
|
data/geoblacklight.gemspec
CHANGED
|
@@ -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 "database_cleaner", "~> 2.0"
|
|
41
41
|
spec.add_development_dependency "simplecov", "~> 0.22"
|
|
42
42
|
spec.add_development_dependency "foreman"
|
|
43
|
-
spec.add_development_dependency "
|
|
43
|
+
spec.add_development_dependency "standard", "~> 1.56.0"
|
|
44
44
|
spec.add_development_dependency "webmock", "~> 3.14"
|
|
45
45
|
end
|
|
@@ -124,7 +124,7 @@ module Geoblacklight
|
|
|
124
124
|
if propshaft_present
|
|
125
125
|
gsub_file "Gemfile", /^(\s*gem\s+["']propshaft["'].*)$/, '# \1'
|
|
126
126
|
end
|
|
127
|
-
unless gemfile.match?(/gem ['
|
|
127
|
+
unless gemfile.match?(/gem ['"]sprockets-rails['"]/)
|
|
128
128
|
append_to_file "Gemfile" do
|
|
129
129
|
"\ngem 'sprockets-rails'\n"
|
|
130
130
|
end
|
|
@@ -317,12 +317,11 @@ class CatalogController < ApplicationController
|
|
|
317
317
|
# 'positron'
|
|
318
318
|
# 'darkMatter'
|
|
319
319
|
# 'positronLite'
|
|
320
|
-
# 'worldAntique'
|
|
321
|
-
# 'worldEco'
|
|
322
|
-
# 'flatBlue'
|
|
323
|
-
# 'midnightCommander'
|
|
324
320
|
# 'openstreetmapHot'
|
|
325
321
|
# 'openstreetmapStandard'
|
|
322
|
+
#
|
|
323
|
+
# To change one of these basemaps' tile URLs, or to add a basemap of your
|
|
324
|
+
# own and name it here, set LEAFLET.BASEMAPS in settings.yml
|
|
326
325
|
|
|
327
326
|
config.basemap_provider = "positron"
|
|
328
327
|
|
|
@@ -229,6 +229,25 @@ WMS_PARAMS:
|
|
|
229
229
|
# Settings for leaflet
|
|
230
230
|
LEAFLET:
|
|
231
231
|
MAP:
|
|
232
|
+
# Basemap definitions, keyed by the name config.basemap_provider selects.
|
|
233
|
+
# Anything set here is merged over the basemap GeoBlacklight ships with, so
|
|
234
|
+
# you can change just the url and keep the rest of the definition.
|
|
235
|
+
#
|
|
236
|
+
# CARTO now watermarks raster tiles requested without an API key, which
|
|
237
|
+
# affects the positron, positronLite and darkMatter basemaps. Request a free
|
|
238
|
+
# key at https://carto.com/basemaps/apikey/ and pass it as a key parameter:
|
|
239
|
+
# BASEMAPS:
|
|
240
|
+
# positron:
|
|
241
|
+
# url: 'https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png?key=YOUR_KEY'
|
|
242
|
+
# darkMatter:
|
|
243
|
+
# url: 'https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png?key=YOUR_KEY'
|
|
244
|
+
#
|
|
245
|
+
# You can also define a basemap of your own here and select it with
|
|
246
|
+
# config.basemap_provider = 'myBasemap' in your CatalogController:
|
|
247
|
+
# myBasemap:
|
|
248
|
+
# url: 'https://tiles.example.edu/{z}/{x}/{y}.png'
|
|
249
|
+
# attribution: 'Tiles courtesy of Example University'
|
|
250
|
+
# maxZoom: 18
|
|
232
251
|
LAYERS:
|
|
233
252
|
DETECT_RETINA: true
|
|
234
253
|
INDEX:
|