geoblacklight 2.4.0 → 3.0.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/.circleci/config.yml +152 -64
- data/.rubocop.yml +15 -13
- data/.rubocop_todo.yml +66 -10
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +1 -1
- data/app/assets/javascripts/geoblacklight/modules/svg_tooltips.js +31 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri.js +2 -2
- data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +1 -1
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +2 -2
- data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +2 -0
- data/app/assets/stylesheets/geoblacklight/modules/_base.scss +33 -0
- data/app/assets/stylesheets/geoblacklight/{_blacklight_overrides.scss → modules/_blacklight_overrides.scss} +0 -0
- data/app/assets/stylesheets/geoblacklight/{_styles.scss → modules/_styles.scss} +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +37 -54
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/results.scss +16 -28
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +12 -42
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +17 -59
- data/app/controllers/download_controller.rb +12 -12
- data/app/controllers/relation_controller.rb +1 -0
- data/app/controllers/wms_controller.rb +1 -0
- data/app/helpers/arcgis_helper.rb +1 -0
- data/app/helpers/blacklight_helper.rb +1 -0
- data/app/helpers/carto_helper.rb +1 -0
- data/app/helpers/geoblacklight_helper.rb +25 -72
- data/app/models/concerns/geoblacklight/solr_document.rb +7 -6
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +2 -1
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -13
- data/app/models/concerns/geoblacklight/solr_document/citation.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +2 -1
- data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +3 -1
- data/app/presenters/geoblacklight/document_presenter.rb +2 -1
- data/app/views/catalog/_arcgis.html.erb +4 -0
- data/app/views/catalog/_carto.html.erb +4 -0
- data/app/views/catalog/_downloads_primary.html.erb +8 -1
- data/app/views/catalog/_header_icons.html.erb +3 -3
- data/app/views/catalog/_home_text.html.erb +3 -0
- data/app/views/catalog/_index_split_default.html.erb +21 -21
- data/app/views/relation/_ancestors.html.erb +1 -4
- data/app/views/relation/_descendants.html.erb +2 -5
- data/app/views/relation/index.html.erb +20 -8
- data/app/views/relation/index.json.jbuilder +2 -1
- data/app/views/shared/_header_navbar.html.erb +0 -2
- data/bin/coverage.rb +36 -0
- data/config/initializers/rails_config.rb +1 -0
- data/config/locales/geoblacklight.en.yml +3 -2
- data/geoblacklight.gemspec +3 -6
- data/lib/generators/geoblacklight/assets_generator.rb +46 -0
- data/lib/generators/geoblacklight/install_generator.rb +3 -9
- data/lib/generators/geoblacklight/templates/assets/_blacklight.scss +1 -0
- data/lib/generators/geoblacklight/templates/assets/_customizations.scss +28 -0
- data/{app/assets/stylesheets/geoblacklight/application.scss → lib/generators/geoblacklight/templates/assets/_geoblacklight.scss} +0 -1
- data/lib/generators/geoblacklight/templates/assets/application.scss +7 -0
- data/lib/generators/geoblacklight/templates/{geoblacklight.js → assets/geoblacklight.js} +0 -0
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +3 -2
- data/lib/generators/geoblacklight/templates/settings.yml +0 -6
- data/lib/generators/geoblacklight/webpacker_generator.rb +1 -0
- data/lib/geoblacklight.rb +1 -0
- data/lib/geoblacklight/bounding_box.rb +1 -0
- data/lib/geoblacklight/catalog_helper_override.rb +1 -0
- data/lib/geoblacklight/constants.rb +1 -0
- data/lib/geoblacklight/download.rb +2 -1
- data/lib/geoblacklight/download/geojson_download.rb +1 -0
- data/lib/geoblacklight/download/geotiff_download.rb +1 -0
- data/lib/geoblacklight/download/hgl_download.rb +1 -0
- data/lib/geoblacklight/download/kmz_download.rb +2 -1
- data/lib/geoblacklight/download/shapefile_download.rb +1 -0
- data/lib/geoblacklight/engine.rb +1 -2
- data/lib/geoblacklight/exceptions.rb +1 -0
- data/lib/geoblacklight/geoblacklight_helper_behavior.rb +1 -0
- data/lib/geoblacklight/item_viewer.rb +1 -0
- data/lib/geoblacklight/metadata.rb +1 -0
- data/lib/geoblacklight/metadata/base.rb +1 -0
- data/lib/geoblacklight/metadata/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata/html.rb +2 -2
- data/lib/geoblacklight/metadata/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata_transformer.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
- data/lib/geoblacklight/reference.rb +1 -0
- data/lib/geoblacklight/references.rb +7 -3
- data/lib/geoblacklight/relation/ancestors.rb +1 -0
- data/lib/geoblacklight/relation/descendants.rb +1 -0
- data/lib/geoblacklight/relation/relation_response.rb +2 -1
- data/lib/geoblacklight/routes.rb +1 -0
- data/lib/geoblacklight/routes/downloadable.rb +1 -0
- data/lib/geoblacklight/routes/exportable.rb +1 -0
- data/lib/geoblacklight/routes/wms.rb +1 -0
- data/lib/geoblacklight/version.rb +2 -1
- data/lib/geoblacklight/view_helper_override.rb +1 -0
- data/lib/geoblacklight/wms_layer.rb +1 -0
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +1 -0
- data/lib/tasks/geoblacklight.rake +33 -32
- data/spec/controllers/catalog_controller_spec.rb +1 -0
- data/spec/controllers/download_controller_spec.rb +1 -0
- data/spec/controllers/relation_controller_spec.rb +1 -0
- data/spec/controllers/wms_controller_spec.rb +1 -0
- data/spec/factories/user.rb +1 -0
- data/spec/features/bookmarks_spec.rb +1 -0
- data/spec/features/configurable_basemap_spec.rb +1 -0
- data/spec/features/data_dictionary_download_spec.rb +1 -0
- data/spec/features/download_layer_spec.rb +1 -0
- data/spec/features/empty_search_spec.rb +1 -0
- data/spec/features/esri_viewer_spec.rb +1 -5
- data/spec/features/exports_spec.rb +4 -12
- data/spec/features/help_text_spec.rb +1 -0
- data/spec/features/home_page_spec.rb +6 -0
- data/spec/features/iiif_viewer_spec.rb +1 -0
- data/spec/features/index_map_spec.rb +1 -0
- data/spec/features/layer_inspection_spec.rb +1 -0
- data/spec/features/layer_opacity_spec.rb +1 -0
- data/spec/features/layer_preview_spec.rb +1 -0
- data/spec/features/layer_with_no_references_spec.rb +1 -0
- data/spec/features/linkified_attribute_table_spec.rb +1 -0
- data/spec/features/metadata_panel_spec.rb +1 -0
- data/spec/features/missing_metadata_spec.rb +1 -0
- data/spec/features/multiple_downloads_spec.rb +15 -0
- data/spec/features/oembed_spec.rb +1 -0
- data/spec/features/relations_spec.rb +10 -29
- data/spec/features/saved_searches_spec.rb +1 -0
- data/spec/features/search_bar_spec.rb +1 -0
- data/spec/features/search_results_map_spec.rb +1 -6
- data/spec/features/search_results_overlap_ratio_spec.rb +4 -3
- data/spec/features/search_spec.rb +1 -0
- data/spec/features/show_page_metadata_spec.rb +1 -0
- data/spec/features/sms_spec.rb +1 -0
- data/spec/features/split_view.html.erb_spec.rb +2 -1
- data/spec/features/suppressed_records_spec.rb +1 -0
- data/spec/features/web_services_modal_spec.rb +1 -0
- data/spec/fixtures/solr_documents/multiple-downloads.json +30 -0
- data/spec/helpers/arcgis_helper_spec.rb +1 -0
- data/spec/helpers/carto_helper_spec.rb +1 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +47 -14
- data/spec/javascripts/geoblacklight/viewers/esri/tiled_map_layer_spec.js +12 -0
- data/spec/lib/geoblacklight/bounding_box_spec.rb +1 -0
- data/spec/lib/geoblacklight/controller_override_spec.rb +1 -0
- data/spec/lib/geoblacklight/document_presenter_spec.rb +3 -2
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download_spec.rb +2 -1
- data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
- data/spec/lib/geoblacklight/item_viewer_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata/base_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata/html_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +4 -3
- data/spec/lib/geoblacklight/reference_spec.rb +1 -0
- data/spec/lib/geoblacklight/references_spec.rb +2 -3
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +1 -0
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +1 -0
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +1 -0
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +5 -4
- data/spec/lib/geoblacklight/wms_layer_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +1 -20
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +15 -2
- data/spec/routing/catalog_routing_spec.rb +1 -0
- data/spec/spec_helper.rb +12 -9
- data/spec/support/backport_test_helpers.rb +1 -0
- data/spec/support/features.rb +1 -0
- data/spec/support/features/session_helpers.rb +1 -0
- data/spec/support/fixtures.rb +1 -0
- data/spec/tasks/geoblacklight_spec.rb +4 -3
- data/spec/teaspoon_env.rb +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -0
- data/spec/views/catalog/_document_split.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_index_split.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -4
- data/template.rb +1 -0
- metadata +42 -68
- data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +0 -36
- data/app/assets/stylesheets/geoblacklight/modules/relations.scss +0 -15
- data/app/views/catalog/_exports.html.erb +0 -3
- data/app/views/catalog/_show_tools.html.erb +0 -25
- data/lib/generators/geoblacklight/templates/geoblacklight.scss +0 -4
- data/vendor/assets/javascripts/readmore.js +0 -0
- data/vendor/assets/javascripts/readmore.min.js +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
class DownloadController < ApplicationController
|
|
2
3
|
# include Blacklight::SearchHelper
|
|
3
4
|
include Blacklight::Catalog
|
|
@@ -5,8 +6,7 @@ class DownloadController < ApplicationController
|
|
|
5
6
|
rescue_from Geoblacklight::Exceptions::ExternalDownloadFailed do |exception|
|
|
6
7
|
Geoblacklight.logger.error exception.message + ' ' + exception.url
|
|
7
8
|
flash[:danger] = view_context
|
|
8
|
-
.
|
|
9
|
-
flash_error_message(exception),
|
|
9
|
+
.tag.span(flash_error_message(exception),
|
|
10
10
|
data: {
|
|
11
11
|
download: 'error',
|
|
12
12
|
download_id: params[:id],
|
|
@@ -62,16 +62,16 @@ class DownloadController < ApplicationController
|
|
|
62
62
|
# exception
|
|
63
63
|
# @return [String] error message to display in flash
|
|
64
64
|
def flash_error_message(exception)
|
|
65
|
-
if exception.url.present?
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
message = if exception.url.present?
|
|
66
|
+
t('geoblacklight.download.error_with_url',
|
|
67
|
+
link: view_context
|
|
68
|
+
.link_to(exception.url,
|
|
69
|
+
exception.url,
|
|
70
|
+
target: 'blank'))
|
|
71
|
+
.html_safe
|
|
72
|
+
else
|
|
73
|
+
t('geoblacklight.download.error')
|
|
74
|
+
end
|
|
75
75
|
message
|
|
76
76
|
end
|
|
77
77
|
|
data/app/helpers/carto_helper.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module GeoblacklightHelper
|
|
2
|
-
extend Deprecation
|
|
3
|
-
|
|
4
3
|
def document_available?
|
|
5
4
|
@document.public? || (@document.same_institution? && user_signed_in?)
|
|
6
5
|
end
|
|
@@ -13,6 +12,20 @@ module GeoblacklightHelper
|
|
|
13
12
|
@document.references.iiif.endpoint.sub! 'info.json', 'full/full/0/default.jpg'
|
|
14
13
|
end
|
|
15
14
|
|
|
15
|
+
def download_link_file(label, id, url)
|
|
16
|
+
link_to(
|
|
17
|
+
label,
|
|
18
|
+
url,
|
|
19
|
+
'contentUrl' => url,
|
|
20
|
+
class: ['btn', 'btn-default', 'download', 'download-original'],
|
|
21
|
+
data: {
|
|
22
|
+
download: 'trigger',
|
|
23
|
+
download_type: 'direct',
|
|
24
|
+
download_id: id
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
16
29
|
def download_link_direct(text, document)
|
|
17
30
|
link_to(
|
|
18
31
|
text,
|
|
@@ -26,6 +39,7 @@ module GeoblacklightHelper
|
|
|
26
39
|
}
|
|
27
40
|
)
|
|
28
41
|
end
|
|
42
|
+
deprecation_deprecate download_link_direct: 'Use download_link_file instead'
|
|
29
43
|
|
|
30
44
|
def download_link_hgl(text, document)
|
|
31
45
|
link_to(
|
|
@@ -95,43 +109,6 @@ module GeoblacklightHelper
|
|
|
95
109
|
end
|
|
96
110
|
end
|
|
97
111
|
|
|
98
|
-
##
|
|
99
|
-
# Render an empty span
|
|
100
|
-
# @return [HTML tag]
|
|
101
|
-
def render_empty_span(classname)
|
|
102
|
-
tag.span class: classname
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
##
|
|
106
|
-
# Capture SVG icon aria labels to describe
|
|
107
|
-
def queue_icon_aria_label(feature_name)
|
|
108
|
-
@aria_labels ||= Set.new
|
|
109
|
-
@aria_labels << feature_name
|
|
110
|
-
end
|
|
111
|
-
deprecation_deprecate :queue_icon_aria_label
|
|
112
|
-
|
|
113
|
-
##
|
|
114
|
-
# Render a div of divs describing aria-labelledby values
|
|
115
|
-
# @return [HTML tag]
|
|
116
|
-
def render_aria_labels(aria_labels)
|
|
117
|
-
return unless aria_labels.present?
|
|
118
|
-
content_tag :div, id: 'aria-labels', class: 'sr-only sr-only-focusable' do
|
|
119
|
-
aria_labels.each do |label|
|
|
120
|
-
concat(render_aria_label(label))
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
deprecation_deprecate :render_aria_labels
|
|
125
|
-
|
|
126
|
-
# Render a div describing a aria-labelledby value
|
|
127
|
-
# @return [HTML tag]
|
|
128
|
-
def render_aria_label(label)
|
|
129
|
-
content_tag :div, id: "aria-label-#{label}" do
|
|
130
|
-
I18n.t("geoblacklight.aria-labels.#{label}")
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
deprecation_deprecate :render_aria_label
|
|
134
|
-
|
|
135
112
|
##
|
|
136
113
|
# Renders an unique array of search links based off of terms
|
|
137
114
|
# passed in using the facet parameter
|
|
@@ -195,8 +172,8 @@ module GeoblacklightHelper
|
|
|
195
172
|
def render_help_text_entry(feature, key)
|
|
196
173
|
if I18n.exists?("geoblacklight.help_text.#{feature}.#{key}", locale)
|
|
197
174
|
help_text = I18n.t("geoblacklight.help_text.#{feature}.#{key}")
|
|
198
|
-
|
|
199
|
-
|
|
175
|
+
tag.h3 class: 'help-text viewer_protocol h6' do
|
|
176
|
+
tag.a 'data': { toggle: 'popover', title: help_text[:title], content: help_text[:content] } do
|
|
200
177
|
help_text[:title]
|
|
201
178
|
end
|
|
202
179
|
end
|
|
@@ -218,7 +195,7 @@ module GeoblacklightHelper
|
|
|
218
195
|
# get_field_values method
|
|
219
196
|
# @param [Hash] args from get_field_values
|
|
220
197
|
def render_value_as_truncate_abstract(args)
|
|
221
|
-
|
|
198
|
+
tag.div class: 'truncate-abstract' do
|
|
222
199
|
Array(args[:value]).flatten.join(' ')
|
|
223
200
|
end
|
|
224
201
|
end
|
|
@@ -230,33 +207,6 @@ module GeoblacklightHelper
|
|
|
230
207
|
blacklight_config.basemap_provider || 'positron'
|
|
231
208
|
end
|
|
232
209
|
|
|
233
|
-
def display_carto
|
|
234
|
-
return link_to(
|
|
235
|
-
content_tag(:span, '', class: 'geoblacklight geoblacklight-carto') +
|
|
236
|
-
t('geoblacklight.tools.open_carto'),
|
|
237
|
-
carto_link(@document.carto_reference),
|
|
238
|
-
target: '_blank'
|
|
239
|
-
) if @document.carto_reference.present? && !Settings.CARTO_HIDE
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
def display_arcgis
|
|
243
|
-
return link_to(
|
|
244
|
-
blacklight_icon('esri-globe') + ' ' +
|
|
245
|
-
t('geoblacklight.tools.open_arcgis'),
|
|
246
|
-
arcgis_link(@document.arcgis_urls)
|
|
247
|
-
) if @document.arcgis_urls.present? && !Settings.ARCGIS_HIDE
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
##
|
|
251
|
-
# Creates a Carto OneClick link link, using the configuration link
|
|
252
|
-
# @param [String] file_link
|
|
253
|
-
# @return [String]
|
|
254
|
-
# @deprecated Use {#carto_link} instead.
|
|
255
|
-
def cartodb_link(file_link)
|
|
256
|
-
carto_link(file_link)
|
|
257
|
-
end
|
|
258
|
-
deprecation_deprecate carto_link: 'use GeoblacklightHelper#carto_link instead'
|
|
259
|
-
|
|
260
210
|
##
|
|
261
211
|
# Renders the partials for a Geoblacklight::Reference in the web services
|
|
262
212
|
# modal
|
|
@@ -285,7 +235,7 @@ module GeoblacklightHelper
|
|
|
285
235
|
def render_facet_item_with_icon(field_name, item)
|
|
286
236
|
doc = Nokogiri::HTML.fragment(render_facet_item(field_name, item))
|
|
287
237
|
doc.at_css('.facet-label').children.first
|
|
288
|
-
.add_previous_sibling(geoblacklight_icon(item.value, aria_hidden: true))
|
|
238
|
+
.add_previous_sibling(geoblacklight_icon(item.value, aria_hidden: true, classes: 'svg_tooltip'))
|
|
289
239
|
doc.to_html.html_safe
|
|
290
240
|
end
|
|
291
241
|
|
|
@@ -317,16 +267,19 @@ module GeoblacklightHelper
|
|
|
317
267
|
# Renders a reference url for a document
|
|
318
268
|
# @param [Hash] document, field_name
|
|
319
269
|
def render_references_url(args)
|
|
270
|
+
return unless args[:document]&.references&.url
|
|
320
271
|
link_to(
|
|
321
272
|
args[:document].references.url.endpoint,
|
|
322
273
|
args[:document].references.url.endpoint
|
|
323
|
-
)
|
|
274
|
+
)
|
|
324
275
|
end
|
|
325
276
|
|
|
326
277
|
## Returns the icon used based off a Settings strategy
|
|
327
278
|
def relations_icon(document, icon)
|
|
328
279
|
icon_name = document[Settings.FIELDS.GEOM_TYPE] if Settings.USE_GEOM_FOR_RELATIONS_ICON
|
|
329
280
|
icon_name = icon if icon_name.blank?
|
|
330
|
-
|
|
281
|
+
icon_options = {}
|
|
282
|
+
icon_options = { classes: 'svg_tooltip' } if Settings.USE_GEOM_FOR_RELATIONS_ICON
|
|
283
|
+
geoblacklight_icon(icon_name, icon_options)
|
|
331
284
|
end
|
|
332
285
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Geoblacklight
|
|
2
3
|
# Extends Blacklight::Solr::Document for GeoBlacklight specific functionalit
|
|
3
4
|
module SolrDocument
|
|
@@ -34,15 +35,15 @@ module Geoblacklight
|
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def direct_download
|
|
37
|
-
references.download.to_hash
|
|
38
|
+
references.download.to_hash if references.download.present?
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
def hgl_download
|
|
41
|
-
references.hgl.to_hash
|
|
42
|
+
references.hgl.to_hash if references.hgl.present?
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
def oembed
|
|
45
|
-
references.oembed.endpoint
|
|
46
|
+
references.oembed.endpoint if references.oembed.present?
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
def same_institution?
|
|
@@ -50,11 +51,11 @@ module Geoblacklight
|
|
|
50
51
|
end
|
|
51
52
|
|
|
52
53
|
def iiif_download
|
|
53
|
-
references.iiif.to_hash
|
|
54
|
+
references.iiif.to_hash if references.iiif.present?
|
|
54
55
|
end
|
|
55
56
|
|
|
56
57
|
def data_dictionary_download
|
|
57
|
-
references.data_dictionary.to_hash
|
|
58
|
+
references.data_dictionary.to_hash if references.data_dictionary.present?
|
|
58
59
|
end
|
|
59
60
|
|
|
60
61
|
def external_url
|
|
@@ -108,7 +109,7 @@ module Geoblacklight
|
|
|
108
109
|
end
|
|
109
110
|
|
|
110
111
|
def method_missing(method, *args, &block)
|
|
111
|
-
if /.*_url
|
|
112
|
+
if /.*_url$/.match?(method.to_s)
|
|
112
113
|
checked_endpoint(method.to_s.gsub('_url', ''))
|
|
113
114
|
else
|
|
114
115
|
super
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Geoblacklight
|
|
2
3
|
module SolrDocument
|
|
3
4
|
module Arcgis
|
|
4
5
|
def arcgis_urls
|
|
5
|
-
return
|
|
6
|
+
return if references.esri_webservices.blank?
|
|
6
7
|
references.esri_webservices.map { |layer| layer.reference[1] if layer }.compact
|
|
7
8
|
end
|
|
8
9
|
end
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Geoblacklight
|
|
2
3
|
module SolrDocument
|
|
3
4
|
##
|
|
4
5
|
# Module for providing external Carto download references for a document
|
|
5
6
|
module Carto
|
|
6
|
-
extend Deprecation
|
|
7
|
-
self.deprecation_horizon = 'Geoblacklight 2.0.0'
|
|
8
|
-
##
|
|
9
|
-
# Returns a url to a file that should be used with CartoDB integration
|
|
10
|
-
# @return [String]
|
|
11
|
-
# @deprecated Use {#carto_reference} instead
|
|
12
|
-
def cartodb_reference
|
|
13
|
-
carto_reference
|
|
14
|
-
end
|
|
15
|
-
deprecation_deprecate(
|
|
16
|
-
cartodb_reference: 'use Geoblacklight::SolrDocument::Carto#carto_reference instead'
|
|
17
|
-
)
|
|
18
|
-
|
|
19
7
|
##
|
|
20
8
|
# Returns a url to a file that should be used with CartoDB integration
|
|
21
9
|
# @return [String]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Geoblacklight
|
|
2
3
|
module SolrDocument
|
|
3
4
|
##
|
|
@@ -7,7 +8,7 @@ module Geoblacklight
|
|
|
7
8
|
# Returns boolean about whether document viewer protocol is inspectable
|
|
8
9
|
# @return [Boolean]
|
|
9
10
|
def inspectable?
|
|
10
|
-
%w
|
|
11
|
+
%w[wms feature_layer dynamic_map_layer tiled_map_layer]
|
|
11
12
|
.include? viewer_protocol
|
|
12
13
|
end
|
|
13
14
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Geoblacklight
|
|
2
3
|
module SpatialSearchBehavior
|
|
3
4
|
extend ActiveSupport::Concern
|
|
@@ -20,9 +21,10 @@ module Geoblacklight
|
|
|
20
21
|
solr_params[:fq] << "#{Settings.FIELDS.GEOMETRY}:\"Intersects(#{envelope_bounds})\""
|
|
21
22
|
|
|
22
23
|
if Settings.OVERLAP_RATIO_BOOST
|
|
24
|
+
solr_params[:bf] ||= []
|
|
23
25
|
solr_params[:overlap] =
|
|
24
26
|
"{!field uf=* defType=lucene f=solr_bboxtype score=overlapRatio}Intersects(#{envelope_bounds})"
|
|
25
|
-
solr_params[:bf]
|
|
27
|
+
solr_params[:bf] << "$overlap^#{Settings.OVERLAP_RATIO_BOOST}"
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
solr_params
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Geoblacklight
|
|
2
3
|
##
|
|
3
4
|
# Adds custom functionality for Geoblacklight document presentation
|
|
@@ -12,7 +13,7 @@ module Geoblacklight
|
|
|
12
13
|
fields_values = []
|
|
13
14
|
@configuration.index_fields.each do |_field_name, field_config|
|
|
14
15
|
val = field_value(field_config)
|
|
15
|
-
|
|
16
|
+
if val.present?
|
|
16
17
|
val += '.' unless val.end_with?('.')
|
|
17
18
|
fields_values << val
|
|
18
19
|
end
|
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
<% document ||= @document %>
|
|
3
3
|
|
|
4
4
|
<% if document.direct_download.present? %>
|
|
5
|
-
|
|
5
|
+
<% if document.direct_download[:download].is_a? Array %>
|
|
6
|
+
<% document.direct_download[:download].each do |download| %>
|
|
7
|
+
<%= render partial: 'download_link', locals: { download_link: download_link_file(download['label'], document.id, download['url']) } %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% if document.direct_download[:download].is_a? String %>
|
|
11
|
+
<%= render partial: 'download_link', locals: { download_link: download_link_direct(download_text(document.file_format), document) } %>
|
|
12
|
+
<% end %>
|
|
6
13
|
<% end %>
|
|
7
14
|
|
|
8
15
|
<% if document.hgl_download.present? %>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<%= geoblacklight_icon(document[Settings.FIELDS.GEOM_TYPE]) %>
|
|
2
|
-
<%= geoblacklight_icon(document[Settings.FIELDS.PROVENANCE]) %>
|
|
3
|
-
<%= geoblacklight_icon(document[Settings.FIELDS.RIGHTS]) %>
|
|
1
|
+
<%= geoblacklight_icon(document[Settings.FIELDS.GEOM_TYPE], classes: 'svg_tooltip') %>
|
|
2
|
+
<%= geoblacklight_icon(document[Settings.FIELDS.PROVENANCE], classes: 'svg_tooltip') %>
|
|
3
|
+
<%= geoblacklight_icon(document[Settings.FIELDS.RIGHTS], classes: 'svg_tooltip') %>
|
|
@@ -40,4 +40,7 @@
|
|
|
40
40
|
<%= content_tag :div, '', id: 'map', aria: { label: t('geoblacklight.map.label') }, data: { map: 'home', 'catalog-path'=> search_catalog_path , 'map-bbox' => params[:bbox], basemap: geoblacklight_basemap, leaflet_options: leaflet_options } %>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
|
+
<div class="text-right">
|
|
44
|
+
<%= t('geoblacklight.home.version', version: Geoblacklight::VERSION ) %>
|
|
45
|
+
</div>
|
|
43
46
|
</div>
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
<% # header bar for doc items in index view -%>
|
|
2
|
-
<%= content_tag :div, class: 'documentHeader row', data: { layer_id: document.id, bbox: document.bounding_box_as_wsen } do %>
|
|
3
|
-
<h3 class="index_title col
|
|
2
|
+
<%= content_tag :div, class: 'documentHeader index-split row', data: { layer_id: document.id, bbox: document.bounding_box_as_wsen } do %>
|
|
3
|
+
<h3 class="index_title col">
|
|
4
|
+
<% counter = document_counter_with_offset(document_counter) %>
|
|
5
|
+
<span class="document-counter">
|
|
6
|
+
<%= t('blacklight.search.documents.counter', :counter => counter) if counter %>
|
|
7
|
+
</span>
|
|
8
|
+
<%= link_to_document document, counter: counter %>
|
|
9
|
+
</h3>
|
|
10
|
+
<span class='status-icons'>
|
|
11
|
+
<%= render partial: 'header_icons', locals: { document: document } %>
|
|
12
|
+
|
|
4
13
|
<button
|
|
5
|
-
class="caret-toggle btn
|
|
14
|
+
class="caret-toggle btn"
|
|
6
15
|
data-toggle="collapse"
|
|
7
16
|
data-target="#doc-<%= document.id %>-fields-collapse"
|
|
17
|
+
aria-label="<%= t('geoblacklight.metadata.toggle_summary') %>"
|
|
8
18
|
aria-expanded="false"
|
|
9
19
|
aria-controls="doc-<%= document.id %>-fields-collapse">
|
|
10
20
|
</button>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<span class="document-counter">
|
|
14
|
-
<%= t('blacklight.search.documents.counter', :counter => counter) if counter %>
|
|
15
|
-
</span>
|
|
16
|
-
<%= link_to_document document, counter: counter, title: document[blacklight_config.index.title_field] %>
|
|
17
|
-
</span>
|
|
18
|
-
<span class='status-icons'>
|
|
19
|
-
<%= render partial: 'header_icons', locals: { document: document } %>
|
|
20
|
-
</span>
|
|
21
|
-
</h3>
|
|
21
|
+
</span>
|
|
22
|
+
<% end %>
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</div>
|
|
24
|
+
<div class='more-info-area'>
|
|
25
|
+
<div id="doc-<%= document.id %>-fields-collapse" class='collapse'>
|
|
26
|
+
<small>
|
|
27
|
+
<%= geoblacklight_present(:index_fields_display, document) %>
|
|
28
|
+
</small>
|
|
29
29
|
</div>
|
|
30
|
-
|
|
30
|
+
</div>
|