geoblacklight 6.0.0.pre.beta.2 → 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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/geoblacklight/record.css +1 -2
  3. data/app/assets/stylesheets/geoblacklight/search.css +3 -4
  4. data/app/assets/stylesheets/geoblacklight.css +0 -1
  5. data/app/components/geoblacklight/document/download_link_component.html.erb +1 -1
  6. data/app/components/geoblacklight/document/download_links_component.html.erb +1 -1
  7. data/app/components/geoblacklight/document/download_links_component.rb +1 -1
  8. data/app/components/geoblacklight/document/preview_component.html.erb +1 -1
  9. data/app/components/geoblacklight/document/preview_component.rb +45 -0
  10. data/app/components/geoblacklight/iiif_drag_drop_component.rb +1 -1
  11. data/app/components/geoblacklight/metadata_description_markdown_component.rb +1 -1
  12. data/app/components/geoblacklight/relations/relation_component.html.erb +2 -4
  13. data/app/components/geoblacklight/relations/relation_component.rb +0 -4
  14. data/app/components/geoblacklight/search_result_component.html.erb +2 -4
  15. data/app/components/geoblacklight/search_result_component.rb +0 -3
  16. data/app/components/geoblacklight/static_map_component.rb +2 -3
  17. data/app/helpers/geoblacklight_helper.rb +0 -18
  18. data/app/javascript/geoblacklight/controllers/overview_map_controller.js +4 -3
  19. data/app/javascript/geoblacklight/initializers/field_truncation.js +1 -4
  20. data/app/models/concerns/geoblacklight/bbox_filter_field.rb +0 -13
  21. data/app/models/concerns/geoblacklight/solr_document/preview.rb +58 -0
  22. data/app/models/concerns/geoblacklight/solr_document.rb +20 -23
  23. data/app/views/catalog/_document_split.html.erb +1 -1
  24. data/config/importmap.rb +5 -6
  25. data/geoblacklight.gemspec +1 -1
  26. data/lib/generators/geoblacklight/templates/assets/customizations.css +13 -4
  27. data/lib/generators/geoblacklight/templates/catalog_controller.rb +4 -6
  28. data/lib/geoblacklight/constants.rb +1 -0
  29. data/lib/geoblacklight/references.rb +0 -9
  30. data/lib/geoblacklight/version.rb +1 -1
  31. data/spec/components/geoblacklight/citation_component_spec.rb +2 -2
  32. data/spec/components/geoblacklight/{item_map_viewer_component_spec.rb → document/preview_component_spec.rb} +6 -1
  33. data/spec/components/geoblacklight/download_links_component_spec.rb +1 -1
  34. data/spec/components/geoblacklight/iiif_drag_drop_component_spec.rb +7 -7
  35. data/spec/components/geoblacklight/relations/relation_component_spec.rb +3 -11
  36. data/spec/components/geoblacklight/search_result_component_spec.rb +4 -12
  37. data/spec/components/geoblacklight/static_map_component_spec.rb +19 -10
  38. data/spec/features/search_results_map_spec.rb +13 -0
  39. data/spec/features/search_spec.rb +1 -1
  40. data/spec/features/truncated_metadata_spec.rb +0 -5
  41. data/spec/fixtures/solr_documents/README.md +63 -57
  42. data/spec/fixtures/solr_documents/b1g_iiif_manifest.json +1 -1
  43. data/spec/fixtures/solr_documents/baruch_documentation_download.json +1 -0
  44. data/spec/fixtures/solr_documents/bbox-spans-180.json +3 -3
  45. data/spec/fixtures/solr_documents/bluemarble.json +28 -0
  46. data/spec/fixtures/solr_documents/complex-geom.json +3 -3
  47. data/spec/fixtures/solr_documents/cornell-roads-fgdc.json +19 -0
  48. data/spec/fixtures/solr_documents/dalian.json +38 -0
  49. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
  50. data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +2 -2
  51. data/spec/fixtures/solr_documents/metadata_no_provider.json +0 -1
  52. data/spec/fixtures/solr_documents/modis-ndvi.json +36 -0
  53. data/spec/fixtures/solr_documents/panama.json +37 -0
  54. data/spec/fixtures/solr_documents/public_cog_princeton.json +0 -2
  55. data/spec/fixtures/solr_documents/stanford-geojson.json +39 -0
  56. data/spec/fixtures/solr_documents/usgs-htmc-index-ca-24000.json +36 -0
  57. data/spec/fixtures/solr_documents/usgs-tnm-index-dem1.json +28 -0
  58. data/spec/helpers/geoblacklight_helper_spec.rb +0 -32
  59. data/spec/lib/geoblacklight/references_spec.rb +8 -14
  60. data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +0 -24
  61. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +30 -23
  62. data/spec/requests/catalog_search_spec.rb +1 -1
  63. data/spec/requests/catalog_show_spec.rb +2 -2
  64. data/spec/requests/index_view_spec.rb +6 -6
  65. data/spec/requests/metadata_spec.rb +1 -1
  66. data/spec/requests/missing_metadata_spec.rb +13 -13
  67. data/spec/requests/search_results_spec.rb +4 -3
  68. data/spec/spec_helper.rb +5 -0
  69. metadata +13 -16
  70. data/app/assets/stylesheets/geoblacklight/index_maps.css +0 -29
  71. data/app/components/geoblacklight/item_map_viewer_component.html.erb +0 -1
  72. data/app/components/geoblacklight/item_map_viewer_component.rb +0 -52
  73. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +0 -17
  74. data/lib/geoblacklight/geometry.rb +0 -86
  75. data/lib/geoblacklight/item_viewer.rb +0 -84
  76. data/spec/fixtures/solr_documents/no_locn_geometry.json +0 -17
  77. data/spec/fixtures/solr_documents/no_spatial.json +0 -28
  78. data/spec/javascripts/metadata_download_button_spec.js +0 -17
  79. data/spec/lib/geoblacklight/geometry_spec.rb +0 -60
  80. data/spec/lib/geoblacklight/item_viewer_spec.rb +0 -77
  81. 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: 321f6ba33268ae5d69c4ab0030a91515ac2e5f84805fb4b6d11044692d1a9f15
4
- data.tar.gz: 4c95b22d126e274ba26fd6402dbe1174c2a4f865e94ef85c6d35451b72683c27
3
+ metadata.gz: 4bad2b1f49d46f5a9a08d037fc5657e39580c959c5b734f593792ab5fcbb9444
4
+ data.tar.gz: fac936179d4dd02b3e621971545a121717e44053532d56dcada8d3a2379fc013
5
5
  SHA512:
6
- metadata.gz: 4b1303681dee3d6ed7c82f00f30d16ee0e12e4f0b8430fd26f0be02416f060ed538976ada2f6b86595ceeec2ce99853f2e812df65347c5e5cfd5994bc43fb459
7
- data.tar.gz: b1e70fddc4c7f4d5b423b6e5dee103171386b38668ad0aca54bf1718eeec88e17a2e37ae2319854ffc26d41ca069b0693d0f05459560f6e1a4010c0fc4f5b440
6
+ metadata.gz: 1c48de741adbfebb4fe6c96d5b80c308262803fe64dc3950c5d996439562d573ef637b76a295e07ac4996ed5edcdb5ca0183aabb00763502a3623d004d4caaab
7
+ data.tar.gz: 3475ddfe5b540e19880ad46b5289aadc1c17b0b0bcd8dbdb80d4433310b830b9b7fa791436e0e36cb44de46fa491bb017fc4752c43500163784ec2025b925e81
@@ -69,8 +69,7 @@
69
69
  font-size: calc(var(--bs-body-font-size) * 0.75);
70
70
  }
71
71
 
72
- .description p {
73
- display: inline;
72
+ .description {
74
73
  margin: 0;
75
74
  }
76
75
 
@@ -13,12 +13,12 @@
13
13
  margin: 0 1rem 0 0;
14
14
 
15
15
  a {
16
- color: var(--bs-body-color);
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 p {
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', data: @data do %>
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,4 +1,4 @@
1
- <div data-controller="downloads" class="downloads card">
1
+ <div class="downloads card">
2
2
  <div class="card-header">
3
3
  <h2 class="mb-0 h6"><%= t("geoblacklight.download.downloads") %></h2>
4
4
  </div>
@@ -38,7 +38,7 @@ module Geoblacklight
38
38
  else
39
39
  child_component.new(
40
40
  url: entry,
41
- data_file_type: document.file_format
41
+ data_file_type: document.format
42
42
  )
43
43
  end
44
44
  end
@@ -1,4 +1,4 @@
1
1
  <div id="viewer-container">
2
- <%= render Geoblacklight::ItemMapViewerComponent.new(document: @document) %>
2
+ <%= display_tag %>
3
3
  <%= render Geoblacklight::IiifDragDropComponent.new(document: @document) %>
4
4
  </div>
@@ -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.item_viewer&.iiif_manifest
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
@@ -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| helpers.markdown_to_html(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.description.present? %>
5
- <div class="truncate-abstract description" data-read-more-text="<%= t("geoblacklight.truncate.read_more") %>" data-close-text="<%= t("geoblacklight.truncate.close") %>" data-max-lines=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.description.present? %>
22
- <div class="truncate-abstract description" data-read-more-text="<%= t("geoblacklight.truncate.read_more") %>" data-close-text="<%= t("geoblacklight.truncate.close") %>" data-max-lines=4 itemprop="description">
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 using the big map, or there is a IIIF preview that
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.previewable? || (@document.iiif_preview? && !@document.georeferenced?)
14
+ !@document.map_previewable?
16
15
  end
17
16
 
18
17
  def before_render
@@ -40,14 +40,6 @@ module GeoblacklightHelper
40
40
  "light"
41
41
  end
42
42
 
43
- ##
44
- # Transform markdown into HTML
45
- # @param [String] value markdown to transform
46
- # @return [ActiveSupport::SafeBuffer] rendered HTML
47
- def markdown_to_html(value)
48
- Commonmarker.to_html(value).html_safe
49
- end
50
-
51
43
  ##
52
44
  # Returns an SVG icon or empty HTML span element
53
45
  # @return [SVG or HTML tag]
@@ -80,16 +72,6 @@ module GeoblacklightHelper
80
72
  link_to(endpoint, endpoint)
81
73
  end
82
74
 
83
- ## Returns the data-page attribute value used as the JS map selector
84
- def results_js_map_selector(controller_name)
85
- case controller_name
86
- when "bookmarks"
87
- "bookmarks"
88
- else
89
- "index"
90
- end
91
- end
92
-
93
75
  ##
94
76
  # Blacklight view_config.thumbnail_method contract. Renders the document's
95
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 resource and previewer (container for geometry) for each search result.
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({ LocationPreviewer, LocationResource }, results) {
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
- locations[place - 1] = new LocationPreviewer(new LocationResource(id, geometry))
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
@@ -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. That leaves the button useful to sighted users alone, so it is marked
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::Inspection
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 :file_format, :string, field_config.format
24
- attribute :rights_field_data, :string, field_config.access_rights
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
- rights_field_data&.casecmp?("public")
41
+ access_rights&.casecmp?("public")
43
42
  end
44
43
 
45
44
  def restricted?
46
- !rights_field_data || rights_field_data.casecmp?("restricted")
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
- def geometry
98
- @geometry ||= Geoblacklight::Geometry.new(geom_field)
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: JSON.parse(document.geometry.geojson)}
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: the previewer, the map of where a set of records is, and the map of where
4
- # one of them is
5
- pin "ogm-viewer", to: "https://unpkg.com/ogm-viewer@1.4.0/dist/components/ogm-viewer.js"
6
- pin "ogm-overview", to: "https://unpkg.com/ogm-viewer@1.4.0/dist/components/ogm-overview.js"
7
- pin "ogm-locator", to: "https://unpkg.com/ogm-viewer@1.4.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.4.0/dist/components/index.js", preload: false
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"
@@ -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.11"
29
+ spec.add_dependency "geo_combine", "~> 0.12"
30
30
  spec.add_dependency "mime-types"
31
31
  spec.add_dependency "rgeo-geojson"
32
32
 
@@ -1,10 +1,19 @@
1
1
  /* Local Application Customizations */
2
2
 
3
3
  /* Header Logo */
4
- :root {
5
- --bl-logo-image: url("geoblacklight/logo.svg");
4
+ /* Browsers that support light-dark() with images pick the logo from color-scheme */
5
+ @supports (background-image: light-dark(linear-gradient(#fff, #fff), linear-gradient(#000, #000))) {
6
+ :root {
7
+ --bl-logo-image: light-dark(url("geoblacklight/logo.svg"), url("geoblacklight/logo-dark.svg"));
8
+ }
6
9
  }
7
10
 
8
- [data-bs-theme="dark"] {
9
- --bl-logo-image: url("geoblacklight/logo-dark.svg");
11
+ @supports not (background-image: light-dark(linear-gradient(#fff, #fff), linear-gradient(#000, #000))) {
12
+ :root {
13
+ --bl-logo-image: url("geoblacklight/logo.svg");
14
+ }
15
+
16
+ [data-bs-theme="dark"] {
17
+ --bl-logo-image: url("geoblacklight/logo-dark.svg");
18
+ }
10
19
  }
@@ -153,15 +153,13 @@ class CatalogController < ApplicationController
153
153
  # The following fields all feature string values. If there is a value present in the metadata, they fields will show up on the item show page.
154
154
  # The labels and order can be customized. Comment out fields to hide them.
155
155
 
156
- config.add_show_field field_config.alternative_title, label: "Alternative Title",
157
- itemprop: "alt_title"
158
156
  config.add_show_field field_config.description, label: "Description", itemprop: "description",
159
157
  component: Geoblacklight::MetadataDescriptionMarkdownComponent
160
- config.add_show_field field_config.creator, label: "Creator", itemprop: "creator"
161
- config.add_show_field field_config.publisher, label: "Publisher", itemprop: "publisher"
158
+ config.add_show_field field_config.creator, label: "Creator", itemprop: "creator", link_to_facet: true
159
+ config.add_show_field field_config.publisher, label: "Publisher", itemprop: "publisher", link_to_facet: true
162
160
  config.add_show_field field_config.provider, label: "Provider", link_to_facet: true
163
- config.add_show_field field_config.resource_class, label: "Resource Class", itemprop: "class"
164
- config.add_show_field field_config.resource_type, label: "Resource Type", itemprop: "type"
161
+ config.add_show_field field_config.resource_class, label: "Resource Class", itemprop: "class", link_to_facet: true
162
+ config.add_show_field field_config.resource_type, label: "Resource Type", itemprop: "type", link_to_facet: true
165
163
  config.add_show_field field_config.subject, label: "Subject", itemprop: "keywords",
166
164
  link_to_facet: true, layout_component: Geoblacklight::TruncatableMetadataFieldLayoutComponent
167
165
  config.add_show_field field_config.theme, label: "Theme", itemprop: "theme",
@@ -10,6 +10,7 @@ module Geoblacklight
10
10
  html: "http://www.w3.org/1999/xhtml",
11
11
  iiif: "http://iiif.io/api/image",
12
12
  iiif_manifest: "http://iiif.io/api/presentation#manifest",
13
+ iiif_georeference: "https://iiif.io/api/extension/georef/1/context.json",
13
14
  iso19139: "http://www.isotc211.org/schemas/2005/gmd",
14
15
  mods: "http://www.loc.gov/mods/v3",
15
16
  shapefile: "http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf",
@@ -29,13 +29,6 @@ module Geoblacklight
29
29
  @shown_metadata ||= shown_metadata_refs.map { |ref| Geoblacklight::Metadata.instance(ref) }
30
30
  end
31
31
 
32
- ##
33
- # Accessor for a document's file format
34
- # @return [String] file format for the document
35
- def format
36
- @document.file_format
37
- end
38
-
39
32
  ##
40
33
  # @param [String, Symbol] ref_type
41
34
  # @return [Geoblacklight::Reference]
@@ -62,8 +55,6 @@ module Geoblacklight
62
55
  end
63
56
  end
64
57
 
65
- private
66
-
67
58
  ##
68
59
  # Parses the references field of a document
69
60
  # @return [Hash]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Geoblacklight
4
- VERSION = "6.0.0-beta.2"
4
+ VERSION = "6.0.0-beta.3"
5
5
  end
@@ -29,11 +29,11 @@ RSpec.describe Geoblacklight::Document::CitationComponent, type: :component do
29
29
  end
30
30
 
31
31
  context "when the identifier is not a URL and no reference schema.org URL is available" do
32
- let(:fixture) { JSON.parse(read_fixture("solr_documents/no_spatial.json")) }
32
+ let(:fixture) { JSON.parse(read_fixture("solr_documents/display-note.json")) }
33
33
 
34
34
  it "creates a citation with the solr document link" do
35
35
  expect(page)
36
- .to have_text "ASTER Global Emissivity Dataset 1-kilometer V003 - AG1KM. http://test.host/catalog/aster-global-emissivity-dataset-1-kilometer-v003-ag1kmcad20"
36
+ .to have_text "FrobozzCo International. (1983-01-01). Building Footprints, Frobozz Headquarters, 781 GUE. [Shapefile]. FrobozzCo International. http://test.host/catalog/frobozz-111"
37
37
  end
38
38
  end
39
39
  end