geoblacklight 6.0.0.pre.beta.1 → 6.0.0.pre.beta.3
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 +14 -3
- data/app/assets/stylesheets/geoblacklight/record.css +1 -2
- data/app/assets/stylesheets/geoblacklight/search.css +3 -4
- data/app/assets/stylesheets/geoblacklight.css +0 -1
- data/app/components/geoblacklight/document/download_link_component.html.erb +1 -1
- data/app/components/geoblacklight/document/download_links_component.html.erb +1 -1
- data/app/components/geoblacklight/document/download_links_component.rb +1 -1
- data/app/components/geoblacklight/document/preview_component.html.erb +1 -1
- data/app/components/geoblacklight/document/preview_component.rb +45 -0
- data/app/components/geoblacklight/iiif_drag_drop_component.html.erb +1 -1
- data/app/components/geoblacklight/iiif_drag_drop_component.rb +1 -1
- data/app/components/geoblacklight/login_link_component.html.erb +1 -1
- data/app/components/geoblacklight/login_link_component.rb +17 -1
- data/app/components/geoblacklight/metadata_description_markdown_component.rb +1 -1
- data/app/components/geoblacklight/relations/relation_component.html.erb +2 -4
- data/app/components/geoblacklight/relations/relation_component.rb +0 -4
- data/app/components/geoblacklight/search_result_component.html.erb +2 -4
- data/app/components/geoblacklight/search_result_component.rb +0 -3
- data/app/components/geoblacklight/static_map_component.rb +2 -3
- data/app/controllers/relations_controller.rb +2 -0
- data/app/controllers/viewer_record_controller.rb +2 -0
- data/app/helpers/geoblacklight_helper.rb +5 -19
- data/app/javascript/geoblacklight/controllers/overview_map_controller.js +4 -3
- data/app/javascript/geoblacklight/core.js +0 -2
- data/app/javascript/geoblacklight/initializers/field_truncation.js +1 -4
- data/app/models/concerns/geoblacklight/bbox_filter_field.rb +0 -13
- data/app/models/concerns/geoblacklight/solr_document/preview.rb +58 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +20 -23
- data/app/views/catalog/_document_split.html.erb +1 -1
- data/config/importmap.rb +5 -6
- data/geoblacklight.gemspec +1 -1
- data/lib/generators/geoblacklight/install_generator.rb +3 -6
- data/lib/generators/geoblacklight/templates/assets/customizations.css +13 -4
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +4 -6
- data/lib/generators/geoblacklight/templates/settings.yml +1 -25
- data/lib/geoblacklight/configuration/settings_builder.rb +0 -2
- data/lib/geoblacklight/configuration.rb +1 -19
- data/lib/geoblacklight/constants.rb +1 -0
- data/lib/geoblacklight/references.rb +0 -9
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight.rb +0 -1
- data/spec/components/geoblacklight/citation_component_spec.rb +2 -2
- data/spec/components/geoblacklight/{item_map_viewer_component_spec.rb → document/preview_component_spec.rb} +37 -1
- data/spec/components/geoblacklight/document/sidebar_component_spec.rb +1 -1
- data/spec/components/geoblacklight/document_component_spec.rb +1 -1
- data/spec/components/geoblacklight/download_links_component_spec.rb +1 -1
- data/spec/components/geoblacklight/iiif_drag_drop_component_spec.rb +7 -7
- data/spec/components/geoblacklight/login_link_component_spec.rb +20 -12
- data/spec/components/geoblacklight/relations/relation_component_spec.rb +3 -11
- data/spec/components/geoblacklight/search_result_component_spec.rb +4 -12
- data/spec/components/geoblacklight/static_map_component_spec.rb +19 -10
- data/spec/factories/user.rb +6 -1
- data/spec/features/axe_spec.rb +1 -0
- data/spec/features/restricted_viewer_spec.rb +1 -3
- data/spec/features/search_results_map_spec.rb +13 -0
- data/spec/features/search_spec.rb +1 -1
- data/spec/features/sign_in_spec.rb +26 -0
- data/spec/features/truncated_metadata_spec.rb +0 -5
- data/spec/fixtures/solr_documents/README.md +63 -57
- data/spec/fixtures/solr_documents/b1g_iiif_manifest.json +1 -1
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +1 -0
- data/spec/fixtures/solr_documents/bbox-spans-180.json +3 -3
- data/spec/fixtures/solr_documents/bluemarble.json +28 -0
- data/spec/fixtures/solr_documents/complex-geom.json +3 -3
- data/spec/fixtures/solr_documents/cornell-roads-fgdc.json +19 -0
- data/spec/fixtures/solr_documents/dalian.json +38 -0
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +2 -2
- data/spec/fixtures/solr_documents/metadata_no_provider.json +0 -1
- data/spec/fixtures/solr_documents/modis-ndvi.json +36 -0
- data/spec/fixtures/solr_documents/panama.json +37 -0
- data/spec/fixtures/solr_documents/public_cog_princeton.json +0 -2
- data/spec/fixtures/solr_documents/stanford-geojson.json +39 -0
- data/spec/fixtures/solr_documents/usgs-htmc-index-ca-24000.json +36 -0
- data/spec/fixtures/solr_documents/usgs-tnm-index-dem1.json +28 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +0 -32
- data/spec/lib/geoblacklight/references_spec.rb +8 -14
- data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +0 -24
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +30 -23
- data/spec/requests/bookmarks_spec.rb +1 -0
- data/spec/requests/catalog_search_spec.rb +1 -1
- data/spec/requests/catalog_show_spec.rb +2 -2
- data/spec/requests/index_view_spec.rb +6 -6
- data/spec/requests/metadata_spec.rb +1 -1
- data/spec/requests/missing_metadata_spec.rb +13 -13
- data/spec/requests/search_results_spec.rb +4 -3
- data/spec/requests/viewer_record_spec.rb +1 -3
- data/spec/requests/viewer_requests_spec.rb +3 -5
- data/spec/spec_helper.rb +11 -1
- data/spec/support/authentication.rb +37 -0
- data/spec/support/features/session_helpers.rb +15 -13
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/template.rb +1 -1
- metadata +17 -26
- data/app/assets/stylesheets/geoblacklight/index_maps.css +0 -29
- data/app/components/geoblacklight/item_map_viewer_component.html.erb +0 -1
- data/app/components/geoblacklight/item_map_viewer_component.rb +0 -52
- data/app/controllers/wms_controller.rb +0 -17
- data/app/javascript/geoblacklight/initializers/tooltips.js +0 -51
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +0 -17
- data/lib/geoblacklight/geometry.rb +0 -86
- data/lib/geoblacklight/item_viewer.rb +0 -84
- data/lib/geoblacklight/routes/wms.rb +0 -15
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +0 -37
- data/lib/geoblacklight/wms_layer.rb +0 -34
- data/spec/controllers/wms_controller_spec.rb +0 -34
- data/spec/fixtures/solr_documents/no_locn_geometry.json +0 -17
- data/spec/fixtures/solr_documents/no_spatial.json +0 -28
- data/spec/javascripts/metadata_download_button_spec.js +0 -17
- data/spec/lib/geoblacklight/geometry_spec.rb +0 -60
- data/spec/lib/geoblacklight/item_viewer_spec.rb +0 -77
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +0 -54
- data/spec/lib/geoblacklight/wms_layer_spec.rb +0 -115
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4bad2b1f49d46f5a9a08d037fc5657e39580c959c5b734f593792ab5fcbb9444
|
|
4
|
+
data.tar.gz: fac936179d4dd02b3e621971545a121717e44053532d56dcada8d3a2379fc013
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c48de741adbfebb4fe6c96d5b80c308262803fe64dc3950c5d996439562d573ef637b76a295e07ac4996ed5edcdb5ca0183aabb00763502a3623d004d4caaab
|
|
7
|
+
data.tar.gz: 3475ddfe5b540e19880ad46b5289aadc1c17b0b0bcd8dbdb80d4433310b830b9b7fa791436e0e36cb44de46fa491bb017fc4752c43500163784ec2025b925e81
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -51,9 +51,19 @@ jobs:
|
|
|
51
51
|
strategy:
|
|
52
52
|
matrix:
|
|
53
53
|
ruby_version: ["3.3", "3.4", "4.0"]
|
|
54
|
-
rails_version: ["8.1.
|
|
54
|
+
rails_version: ["8.1.4"]
|
|
55
|
+
auth: ["devise"]
|
|
56
|
+
include:
|
|
57
|
+
- ruby_version: "4.0"
|
|
58
|
+
rails_version: "8.1.4"
|
|
59
|
+
auth: "rails"
|
|
60
|
+
blacklight_install_options: "--authentication --skip-solr"
|
|
61
|
+
- ruby_version: "4.0"
|
|
62
|
+
rails_version: "8.1.4"
|
|
63
|
+
auth: "no"
|
|
64
|
+
blacklight_install_options: "--skip-solr"
|
|
55
65
|
|
|
56
|
-
name: test ruby ${{ matrix.ruby_version }} / rails ${{ matrix.rails_version }}
|
|
66
|
+
name: test ruby ${{ matrix.ruby_version }} / rails ${{ matrix.rails_version }} / ${{ matrix.auth }} auth
|
|
57
67
|
steps:
|
|
58
68
|
- uses: actions/checkout@v7
|
|
59
69
|
- name: Set up Ruby
|
|
@@ -71,9 +81,10 @@ jobs:
|
|
|
71
81
|
BUNDLE_FORCE_RUBY_PLATFORM: true
|
|
72
82
|
RAILS_VERSION: ${{ matrix.rails_version }}
|
|
73
83
|
SOLR_URL: http://solr:SolrRocks@localhost:8983/solr/blacklight-core
|
|
84
|
+
BLACKLIGHT_INSTALL_OPTIONS: ${{ matrix.blacklight_install_options }}
|
|
74
85
|
- name: Upload coverage artifacts
|
|
75
86
|
if: always()
|
|
76
87
|
uses: actions/upload-artifact@v7
|
|
77
88
|
with:
|
|
78
|
-
name: "coverage-${{ matrix.ruby_version }}-${{ matrix.rails_version }}"
|
|
89
|
+
name: "coverage-${{ matrix.ruby_version }}-${{ matrix.rails_version }}-${{ matrix.auth }}-auth"
|
|
79
90
|
path: coverage/
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
margin: 0 1rem 0 0;
|
|
14
14
|
|
|
15
15
|
a {
|
|
16
|
-
color: var(--bs-
|
|
16
|
+
color: var(--bs-tertiary-color);
|
|
17
17
|
background-color: var(--bs-body-bg);
|
|
18
18
|
text-decoration: none;
|
|
19
19
|
border: var(--bs-border-width) solid var(--bs-border-color);
|
|
20
20
|
border-radius: var(--bs-border-radius);
|
|
21
|
-
box-shadow: var(--bs-box-shadow);
|
|
21
|
+
box-shadow: var(--bs-box-shadow-sm);
|
|
22
22
|
overflow: hidden;
|
|
23
23
|
display: flex;
|
|
24
24
|
place-content: center;
|
|
@@ -86,8 +86,7 @@
|
|
|
86
86
|
margin-bottom: 0.5em;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
.description
|
|
90
|
-
display: inline;
|
|
89
|
+
.description {
|
|
91
90
|
margin: 0;
|
|
92
91
|
}
|
|
93
92
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
/* GBL CSS */
|
|
4
4
|
@import url("geoblacklight/global.css");
|
|
5
5
|
@import url("geoblacklight/viewers.css");
|
|
6
|
-
@import url("geoblacklight/index_maps.css");
|
|
7
6
|
@import url("geoblacklight/record.css");
|
|
8
7
|
@import url("geoblacklight/home.css");
|
|
9
8
|
@import url("geoblacklight/search.css");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<li class="download list-group-item list-group-item-action">
|
|
2
|
-
<%= link_to url, class: 'nav-link'
|
|
2
|
+
<%= link_to url, class: 'nav-link' do %>
|
|
3
3
|
<% if file_type.present? %><span class="badge file-type-badge"><%= file_type %></span><% end %><span class="title"><%= title %></span>
|
|
4
4
|
<% end %>
|
|
5
5
|
</li>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Geoblacklight
|
|
2
4
|
module Document
|
|
3
5
|
class PreviewComponent < ViewComponent::Base
|
|
@@ -6,9 +8,52 @@ module Geoblacklight
|
|
|
6
8
|
super()
|
|
7
9
|
end
|
|
8
10
|
|
|
11
|
+
# Override this to switch the viewer used for a given preview type.
|
|
12
|
+
# Default is to embed embeds and use ogm-viewer for everything else.
|
|
13
|
+
def display_tag
|
|
14
|
+
case @document.preferred_preview_type
|
|
15
|
+
when :embed
|
|
16
|
+
oembed_tag
|
|
17
|
+
when :map, :iiif
|
|
18
|
+
ogm_viewer_tag
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
9
22
|
def render?
|
|
10
23
|
@document.previewable?
|
|
11
24
|
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def oembed_tag
|
|
29
|
+
tag.div(nil,
|
|
30
|
+
id: "oembed-viewer",
|
|
31
|
+
class: "viewer oembed-viewer",
|
|
32
|
+
data: {
|
|
33
|
+
controller: "oembed-viewer",
|
|
34
|
+
oembed_viewer_url_value: @document.oembed
|
|
35
|
+
})
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def ogm_viewer_tag
|
|
39
|
+
tag.ogm_viewer(nil,
|
|
40
|
+
:class => "viewer ogm-viewer",
|
|
41
|
+
"hide-title" => true,
|
|
42
|
+
"theme" => helpers.geoblacklight_viewer_theme,
|
|
43
|
+
"light-basemap" => Geoblacklight.configuration.light_basemap_url,
|
|
44
|
+
"dark-basemap" => Geoblacklight.configuration.dark_basemap_url,
|
|
45
|
+
"record-url" => helpers.viewer_solr_document_path(@document),
|
|
46
|
+
:data => {restricted_origins: restricted_origins})
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# URLs where the viewer will send credentials (cookies) to, in order to try
|
|
50
|
+
# to preview restricted data
|
|
51
|
+
def restricted_origins
|
|
52
|
+
origins = Geoblacklight.configuration.restricted_origins
|
|
53
|
+
return if origins.blank? || !@document.restricted? || !helpers.document_available?(@document)
|
|
54
|
+
|
|
55
|
+
origins.to_json
|
|
56
|
+
end
|
|
12
57
|
end
|
|
13
58
|
end
|
|
14
59
|
end
|
|
@@ -4,7 +4,7 @@ module Geoblacklight
|
|
|
4
4
|
class IiifDragDropComponent < ViewComponent::Base
|
|
5
5
|
def initialize(document:)
|
|
6
6
|
super()
|
|
7
|
-
manifest_ref = document.
|
|
7
|
+
manifest_ref = document.references.iiif_manifest
|
|
8
8
|
@manifest = manifest_ref&.endpoint || ""
|
|
9
9
|
@href_link = Geoblacklight.configuration.iiif_drag_drop_link.gsub("@manifest", @manifest)
|
|
10
10
|
end
|
|
@@ -10,8 +10,24 @@ module Geoblacklight
|
|
|
10
10
|
super()
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def before_render
|
|
14
|
+
store_return_location if render?
|
|
15
|
+
end
|
|
16
|
+
|
|
13
17
|
def render?
|
|
14
|
-
document.restricted? &&
|
|
18
|
+
document.restricted? &&
|
|
19
|
+
document.same_institution? &&
|
|
20
|
+
helpers.blacklight_login_path.present? &&
|
|
21
|
+
!helpers.current_user_signed_in?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
# Bring the user back to this record once they've signed in, for either
|
|
27
|
+
# Devise or Rails auth.
|
|
28
|
+
def store_return_location
|
|
29
|
+
controller.store_location_for(:user, request.original_url) if controller.respond_to?(:store_location_for)
|
|
30
|
+
controller.send(:store_location_for_rails_authentication)
|
|
15
31
|
end
|
|
16
32
|
end
|
|
17
33
|
end
|
|
@@ -8,7 +8,7 @@ module Geoblacklight
|
|
|
8
8
|
close_text: t("geoblacklight.truncate.close"),
|
|
9
9
|
max_lines: 12
|
|
10
10
|
}) do
|
|
11
|
-
safe_join(Array(@field.values).flatten.map { |value|
|
|
11
|
+
safe_join(Array(@field.values).flatten.map { |value| Commonmarker.to_html(value).html_safe })
|
|
12
12
|
end]
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
<li class="list-group-item">
|
|
2
2
|
<%= link_to document.title, solr_document_path(document) %>
|
|
3
3
|
<%= render Geoblacklight::HeaderBadgesComponent.new(document: document) %>
|
|
4
|
-
<% if document.
|
|
5
|
-
|
|
6
|
-
<%= description %>
|
|
7
|
-
</div>
|
|
4
|
+
<% if document.description_text.present? %>
|
|
5
|
+
<%= content_tag :p, truncate(document.description_text, length: 125, separator: /\s/), class: "description" %>
|
|
8
6
|
<% end %>
|
|
9
7
|
<% if render_sibling_link? %>
|
|
10
8
|
<%= link_to t("geoblacklight.relations.browse.#{browse_label_key}", count: sibling_count), sibling_search_path, class: "browse-all" %>
|
|
@@ -12,10 +12,6 @@ module Geoblacklight
|
|
|
12
12
|
super()
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def description
|
|
16
|
-
safe_join(Array(document.description).map { |value| helpers.markdown_to_html(value) })
|
|
17
|
-
end
|
|
18
|
-
|
|
19
15
|
# sibling_count includes the current document itself, so there's only something
|
|
20
16
|
# worth browsing to when it's more than just that one document.
|
|
21
17
|
def render_sibling_link?
|
|
@@ -18,10 +18,8 @@
|
|
|
18
18
|
<%= title %>
|
|
19
19
|
<div class="metadata">
|
|
20
20
|
<%= render Geoblacklight::HeaderBadgesComponent.new(document: @document) %>
|
|
21
|
-
<% if document.
|
|
22
|
-
|
|
23
|
-
<%= description %>
|
|
24
|
-
</div>
|
|
21
|
+
<% if document.description_text.present? %>
|
|
22
|
+
<%= content_tag :p, truncate(document.description_text, length: 250, separator: /\s/), class: "description", itemprop: "description" %>
|
|
25
23
|
<% end %>
|
|
26
24
|
</div>
|
|
27
25
|
</div>
|
|
@@ -9,8 +9,5 @@ module Geoblacklight
|
|
|
9
9
|
# Otherwise view_component will not provide the count value when calling the component.
|
|
10
10
|
#
|
|
11
11
|
class SearchResultComponent < Blacklight::DocumentComponent
|
|
12
|
-
def description
|
|
13
|
-
safe_join(Array(document.description).map { |value| helpers.markdown_to_html(value) })
|
|
14
|
-
end
|
|
15
12
|
end
|
|
16
13
|
end
|
|
@@ -9,10 +9,9 @@ module Geoblacklight
|
|
|
9
9
|
super()
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
# If there's no preview
|
|
13
|
-
# is not georeferenced, we need to see where the item is located.
|
|
12
|
+
# If there's no map preview, we need to see where the record is located.
|
|
14
13
|
def render?
|
|
15
|
-
!@document.
|
|
14
|
+
!@document.map_previewable?
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
def before_render
|
|
@@ -5,6 +5,8 @@ class RelationsController < ApplicationController
|
|
|
5
5
|
|
|
6
6
|
copy_blacklight_config_from(CatalogController)
|
|
7
7
|
|
|
8
|
+
allow_unauthenticated_access raise: false if respond_to?(:allow_unauthenticated_access)
|
|
9
|
+
|
|
8
10
|
def index
|
|
9
11
|
@relations = Geoblacklight::Relations::RelationResponse.new(params[:id], repository)
|
|
10
12
|
render layout: !(request.xhr? || request.headers["Turbo-Frame"].present?)
|
|
@@ -6,6 +6,8 @@ class ViewerRecordController < ApplicationController
|
|
|
6
6
|
|
|
7
7
|
copy_blacklight_config_from(CatalogController)
|
|
8
8
|
|
|
9
|
+
allow_unauthenticated_access raise: false if respond_to?(:allow_unauthenticated_access)
|
|
10
|
+
|
|
9
11
|
rescue_from Blacklight::Exceptions::RecordNotFound do
|
|
10
12
|
head :not_found
|
|
11
13
|
end
|
|
@@ -24,7 +24,11 @@ module GeoblacklightHelper
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def document_available?(document)
|
|
27
|
-
document.public? || (document.same_institution? &&
|
|
27
|
+
document.public? || (document.same_institution? && current_user_signed_in?)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def current_user_signed_in?
|
|
31
|
+
controller.respond_to?(:current_user) && current_user.present?
|
|
28
32
|
end
|
|
29
33
|
|
|
30
34
|
# If you turn off dark mode support, Geoblacklight will display in light mode,
|
|
@@ -36,14 +40,6 @@ module GeoblacklightHelper
|
|
|
36
40
|
"light"
|
|
37
41
|
end
|
|
38
42
|
|
|
39
|
-
##
|
|
40
|
-
# Transform markdown into HTML
|
|
41
|
-
# @param [String] value markdown to transform
|
|
42
|
-
# @return [ActiveSupport::SafeBuffer] rendered HTML
|
|
43
|
-
def markdown_to_html(value)
|
|
44
|
-
Commonmarker.to_html(value).html_safe
|
|
45
|
-
end
|
|
46
|
-
|
|
47
43
|
##
|
|
48
44
|
# Returns an SVG icon or empty HTML span element
|
|
49
45
|
# @return [SVG or HTML tag]
|
|
@@ -76,16 +72,6 @@ module GeoblacklightHelper
|
|
|
76
72
|
link_to(endpoint, endpoint)
|
|
77
73
|
end
|
|
78
74
|
|
|
79
|
-
## Returns the data-page attribute value used as the JS map selector
|
|
80
|
-
def results_js_map_selector(controller_name)
|
|
81
|
-
case controller_name
|
|
82
|
-
when "bookmarks"
|
|
83
|
-
"bookmarks"
|
|
84
|
-
else
|
|
85
|
-
"index"
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
75
|
##
|
|
90
76
|
# Blacklight view_config.thumbnail_method contract. Renders the document's
|
|
91
77
|
# configured thumbnail_url as an <img>, or nil if unavailable/disabled.
|
|
@@ -41,17 +41,18 @@ export default class OverviewMapController extends Controller {
|
|
|
41
41
|
if (this.rows().length) this.watchResults()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// Build a
|
|
44
|
+
// Build a record containing the geometry for each search result.
|
|
45
45
|
// NOTE: results with no geometry still have to take up a number, because the
|
|
46
46
|
// numbering has to match the search result list.
|
|
47
|
-
locations({
|
|
47
|
+
locations({ OgmRecord, locationFor }, results) {
|
|
48
48
|
const places = results.map(({ place }) => Number(place)).filter((place) => place)
|
|
49
49
|
const locations = Array.from({ length: places.length ? Math.max(...places) : 0 })
|
|
50
50
|
|
|
51
51
|
results.forEach(({ id, place, geometry }) => {
|
|
52
52
|
if (!place || !geometry) return
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
// OgmRecord only reads Aardvark, which is the only schema GeoBlacklight indexes
|
|
55
|
+
locations[place - 1] = locationFor(new OgmRecord({ id, gbl_mdVersion_s: "Aardvark", locn_geometry: geometry }))
|
|
55
56
|
})
|
|
56
57
|
|
|
57
58
|
return locations
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Initializers
|
|
2
|
-
import initializeTooltips from "geoblacklight/initializers/tooltips"
|
|
3
2
|
import initializeTruncation from "geoblacklight/initializers/truncation"
|
|
4
3
|
import initializeFieldTruncation from "geoblacklight/initializers/field_truncation"
|
|
5
4
|
import initializeMetadataDownload from "geoblacklight/initializers/metadata_download"
|
|
@@ -41,7 +40,6 @@ Geoblacklight.listeners().forEach((listener) =>
|
|
|
41
40
|
)
|
|
42
41
|
|
|
43
42
|
// Register our initializers
|
|
44
|
-
Geoblacklight.onLoad(initializeTooltips)
|
|
45
43
|
Geoblacklight.onLoad(initializeTruncation)
|
|
46
44
|
Geoblacklight.onLoad(initializeFieldTruncation)
|
|
47
45
|
Geoblacklight.onLoad(initializeMetadataDownload)
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// Class that hides a field's values past its limit and adds a button to reveal them.
|
|
4
4
|
// The hidden values are only hidden visually, so assistive technology is given the whole
|
|
5
|
-
// list up front.
|
|
6
|
-
// aria-disabled and its label says why.
|
|
5
|
+
// list up front.
|
|
7
6
|
class FieldTruncator {
|
|
8
7
|
constructor(element) {
|
|
9
8
|
this.slot = element.querySelector(":scope > dd.read-more-slot")
|
|
@@ -27,8 +26,6 @@ class FieldTruncator {
|
|
|
27
26
|
// add the button
|
|
28
27
|
this.button = document.createElement("button")
|
|
29
28
|
this.button.classList.add("btn", "btn-link", "p-0", "border-0", "read-more")
|
|
30
|
-
this.button.setAttribute("aria-disabled", "true")
|
|
31
|
-
this.button.setAttribute("aria-label", element.dataset.buttonLabel)
|
|
32
29
|
this.button.addEventListener("click", this.toggle.bind(this))
|
|
33
30
|
|
|
34
31
|
// start collapsed
|
|
@@ -47,18 +47,5 @@ module Geoblacklight
|
|
|
47
47
|
# @param [String,#value] a filter to remove from the url
|
|
48
48
|
# @return [Boolean] whether the provided filter is currently applied/selected
|
|
49
49
|
delegate :include?, to: :values
|
|
50
|
-
|
|
51
|
-
# @since Blacklight v7.25.0
|
|
52
|
-
# normal filter fields demangle when they encounter a hash, which they assume to be a number-indexed map
|
|
53
|
-
def needs_normalization?(value_params)
|
|
54
|
-
value_params.is_a?(Hash) && value_params.keys.map(&:to_s).all? { |k| k =~ /^\d+$/ }
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# @since Blacklight v7.25.0
|
|
58
|
-
# value should be the first value from a mangled hash,
|
|
59
|
-
# otherwise return the value as-is
|
|
60
|
-
def normalize(value_params)
|
|
61
|
-
needs_normalization?(value_params) ? value_params.values : value_params
|
|
62
|
-
end
|
|
63
50
|
end
|
|
64
51
|
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Geoblacklight
|
|
4
|
+
module SolrDocument
|
|
5
|
+
# Helper methods for determining whether and how to preview a document
|
|
6
|
+
module Preview
|
|
7
|
+
extend ActiveSupport::Concern
|
|
8
|
+
|
|
9
|
+
# Reference types that are previewed via embedding
|
|
10
|
+
EMBED_PREVIEWS = %i[oembed].freeze
|
|
11
|
+
|
|
12
|
+
# Reference types that are previewed using a map viewer
|
|
13
|
+
MAP_PREVIEWS = %i[
|
|
14
|
+
cog dynamic_map_layer feature_layer image_map_layer index_map pmtiles
|
|
15
|
+
tiled_map_layer tilejson tms wms wmts xyz geojson
|
|
16
|
+
].freeze
|
|
17
|
+
|
|
18
|
+
# Reference types that are previewed using a IIIF viewer
|
|
19
|
+
IIIF_PREVIEWS = %i[iiif iiif_manifest].freeze
|
|
20
|
+
|
|
21
|
+
# Whether the item viewer has anything to preview
|
|
22
|
+
def previewable?
|
|
23
|
+
embed_previewable? || map_previewable? || iiif_previewable?
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Tells the viewer what preview to use, if any
|
|
27
|
+
def preferred_preview_type
|
|
28
|
+
if embed_previewable?
|
|
29
|
+
:embed
|
|
30
|
+
elsif map_previewable?
|
|
31
|
+
:map
|
|
32
|
+
elsif iiif_previewable?
|
|
33
|
+
:iiif
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def embed_previewable?
|
|
38
|
+
any_refs_with_endpoint?(EMBED_PREVIEWS)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Georeferenced IIIF manifests can be previewed using a map too (Allmaps)
|
|
42
|
+
def map_previewable?
|
|
43
|
+
any_refs_with_endpoint?(MAP_PREVIEWS) || iiif_georeferenced?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def iiif_previewable?
|
|
47
|
+
any_refs_with_endpoint?(IIIF_PREVIEWS)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
# Are there any of the provided reference types with a non-empty URL?
|
|
53
|
+
def any_refs_with_endpoint?(types)
|
|
54
|
+
types.any? { |type| references.references(type)&.endpoint.present? }
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -6,22 +6,21 @@ module Geoblacklight
|
|
|
6
6
|
extend Blacklight::Solr::Document
|
|
7
7
|
extend ActiveSupport::Concern
|
|
8
8
|
include Geoblacklight::SolrDocument::Finder
|
|
9
|
-
include Geoblacklight::SolrDocument::
|
|
9
|
+
include Geoblacklight::SolrDocument::Preview
|
|
10
10
|
include Geoblacklight::SolrDocument::Arcgis
|
|
11
11
|
include Geoblacklight::SolrDocument::Citation
|
|
12
12
|
include Geoblacklight::SolrDocument::Thumbnail
|
|
13
13
|
|
|
14
|
-
delegate :viewer_protocol, to: :item_viewer
|
|
15
|
-
delegate :viewer_endpoint, to: :item_viewer
|
|
16
|
-
|
|
17
14
|
included do
|
|
18
15
|
field_config = Geoblacklight.configuration.fields
|
|
19
16
|
attribute :display_note, :array, field_config.display_note
|
|
20
17
|
attribute :description, :array, field_config.description
|
|
21
18
|
attribute :geom_field, :string, field_config.geometry
|
|
22
19
|
attribute :wxs_identifier, :string, field_config.wxs_identifier
|
|
23
|
-
attribute :
|
|
24
|
-
attribute :
|
|
20
|
+
attribute :access_rights, :string, field_config.access_rights
|
|
21
|
+
attribute :rights, :array, field_config.rights
|
|
22
|
+
attribute :rights_holder, :array, field_config.rights_holder
|
|
23
|
+
attribute :license_uris, :array, field_config.license
|
|
25
24
|
attribute :provider, :string, field_config.provider
|
|
26
25
|
attribute :resource_type, :array, field_config.resource_type
|
|
27
26
|
attribute :resource_class, :array, field_config.resource_class
|
|
@@ -39,27 +38,19 @@ module Geoblacklight
|
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
def public?
|
|
42
|
-
|
|
41
|
+
access_rights&.casecmp?("public")
|
|
43
42
|
end
|
|
44
43
|
|
|
45
44
|
def restricted?
|
|
46
|
-
!
|
|
45
|
+
!access_rights || access_rights.casecmp?("restricted")
|
|
47
46
|
end
|
|
48
47
|
|
|
49
48
|
def downloadable?
|
|
50
49
|
(direct_download || iiif_download) && available?
|
|
51
50
|
end
|
|
52
51
|
|
|
53
|
-
def iiif_preview?
|
|
54
|
-
viewer_protocol == "iiif" || viewer_protocol == "iiif_manifest"
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def previewable?
|
|
58
|
-
viewer_endpoint.present?
|
|
59
|
-
end
|
|
60
|
-
|
|
61
52
|
def references
|
|
62
|
-
References.new(self)
|
|
53
|
+
@references ||= References.new(self)
|
|
63
54
|
end
|
|
64
55
|
|
|
65
56
|
def direct_download
|
|
@@ -78,6 +69,10 @@ module Geoblacklight
|
|
|
78
69
|
references.iiif.to_hash if references.iiif.present?
|
|
79
70
|
end
|
|
80
71
|
|
|
72
|
+
def iiif_georeferenced?
|
|
73
|
+
references.iiif_manifest.present? && references.iiif_georeference.present?
|
|
74
|
+
end
|
|
75
|
+
|
|
81
76
|
def data_dictionary_download
|
|
82
77
|
references.data_dictionary.to_hash if references.data_dictionary.present?
|
|
83
78
|
end
|
|
@@ -86,16 +81,18 @@ module Geoblacklight
|
|
|
86
81
|
references.url&.endpoint
|
|
87
82
|
end
|
|
88
83
|
|
|
89
|
-
def item_viewer
|
|
90
|
-
ItemViewer.new(references)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
84
|
def itemtype
|
|
94
85
|
"http://schema.org/Dataset"
|
|
95
86
|
end
|
|
96
87
|
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
# Joined HTML of all description fields; this removes markdown formatting
|
|
89
|
+
def description_html
|
|
90
|
+
safe_join(Array(description).map { |value| Commonmarker.to_html(value).html_safe })
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Plain text description; strip_tags helper doesn't handle HTML entities
|
|
94
|
+
def description_text
|
|
95
|
+
Nokogiri::HTML5.fragment(description_html).text.squish
|
|
99
96
|
end
|
|
100
97
|
end
|
|
101
98
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<%
|
|
4
4
|
overview_results = document_presenters.each_with_index.map do |presenter, index|
|
|
5
5
|
document = presenter.document
|
|
6
|
-
{id: document.id, place: document_counter_with_offset(index), geometry:
|
|
6
|
+
{id: document.id, place: document_counter_with_offset(index), geometry: document.geom_field}
|
|
7
7
|
end
|
|
8
8
|
-%>
|
|
9
9
|
<%= tag.div id: "documents", class: "documents-list", data: {overview_map_results: overview_results.to_json} do %>
|
data/config/importmap.rb
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# OGM viewer components
|
|
4
|
-
|
|
5
|
-
pin "ogm-
|
|
6
|
-
pin "ogm-
|
|
7
|
-
pin "ogm-locator", to: "https://unpkg.com/ogm-viewer@1.2.0/dist/components/ogm-locator.js"
|
|
3
|
+
# OGM viewer web components
|
|
4
|
+
pin "ogm-viewer", to: "https://unpkg.com/ogm-viewer@1.7.0/dist/components/ogm-viewer.js"
|
|
5
|
+
pin "ogm-overview", to: "https://unpkg.com/ogm-viewer@1.7.0/dist/components/ogm-overview.js"
|
|
6
|
+
pin "ogm-locator", to: "https://unpkg.com/ogm-viewer@1.7.0/dist/components/ogm-locator.js"
|
|
8
7
|
|
|
9
8
|
# OGM viewer library, used for constructing the location previewers handed to the results map.
|
|
10
9
|
# Not preloaded because only the pages with that map want it; loaded dynamically there.
|
|
11
|
-
pin "ogm-viewer/lib", to: "https://unpkg.com/ogm-viewer@1.
|
|
10
|
+
pin "ogm-viewer/lib", to: "https://unpkg.com/ogm-viewer@1.7.0/dist/components/index.js", preload: false
|
|
12
11
|
|
|
13
12
|
# Geoblacklight
|
|
14
13
|
pin_all_from Geoblacklight::Engine.root.join("app", "javascript", "geoblacklight"), under: "geoblacklight"
|
data/geoblacklight.gemspec
CHANGED
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
spec.add_dependency "faraday-follow_redirects"
|
|
27
27
|
spec.add_dependency "coderay"
|
|
28
28
|
spec.add_dependency "deprecation"
|
|
29
|
-
spec.add_dependency "geo_combine", "~> 0.
|
|
29
|
+
spec.add_dependency "geo_combine", "~> 0.12"
|
|
30
30
|
spec.add_dependency "mime-types"
|
|
31
31
|
spec.add_dependency "rgeo-geojson"
|
|
32
32
|
|