geoblacklight 6.0.0.pre.alpha.7 → 6.0.0.pre.beta.2

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 (231) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +14 -3
  3. data/README.md +2 -2
  4. data/Rakefile +1 -17
  5. data/app/assets/images/geoblacklight/logo-dark.svg +31 -0
  6. data/app/assets/images/geoblacklight/logo.svg +10 -10
  7. data/app/assets/stylesheets/geoblacklight/global.css +44 -7
  8. data/app/assets/stylesheets/geoblacklight/index_maps.css +0 -7
  9. data/app/assets/stylesheets/geoblacklight/record.css +33 -9
  10. data/app/assets/stylesheets/geoblacklight/search.css +66 -17
  11. data/app/assets/stylesheets/geoblacklight/viewers.css +18 -111
  12. data/app/assets/stylesheets/geoblacklight.css +0 -5
  13. data/app/components/blacklight/icons/georeferenced_component.rb +23 -0
  14. data/app/components/geoblacklight/document/download_link_component.html.erb +1 -1
  15. data/app/components/geoblacklight/document/preview_component.html.erb +0 -2
  16. data/app/components/geoblacklight/document_component.html.erb +0 -4
  17. data/app/components/geoblacklight/facets/bbox_field_component.html.erb +2 -1
  18. data/app/components/geoblacklight/georeferenced_header_badge_component.rb +16 -0
  19. data/app/components/geoblacklight/header_badge_component.html.erb +4 -2
  20. data/app/components/geoblacklight/header_badge_component.rb +1 -1
  21. data/app/components/geoblacklight/header_badges_component.html.erb +5 -0
  22. data/app/components/geoblacklight/header_badges_component.rb +34 -0
  23. data/app/components/geoblacklight/iiif_drag_drop_component.html.erb +1 -1
  24. data/app/components/geoblacklight/item_map_viewer_component.html.erb +0 -58
  25. data/app/components/geoblacklight/item_map_viewer_component.rb +19 -70
  26. data/app/components/geoblacklight/locator_map_component.rb +31 -0
  27. data/app/components/geoblacklight/login_link_component.html.erb +1 -1
  28. data/app/components/geoblacklight/login_link_component.rb +17 -1
  29. data/app/components/geoblacklight/metadata_description_markdown_component.rb +3 -9
  30. data/app/components/geoblacklight/overview_map_component.html.erb +2 -0
  31. data/app/components/geoblacklight/overview_map_component.rb +86 -0
  32. data/app/components/geoblacklight/relations/relation_component.html.erb +12 -0
  33. data/app/components/geoblacklight/relations/relation_component.rb +30 -0
  34. data/app/components/geoblacklight/relations/relations_component.html.erb +15 -0
  35. data/app/components/geoblacklight/relations/relations_component.rb +59 -0
  36. data/app/components/geoblacklight/resource_header_badge_component.rb +1 -1
  37. data/app/components/geoblacklight/search_result_component.html.erb +14 -33
  38. data/app/components/geoblacklight/search_result_component.rb +2 -14
  39. data/app/components/geoblacklight/static_map_component.rb +3 -14
  40. data/app/components/geoblacklight/truncatable_metadata_field_layout_component.html.erb +7 -0
  41. data/app/components/geoblacklight/truncatable_metadata_field_layout_component.rb +45 -0
  42. data/app/controllers/{relation_controller.rb → relations_controller.rb} +4 -2
  43. data/app/controllers/viewer_record_controller.rb +28 -0
  44. data/app/helpers/geoblacklight_helper.rb +57 -6
  45. data/app/javascript/geoblacklight/controllers/overview_map_controller.js +143 -0
  46. data/app/javascript/geoblacklight/core.js +8 -10
  47. data/app/javascript/geoblacklight/index.js +9 -12
  48. data/app/javascript/geoblacklight/initializers/field_truncation.js +62 -0
  49. data/app/javascript/geoblacklight/initializers/metadata_download.js +3 -8
  50. data/app/javascript/geoblacklight/initializers/truncation.js +7 -3
  51. data/app/javascript/geoblacklight/initializers/viewer_requests.js +61 -0
  52. data/app/javascript/geoblacklight/initializers/viewer_theme.js +28 -0
  53. data/app/models/concerns/geoblacklight/solr_document/thumbnail.rb +38 -0
  54. data/app/models/concerns/geoblacklight/solr_document.rb +2 -0
  55. data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +1 -1
  56. data/app/views/catalog/_document_split.html.erb +10 -10
  57. data/app/views/catalog/_home_text.html.erb +1 -1
  58. data/app/views/catalog/metadata.html.erb +1 -1
  59. data/app/views/{relation → relations}/index.html.erb +1 -1
  60. data/app/views/relations/index.json.jbuilder +9 -0
  61. data/config/importmap.rb +8 -8
  62. data/config/locales/geoblacklight.en.yml +48 -99
  63. data/geoblacklight.gemspec +3 -3
  64. data/lib/generators/geoblacklight/assets_generator.rb +2 -2
  65. data/lib/generators/geoblacklight/install_generator.rb +3 -6
  66. data/lib/generators/geoblacklight/templates/assets/customizations.css +5 -1
  67. data/lib/generators/geoblacklight/templates/catalog_controller.rb +17 -27
  68. data/lib/generators/geoblacklight/templates/settings.yml +15 -95
  69. data/lib/geoblacklight/configuration/display_note_shown_config.rb +3 -0
  70. data/lib/geoblacklight/configuration/relationship_config.rb +7 -1
  71. data/lib/geoblacklight/configuration/relationships_config.rb +15 -15
  72. data/lib/geoblacklight/configuration/settings_attributes.rb +85 -0
  73. data/lib/geoblacklight/configuration/settings_builder.rb +3 -14
  74. data/lib/geoblacklight/configuration.rb +23 -62
  75. data/lib/geoblacklight/exceptions.rb +4 -0
  76. data/lib/geoblacklight/reference.rb +0 -2
  77. data/lib/geoblacklight/references.rb +17 -5
  78. data/lib/geoblacklight/relations/ancestors.rb +12 -0
  79. data/lib/geoblacklight/relations/descendants.rb +11 -0
  80. data/lib/geoblacklight/relations/query.rb +39 -0
  81. data/lib/geoblacklight/{relation → relations}/relation_response.rb +5 -4
  82. data/lib/geoblacklight/routes/exportable.rb +2 -1
  83. data/lib/geoblacklight/version.rb +1 -1
  84. data/lib/geoblacklight/viewer_record.rb +39 -0
  85. data/lib/geoblacklight.rb +1 -1
  86. data/lib/tasks/geoblacklight.rake +1 -17
  87. data/lib/tasks/solr.rb +37 -0
  88. data/schema/readme.md +1 -1
  89. data/script/wait-for-solr +36 -0
  90. data/solr/conf/solrconfig.xml +10 -16
  91. data/spec/components/geoblacklight/document/sidebar_component_spec.rb +3 -3
  92. data/spec/components/geoblacklight/document_component_spec.rb +8 -34
  93. data/spec/components/geoblacklight/{header_icons_component_spec.rb → header_badges_component_spec.rb} +20 -2
  94. data/spec/components/geoblacklight/item_map_viewer_component_spec.rb +65 -15
  95. data/spec/components/geoblacklight/locator_map_component_spec.rb +54 -0
  96. data/spec/components/geoblacklight/login_link_component_spec.rb +20 -12
  97. data/spec/components/geoblacklight/metadata_description_markdown_component_spec.rb +1 -6
  98. data/spec/components/geoblacklight/overview_map_component_spec.rb +136 -0
  99. data/spec/components/geoblacklight/relations/relation_component_spec.rb +98 -0
  100. data/spec/components/geoblacklight/relations/relations_component_spec.rb +146 -0
  101. data/spec/components/geoblacklight/search_result_component_spec.rb +66 -39
  102. data/spec/components/geoblacklight/static_map_component_spec.rb +8 -2
  103. data/spec/components/geoblacklight/truncatable_metadata_field_layout_component_spec.rb +83 -0
  104. data/spec/controllers/catalog_controller_spec.rb +22 -7
  105. data/spec/controllers/{relation_controller_spec.rb → relations_controller_spec.rb} +1 -1
  106. data/spec/factories/user.rb +6 -1
  107. data/spec/features/axe_spec.rb +5 -3
  108. data/spec/features/home_page_spec.rb +8 -7
  109. data/spec/features/index_view_spec.rb +6 -20
  110. data/spec/features/layer_preview_spec.rb +4 -11
  111. data/spec/features/locator_map_spec.rb +31 -0
  112. data/spec/features/relations_spec.rb +22 -11
  113. data/spec/features/restricted_viewer_spec.rb +14 -0
  114. data/spec/features/search_results_map_spec.rb +89 -13
  115. data/spec/features/search_spec.rb +6 -2
  116. data/spec/features/sign_in_spec.rb +26 -0
  117. data/spec/features/tilejson_spec.rb +1 -3
  118. data/spec/features/tms_spec.rb +2 -2
  119. data/spec/features/truncated_metadata_spec.rb +77 -0
  120. data/spec/features/viewer_requests_spec.rb +40 -0
  121. data/spec/features/viewer_theme_spec.rb +51 -0
  122. data/spec/features/wmts_spec.rb +6 -6
  123. data/spec/features/xyz_spec.rb +3 -3
  124. data/spec/fixtures/solr_documents/README.md +18 -14
  125. data/spec/fixtures/solr_documents/actual-polygon1.json +22 -18
  126. data/spec/fixtures/solr_documents/b1g_wabash_child_15.json +14 -15
  127. data/spec/fixtures/solr_documents/b1g_wabash_child_16.json +14 -15
  128. data/spec/fixtures/solr_documents/b1g_wabash_child_17.json +14 -15
  129. data/spec/fixtures/solr_documents/b1g_wabash_child_18.json +14 -15
  130. data/spec/fixtures/solr_documents/b1g_wabash_parent.json +14 -15
  131. data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +2 -2
  132. data/spec/fixtures/solr_documents/esri-feature-layer.json +1 -1
  133. data/spec/fixtures/solr_documents/esri-image-map-layer.json +20 -20
  134. data/spec/fixtures/solr_documents/esri-wms-layer.json +22 -24
  135. data/spec/fixtures/solr_documents/index_map_point.json +3 -3
  136. data/spec/fixtures/solr_documents/public_polygon.json +28 -0
  137. data/spec/helpers/geoblacklight_helper_spec.rb +103 -25
  138. data/spec/lib/geoblacklight/bounding_box_spec.rb +16 -0
  139. data/spec/lib/geoblacklight/configuration/relationships_config_spec.rb +121 -0
  140. data/spec/lib/geoblacklight/configuration/settings_attributes_spec.rb +113 -0
  141. data/spec/lib/geoblacklight/configuration/settings_builder_spec.rb +33 -4
  142. data/spec/lib/geoblacklight/references_spec.rb +35 -0
  143. data/spec/lib/geoblacklight/{relation → relations}/ancestors_spec.rb +17 -6
  144. data/spec/lib/geoblacklight/{relation → relations}/descendants_spec.rb +14 -7
  145. data/spec/lib/geoblacklight/{relation → relations}/relation_response_spec.rb +31 -17
  146. data/spec/lib/geoblacklight/viewer_record_spec.rb +69 -0
  147. data/spec/models/concerns/geoblacklight/solr_document/thumbnail_spec.rb +149 -0
  148. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +1 -1
  149. data/spec/requests/bookmarks_spec.rb +2 -1
  150. data/spec/requests/catalog_show_spec.rb +24 -2
  151. data/spec/requests/index_view_spec.rb +50 -2
  152. data/spec/requests/missing_metadata_spec.rb +1 -1
  153. data/spec/requests/relations_spec.rb +9 -2
  154. data/spec/requests/search_results_spec.rb +6 -6
  155. data/spec/requests/viewer_record_spec.rb +37 -0
  156. data/spec/requests/viewer_requests_spec.rb +52 -0
  157. data/spec/solr_config_spec.rb +41 -0
  158. data/spec/solr_fixtures_spec.rb +23 -0
  159. data/spec/spec_helper.rb +13 -3
  160. data/spec/support/authentication.rb +37 -0
  161. data/spec/support/features/map_helpers.rb +68 -0
  162. data/spec/support/features/session_helpers.rb +18 -13
  163. data/spec/support/features/viewer_helpers.rb +20 -0
  164. data/spec/support/features.rb +4 -0
  165. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  166. data/template.rb +1 -1
  167. metadata +72 -84
  168. data/app/components/geoblacklight/accordion_component.html.erb +0 -16
  169. data/app/components/geoblacklight/accordion_component.rb +0 -15
  170. data/app/components/geoblacklight/attribute_table_component.html.erb +0 -15
  171. data/app/components/geoblacklight/attribute_table_component.rb +0 -17
  172. data/app/components/geoblacklight/header_icons_component.html.erb +0 -3
  173. data/app/components/geoblacklight/header_icons_component.rb +0 -27
  174. data/app/components/geoblacklight/index_map_inspect_component.html.erb +0 -12
  175. data/app/components/geoblacklight/index_map_inspect_component.rb +0 -15
  176. data/app/components/geoblacklight/index_map_legend_component.html.erb +0 -14
  177. data/app/components/geoblacklight/index_map_legend_component.rb +0 -24
  178. data/app/components/geoblacklight/location_leaflet_map_component.rb +0 -68
  179. data/app/components/geoblacklight/relations_component.html.erb +0 -23
  180. data/app/components/geoblacklight/relations_component.rb +0 -25
  181. data/app/components/geoblacklight/viewer_help_text_component.html.erb +0 -1
  182. data/app/components/geoblacklight/viewer_help_text_component.rb +0 -46
  183. data/app/controllers/wms_controller.rb +0 -17
  184. data/app/javascript/geoblacklight/controllers/leaflet_viewer_controller.js +0 -240
  185. data/app/javascript/geoblacklight/controllers/openlayers_viewer_controller.js +0 -74
  186. data/app/javascript/geoblacklight/controllers/search_results_controller.js +0 -50
  187. data/app/javascript/geoblacklight/initializers/popovers.js +0 -11
  188. data/app/javascript/geoblacklight/initializers/tooltips.js +0 -51
  189. data/app/javascript/geoblacklight/leaflet/basemaps.js +0 -73
  190. data/app/javascript/geoblacklight/leaflet/constants.js +0 -18
  191. data/app/javascript/geoblacklight/leaflet/controls/geosearch.js +0 -168
  192. data/app/javascript/geoblacklight/leaflet/controls/layer_opacity.js +0 -121
  193. data/app/javascript/geoblacklight/leaflet/controls/sidebar.js +0 -49
  194. data/app/javascript/geoblacklight/leaflet/controls/sleep.js +0 -101
  195. data/app/javascript/geoblacklight/leaflet/inspection.js +0 -210
  196. data/app/javascript/geoblacklight/leaflet/layer_index_map.js +0 -128
  197. data/app/javascript/geoblacklight/leaflet/layer_wmts.js +0 -57
  198. data/app/javascript/geoblacklight/leaflet/layers.js +0 -146
  199. data/app/javascript/geoblacklight/leaflet/utils.js +0 -83
  200. data/app/javascript/geoblacklight/openlayers/basemaps.js +0 -55
  201. data/app/javascript/geoblacklight/openlayers/inspection.js +0 -42
  202. data/app/javascript/geoblacklight/openlayers/layers.js +0 -44
  203. data/app/views/relation/index.json.jbuilder +0 -8
  204. data/lib/geoblacklight/configuration/layer_config.rb +0 -28
  205. data/lib/geoblacklight/configuration/leaflet_config.rb +0 -73
  206. data/lib/geoblacklight/configuration/leaflet_layers_config.rb +0 -33
  207. data/lib/geoblacklight/configuration/leaflet_sleep_config.rb +0 -20
  208. data/lib/geoblacklight/relation/ancestors.rb +0 -31
  209. data/lib/geoblacklight/relation/descendants.rb +0 -31
  210. data/lib/geoblacklight/routes/wms.rb +0 -15
  211. data/lib/geoblacklight/wms_layer/feature_info_response.rb +0 -37
  212. data/lib/geoblacklight/wms_layer.rb +0 -34
  213. data/spec/components/geoblacklight/attribute_table_component_spec.rb +0 -36
  214. data/spec/components/geoblacklight/index_map_legend_component_spec.rb +0 -29
  215. data/spec/components/geoblacklight/viewer_help_text_component_spec.rb +0 -27
  216. data/spec/controllers/wms_controller_spec.rb +0 -34
  217. data/spec/features/configurable_basemap_spec.rb +0 -40
  218. data/spec/features/full_screen_control_spec.rb +0 -15
  219. data/spec/features/layer_inspection_spec.rb +0 -12
  220. data/spec/features/layer_opacity_spec.rb +0 -16
  221. data/spec/fixtures/solr_documents/harvard_raster.json +0 -39
  222. data/spec/fixtures/solr_documents/public_polygon_mit.json +0 -23
  223. data/spec/fixtures/solr_documents/uva_slug_colon.json +0 -29
  224. data/spec/javascripts/geoblacklight_spec.js +0 -11
  225. data/spec/lib/geoblacklight/configuration/layer_config_spec.rb +0 -71
  226. data/spec/lib/geoblacklight/configuration/leaflet_config_spec.rb +0 -129
  227. data/spec/lib/geoblacklight/configuration/leaflet_layers_config_spec.rb +0 -63
  228. data/spec/lib/geoblacklight/configuration_spec.rb +0 -48
  229. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +0 -54
  230. data/spec/lib/geoblacklight/wms_layer_spec.rb +0 -115
  231. /data/app/components/geoblacklight/{location_leaflet_map_component.html.erb → locator_map_component.html.erb} +0 -0
@@ -18,15 +18,22 @@
18
18
  # # The bf boost value for overlap ratio
19
19
  # overlap_ratio_boost: "2"
20
20
 
21
+ # # Services the item viewer should send cookies to when previewing restricted data a reader is
22
+ # # allowed at, as URL prefixes - usually just the service's origin. List only services that
23
+ # # require it: a credentialed request to one that doesn't expect it is refused by the browser
24
+ # # rather than authorized, and the service has to answer with Access-Control-Allow-Credentials
25
+ # # naming this application's origin. To authorize with a header or a proxy of your own instead,
26
+ # # register a transform with Geoblacklight.onViewerRequest in your JavaScript entrypoint.
27
+ # restricted_origins:
28
+ # - "https://geoserver-restricted.example.edu/"
29
+
21
30
  # # Homepage Map Geometry
22
31
  # # Leave null to default to entire world
23
32
  # # Add a stringified GeoJSON object to scope initial render (example from UMass)
24
33
  # homepage_map_geom: null
25
34
  # # homepage_map_geom: '{"type":"Polygon","coordinates":[[[-73.58,42.93],[-73.58,41.20],[-69.90,41.20],[-69.90,42.93]]]}'
26
35
 
27
- # # Non-search-field GeoBlacklight application permitted params.
28
- # # Values are left mixed-case on purpose: the uppercase symbols are WMS/OGC
29
- # # request parameter names (BBOX, WIDTH, etc.) and must match what clients send.
36
+ # # Non-search-field GeoBlacklight application permitted params
30
37
  # gbl_params:
31
38
  # - :bbox
32
39
  # - :email
@@ -36,14 +43,6 @@
36
43
  # - :logo
37
44
  # - :provider
38
45
  # - :type
39
- # - :BBOX
40
- # - :HEIGHT
41
- # - :LAYERS
42
- # - :QUERY_LAYERS
43
- # - :URL
44
- # - :WIDTH
45
- # - :X
46
- # - :Y
47
46
 
48
47
  # # Solr field mappings
49
48
  # fields:
@@ -100,9 +99,6 @@
100
99
  # - "iso19139"
101
100
  # - "html"
102
101
 
103
- # # (For WMS inspection) timeout and open_timeout parameters for Faraday
104
- # timeout_wms: 4
105
-
106
102
  # # Web services shown in tool panel
107
103
  # webservices_shown:
108
104
  # - "wms"
@@ -142,145 +138,69 @@
142
138
  # relationships_shown:
143
139
  # member_of_ancestors:
144
140
  # field: pcdm_memberOf_sm
145
- # icon: parent-item
146
141
  # inverse: :member_of_descendants
147
142
  # label: geoblacklight.relations.member_of_ancestors
148
143
  # query_type: ancestors
149
144
  # member_of_descendants:
150
145
  # field: pcdm_memberOf_sm
151
- # icon: child-item
152
146
  # inverse: :member_of_ancestors
153
147
  # label: geoblacklight.relations.member_of_descendants
154
148
  # query_type: descendants
155
149
  # part_of_ancestors:
156
150
  # field: dct_isPartOf_sm
157
- # icon: parent-item
158
151
  # inverse: :part_of_descendants
159
152
  # label: geoblacklight.relations.part_of_ancestors
160
153
  # query_type: ancestors
161
154
  # part_of_descendants:
162
155
  # field: dct_isPartOf_sm
163
- # icon: child-item
164
156
  # inverse: :part_of_ancestors
165
157
  # label: geoblacklight.relations.part_of_descendants
166
158
  # query_type: descendants
167
159
  # relation_ancestors:
168
160
  # field: dct_relation_sm
169
- # icon: nil
170
161
  # inverse: :relation_descendants
171
162
  # label: geoblacklight.relations.relation_ancestors
172
163
  # query_type: ancestors
173
164
  # relation_descendants:
174
165
  # field: dct_relation_sm
175
- # icon: nil
176
166
  # inverse: :relation_ancestors
177
167
  # label: geoblacklight.relations.relation_descendants
178
168
  # query_type: descendants
179
169
  # replaces_ancestors:
180
170
  # field: dct_replaces_sm
181
- # icon: nil
182
171
  # inverse: :replaces_descendants
183
172
  # label: geoblacklight.relations.replaces_ancestors
184
173
  # query_type: ancestors
185
174
  # replaces_descendants:
186
175
  # field: dct_replaces_sm
187
- # icon: nil
188
176
  # inverse: :replaces_ancestors
189
177
  # label: geoblacklight.relations.replaces_descendants
190
178
  # query_type: descendants
191
179
  # source_ancestors:
192
180
  # field: dct_source_sm
193
- # icon: parent-item
194
181
  # inverse: :source_descendants
195
182
  # label: geoblacklight.relations.source_ancestors
196
183
  # query_type: ancestors
197
184
  # source_descendants:
198
185
  # field: dct_source_sm
199
- # icon: child-item
200
186
  # inverse: :source_ancestors
201
187
  # label: geoblacklight.relations.source_descendants
202
188
  # query_type: descendants
203
189
  # version_of_ancestors:
204
190
  # field: dct_isVersionOf_sm
205
- # icon: parent-item
206
191
  # inverse: :version_of_descendants
207
192
  # label: geoblacklight.relations.version_of_ancestors
208
193
  # query_type: ancestors
209
194
  # version_of_descendants:
210
195
  # field: dct_isVersionOf_sm
211
- # icon: child-item
212
196
  # inverse: :version_of_ancestors
213
197
  # label: geoblacklight.relations.version_of_descendants
214
198
  # query_type: descendants
215
199
 
216
- # # WMS Parameters. Keys are OGC WMS request parameter names and are sent to
217
- # # remote WMS servers, so they are intentionally left uppercase.
218
- # wms_params:
219
- # SERVICE: "WMS"
220
- # VERSION: "1.1.1"
221
- # REQUEST: "GetFeatureInfo"
222
- # STYLES: ""
223
- # SRS: "EPSG:4326"
224
- # EXCEPTIONS: "application/json"
225
- # INFO_FORMAT: "application/json"
226
-
227
- # # Settings for leaflet
228
- # leaflet:
229
- # # Keys below are consumed by the JS viewer via the page value
230
- # # ("INDEX" / "SHOW" / "STATIC_MAP"), so they are intentionally left uppercase.
231
- # boundsoverlay:
232
- # INDEX:
233
- # color: "#3388ff"
234
- # SHOW:
235
- # color: "#3388ff"
236
- # STATIC_MAP:
237
- # color: "#3388ff"
238
- # selected_color: "#2C7FB8"
239
- # sleep:
240
- # sleep: true # set to false to disable
241
- # margin_distance: 100 # set to zero / false if you want to disable this check
242
- # sleeptime: 750
243
- # waketime: 750
244
- # hovertowake: false
245
- # message: "Click to Wake"
246
- # background: "rgba(214, 214, 214, .7)"
247
- # sidebar: false # set to true to display attribute table as sidebar on map
248
- # layers:
249
- # detect_retina: true
250
- # index:
251
- # # DEFAULT / UNAVAILABLE / SELECTED are consumed by the JS viewer and the
252
- # # index-map legend, so they are intentionally left uppercase.
253
- # DEFAULT: &default
254
- # color: "#7FCDBB"
255
- # weight: 1
256
- # radius: 4
257
- # sr_color_name: "Green"
258
- # UNAVAILABLE:
259
- # <<: *default
260
- # color: "#EDF8B1"
261
- # sr_color_name: "Yellow"
262
- # SELECTED:
263
- # <<: *default
264
- # color: "#2C7FB8"
265
- # sr_color_name: "Blue"
200
+ # iiif_drag_drop_link: "@manifest?manifest=@manifest"
266
201
 
267
- # # Toggle the help text feature that offers users context
268
- # help_text:
269
- # viewer_protocol:
270
- # - "cog"
271
- # - "dynamic_map_layer"
272
- # - "feature_layer"
273
- # - "iiif"
274
- # - "iiif_manifest"
275
- # - "image_map_layer"
276
- # - "index_map"
277
- # - "oembed"
278
- # - "pmtiles"
279
- # - "tiled_map_layer"
280
- # - "tilejson"
281
- # - "tms"
282
- # - "wms"
283
- # - "wmts"
284
- # - "xyz"
202
+ # # Toggle thumbnail images in the search results (index) view
203
+ # thumbnails_enabled: true
285
204
 
286
- # iiif_drag_drop_link: "@manifest?manifest=@manifest"
205
+ # # The dct_references_s URI key to use as a document's thumbnail image URL
206
+ # thumbnail_reference_key: "http://schema.org/thumbnailUrl"
@@ -4,6 +4,9 @@ module Geoblacklight
4
4
  class DisplayNoteShownConfig
5
5
  include ActiveModel::Model
6
6
  include ActiveModel::Attributes
7
+ include SettingsAttributes
8
+
9
+ self.settings_section = "DISPLAY_NOTES_SHOWN"
7
10
 
8
11
  attribute :bootstrap_alert_class, :string
9
12
  attribute :icon, :string
@@ -4,9 +4,15 @@ module Geoblacklight
4
4
  class RelationshipConfig
5
5
  include ActiveModel::Model
6
6
  include ActiveModel::Attributes
7
+ include SettingsAttributes
8
+
9
+ # GeoBlacklight 5 drew a per-relationship icon next to each related record.
10
+ # GeoBlacklight 6 labels them with a resource-class badge instead, but every
11
+ # config/settings.yml generated since 4.0 still sets this.
12
+ self.removed_attributes = %w[icon].freeze
13
+ self.settings_section = "RELATIONSHIPS_SHOWN"
7
14
 
8
15
  attribute :field, :string
9
- attribute :icon, :string
10
16
  attribute :inverse, :string
11
17
  attribute :label, :string
12
18
  attribute :query_type, :string
@@ -9,84 +9,72 @@ module Geoblacklight
9
9
  DEFAULT_RELATIONSHIPS = {
10
10
  member_of_ancestors: {
11
11
  field: "pcdm_memberOf_sm",
12
- icon: "parent-item",
13
12
  inverse: :member_of_descendants,
14
13
  label: "geoblacklight.relations.member_of_ancestors",
15
14
  query_type: "ancestors"
16
15
  },
17
16
  member_of_descendants: {
18
17
  field: "pcdm_memberOf_sm",
19
- icon: "child-item",
20
18
  inverse: :member_of_ancestors,
21
19
  label: "geoblacklight.relations.member_of_descendants",
22
20
  query_type: "descendants"
23
21
  },
24
22
  part_of_ancestors: {
25
23
  field: "dct_isPartOf_sm",
26
- icon: "parent-item",
27
24
  inverse: :part_of_descendants,
28
25
  label: "geoblacklight.relations.part_of_ancestors",
29
26
  query_type: "ancestors"
30
27
  },
31
28
  part_of_descendants: {
32
29
  field: "dct_isPartOf_sm",
33
- icon: "child-item",
34
30
  inverse: :part_of_ancestors,
35
31
  label: "geoblacklight.relations.part_of_descendants",
36
32
  query_type: "descendants"
37
33
  },
38
34
  relation_ancestors: {
39
35
  field: "dct_relation_sm",
40
- icon: nil,
41
36
  inverse: :relation_descendants,
42
37
  label: "geoblacklight.relations.relation_ancestors",
43
38
  query_type: "ancestors"
44
39
  },
45
40
  relation_descendants: {
46
41
  field: "dct_relation_sm",
47
- icon: nil,
48
42
  inverse: :relation_ancestors,
49
43
  label: "geoblacklight.relations.relation_descendants",
50
44
  query_type: "descendants"
51
45
  },
52
46
  replaces_ancestors: {
53
47
  field: "dct_replaces_sm",
54
- icon: nil,
55
48
  inverse: :replaces_descendants,
56
49
  label: "geoblacklight.relations.replaces_ancestors",
57
50
  query_type: "ancestors"
58
51
  },
59
52
  replaces_descendants: {
60
53
  field: "dct_replaces_sm",
61
- icon: nil,
62
54
  inverse: :replaces_ancestors,
63
55
  label: "geoblacklight.relations.replaces_descendants",
64
56
  query_type: "descendants"
65
57
  },
66
58
  source_ancestors: {
67
59
  field: "dct_source_sm",
68
- icon: "parent-item",
69
60
  inverse: :source_descendants,
70
61
  label: "geoblacklight.relations.source_ancestors",
71
62
  query_type: "ancestors"
72
63
  },
73
64
  source_descendants: {
74
65
  field: "dct_source_sm",
75
- icon: "child-item",
76
66
  inverse: :source_ancestors,
77
67
  label: "geoblacklight.relations.source_descendants",
78
68
  query_type: "descendants"
79
69
  },
80
70
  version_of_ancestors: {
81
71
  field: "dct_isVersionOf_sm",
82
- icon: "parent-item",
83
72
  inverse: :version_of_descendants,
84
73
  label: "geoblacklight.relations.version_of_ancestors",
85
74
  query_type: "ancestors"
86
75
  },
87
76
  version_of_descendants: {
88
77
  field: "dct_isVersionOf_sm",
89
- icon: "child-item",
90
78
  inverse: :version_of_ancestors,
91
79
  label: "geoblacklight.relations.version_of_descendants",
92
80
  query_type: "descendants"
@@ -94,9 +82,9 @@ module Geoblacklight
94
82
  }.freeze
95
83
 
96
84
  def initialize(relationships = DEFAULT_RELATIONSHIPS)
97
- @relationships = relationships.to_h.transform_values do |attrs|
98
- attrs.is_a?(RelationshipConfig) ? attrs : RelationshipConfig.new(attrs)
99
- end
85
+ @relationships = relationships.to_h
86
+ .transform_keys { |name| normalize_name(name) }
87
+ .transform_values { |attrs| config_for(attrs) }
100
88
  end
101
89
 
102
90
  def each(&block)
@@ -118,6 +106,18 @@ module Geoblacklight
118
106
  def method_missing(name, *args, **kwargs, &block) # rubocop:disable Style/MissingRespondToMissing
119
107
  @relationships.key?(name) ? @relationships[name] : super
120
108
  end
109
+
110
+ private
111
+
112
+ def normalize_name(name)
113
+ name.to_s.downcase.to_sym
114
+ end
115
+
116
+ def config_for(attrs)
117
+ return attrs if attrs.is_a?(RelationshipConfig)
118
+
119
+ RelationshipConfig.new(attrs.to_h)
120
+ end
121
121
  end
122
122
  end
123
123
  end
@@ -0,0 +1,85 @@
1
+ module Geoblacklight
2
+ class Configuration
3
+ # Shared behavior for the small ActiveModel value objects that are built by
4
+ # mass-assigning a section of config/settings.yml -- RelationshipConfig and
5
+ # DisplayNoteShownConfig.
6
+ #
7
+ # Because config/settings.yml is only written when GeoBlacklight is first
8
+ # installed, an upgrading application's copy is whatever the installer wrote
9
+ # years ago. Assigning that hash directly onto an ActiveModel raises
10
+ # ActiveModel::UnknownAttributeError, naming a class the maintainer has never
11
+ # heard of, for a key they did not choose. This module makes three changes:
12
+ #
13
+ # * keys are matched case-insensitively, so an uppercase +FIELD:+ resolves the
14
+ # same way the section name itself does (see CaseInsensitiveSettings)
15
+ # * attributes named in +removed_attributes+ are dropped with one deprecation
16
+ # warning each, rather than raising
17
+ # * anything else still raises, but with a message that names the file to edit
18
+ # and lists the keys that are accepted
19
+ #
20
+ # Include it *after* ActiveModel::Model and ActiveModel::Attributes:
21
+ #
22
+ # class RelationshipConfig
23
+ # include ActiveModel::Model
24
+ # include ActiveModel::Attributes
25
+ # include SettingsAttributes
26
+ #
27
+ # self.removed_attributes = %w[icon].freeze
28
+ # self.settings_section = "RELATIONSHIPS_SHOWN"
29
+ # end
30
+ #
31
+ # The ordering matters and fails silently if you get it wrong. This module
32
+ # overrides ActiveModel::AttributeAssignment#attribute_writer_missing, so
33
+ # ActiveModel has to be lower in the ancestor chain. Rewriting this as an
34
+ # ActiveSupport::Concern that includes ActiveModel from its +included+ block
35
+ # would put ActiveModel *ahead* of this module, and its raising default would
36
+ # win with no error to say so.
37
+ module SettingsAttributes
38
+ def self.included(klass)
39
+ # Attribute names (as strings) that this version of GeoBlacklight no longer
40
+ # has any use for, but which an older config/settings.yml may still set.
41
+ klass.class_attribute :removed_attributes, instance_writer: false, default: [].freeze
42
+
43
+ # The config/settings.yml section this object is built from, used in messages.
44
+ klass.class_attribute :settings_section, instance_writer: false
45
+
46
+ klass.extend ClassMethods
47
+ end
48
+
49
+ module ClassMethods
50
+ # Warns at most once per removed attribute per process. The whole
51
+ # configuration is built once and memoized on Geoblacklight, and the fix is
52
+ # "edit config/settings.yml", so one line per key is all you need to see.
53
+ def warn_removed_attribute(name)
54
+ @warned_removed_attributes ||= Set.new
55
+ return unless @warned_removed_attributes.add?(name)
56
+
57
+ Geoblacklight::Deprecation.warn(
58
+ "config/settings.yml sets #{name} on a #{settings_section} entry. GeoBlacklight no " \
59
+ "longer reads it and the line can be deleted; support for it will be removed in a " \
60
+ "future version."
61
+ )
62
+ end
63
+
64
+ # Lets a spec assert on the warning more than once.
65
+ def reset_removed_attribute_warnings!
66
+ @warned_removed_attributes = nil
67
+ end
68
+ end
69
+
70
+ # ActiveModel calls this instead of raising when #assign_attributes is handed
71
+ # a key with no matching setter.
72
+ def attribute_writer_missing(name, value)
73
+ key = name.to_s.downcase
74
+
75
+ return public_send(:"#{key}=", value) if self.class.attribute_names.include?(key)
76
+ return self.class.warn_removed_attribute(key) if self.class.removed_attributes.include?(key)
77
+
78
+ raise Geoblacklight::Exceptions::InvalidSettings,
79
+ "config/settings.yml: a #{self.class.settings_section} entry sets #{name.to_s.inspect}, " \
80
+ "which GeoBlacklight does not recognize. It accepts only " \
81
+ "#{self.class.attribute_names.join(", ")}."
82
+ end
83
+ end
84
+ end
85
+ end
@@ -18,18 +18,17 @@ module Geoblacklight
18
18
  assign(config, :overlap_ratio_boost, settings.OVERLAP_RATIO_BOOST)
19
19
  assign(config, :display_notes_shown, build_display_notes)
20
20
  assign(config, :institution, settings.INSTITUTION)
21
- assign(config, :help_text, settings.HELP_TEXT&.to_h)
22
21
  assign(config, :iiif_drag_drop_link, settings.IIIF_DRAG_DROP_LINK)
22
+ assign(config, :thumbnails_enabled, settings.THUMBNAILS_ENABLED)
23
+ assign(config, :thumbnail_reference_key, settings.THUMBNAIL_REFERENCE_KEY)
23
24
  assign(config, :homepage_map_geom, settings.HOMEPAGE_MAP_GEOM)
24
25
  assign(config, :metadata_shown, settings.METADATA_SHOWN)
25
26
  assign(config, :webservices_shown, settings.WEBSERVICES_SHOWN)
26
27
  assign(config, :relationships_shown, build_relationships)
27
28
  assign(config, :gbl_params, settings.GBL_PARAMS)
28
- assign(config, :wms_params, settings.WMS_PARAMS&.to_h)
29
- assign(config, :timeout_wms, settings.TIMEOUT_WMS)
29
+ assign(config, :restricted_origins, settings.restricted_origins)
30
30
 
31
31
  build_fields(config)
32
- build_leaflet_options(config)
33
32
  end
34
33
  end
35
34
 
@@ -53,16 +52,6 @@ module Geoblacklight
53
52
  RelationshipsConfig.new(settings.RELATIONSHIPS_SHOWN.to_h) if settings.RELATIONSHIPS_SHOWN
54
53
  end
55
54
 
56
- def build_leaflet_options(config)
57
- return unless settings.LEAFLET
58
-
59
- assign(config.leaflet_options, :bounds_overlay, settings.LEAFLET.BOUNDSOVERLAY&.to_h)
60
- assign(config.leaflet_options, :selected_color, settings.LEAFLET.SELECTED_COLOR)
61
- assign(config.leaflet_options, :sleep, settings.LEAFLET.SLEEP&.to_h&.transform_keys(&:downcase))
62
- assign(config.leaflet_options, :sidebar, settings.LEAFLET.SIDEBAR)
63
- assign(config.leaflet_options, :layers, settings.LEAFLET.LAYERS&.to_h&.transform_keys(&:downcase))
64
- end
65
-
66
55
  def build_fields(config)
67
56
  return unless settings.FIELDS
68
57
 
@@ -15,40 +15,37 @@ module Geoblacklight
15
15
  # Institution deployed at
16
16
  attribute :institution, :string, default: "Stanford"
17
17
 
18
- # (For WMS inspection) timeout and open_timeout parameters for Faraday
19
- attribute :timeout_wms, :integer, default: 4
18
+ # Services the item viewer should send cookies to when previewing restricted data a reader is
19
+ # allowed at, as URL prefixes - usually just the service's origin, e.g.
20
+ # config.restricted_origins = ["https://geoserver-restricted.example.edu/"]
21
+ # List only services that require it: a credentialed request to one that doesn't expect it is
22
+ # refused by the browser rather than authorized. The service has to answer with
23
+ # Access-Control-Allow-Credentials and name this application's origin, since a wildcard is
24
+ # invalid with credentials. See the viewer_requests initializer for the other ways to authorize
25
+ # a request - a header, or a rewrite to a proxy of your own.
26
+ attr_accessor :restricted_origins # typed as Array
20
27
 
21
28
  # Display Notes to display / Non-prefixed default bootstrap class is alert-secondary
22
29
  attr_accessor :display_notes_shown # typed as Hash
23
30
 
24
- # Toggle the help text feature that offers users context
25
- attr_accessor :help_text # typed as Hash
26
-
27
31
  # Non-search-field GeoBlacklight application permitted params
28
32
  attr_accessor :gbl_params # typed as Array
29
33
 
30
- # WMS Parameters
31
- attr_accessor :wms_params # typed as Hash
32
-
33
34
  attribute :iiif_drag_drop_link, :string, default: "@manifest?manifest=@manifest"
34
35
 
35
- # Configure basemap provider for GeoBlacklight maps
36
- # Valid basemaps include:
37
- # 'positron'
38
- # 'dark_matter'
39
- # 'positron_lite'
40
- # 'world_antique'
41
- # 'world_eco'
42
- # 'flat_blue'
43
- # 'midnight_commander'
44
- # 'openstreetmap_hot'
45
- # 'openstreetmap_standard'
36
+ # Toggle thumbnail images in the search results (index) view
37
+ attribute :thumbnails_enabled, :boolean, default: true
38
+
39
+ # The dct_references_s URI key to use as a document's thumbnail image URL
40
+ attribute :thumbnail_reference_key, :string, default: "http://schema.org/thumbnailUrl"
46
41
 
47
- # Basemap used in light mode
48
- attribute :basemap_provider, :string, default: "positron"
42
+ # The basemap used in light mode, as a URL to a MapLibre style document.
43
+ # Leave blank to use the viewer's default.
44
+ attribute :light_basemap_url, :string
49
45
 
50
- # Basemap used in dark mode
51
- attribute :dark_basemap_provider, :string, default: "dark_matter"
46
+ # The basemap used in dark mode, as a URL to a MapLibre style document.
47
+ # Leave blank to use the viewer's default.
48
+ attribute :dark_basemap_url, :string
52
49
 
53
50
  # Homepage Map Geometry
54
51
  # Leave null to default to entire world
@@ -68,38 +65,9 @@ module Geoblacklight
68
65
  def initialize
69
66
  super
70
67
  @relationships_shown = RelationshipsConfig.new
71
- @gbl_params = [
72
- :bbox, :email, :file, :format, :id, :logo, :provider, :type,
73
- :BBOX, :HEIGHT, :LAYERS, :QUERY_LAYERS, :URL, :WIDTH, :X, :Y
74
- ]
75
- @wms_params = {
76
- SERVICE: "WMS",
77
- VERSION: "1.1.1",
78
- REQUEST: "GetFeatureInfo",
79
- STYLES: "",
80
- SRS: "EPSG:4326",
81
- EXCEPTIONS: "application/json",
82
- INFO_FORMAT: "application/json"
83
- }
84
- @help_text = {
85
- viewer_protocol: %w[
86
- cog
87
- dynamic_map_layer
88
- feature_layer
89
- iiif
90
- iiif_manifest
91
- image_map_layer
92
- index_map
93
- oembed
94
- pmtiles
95
- tiled_map_layer
96
- tilejson
97
- tms
98
- wms
99
- wmts
100
- xyz
101
- ]
102
- }
68
+ @gbl_params = [:bbox, :email, :file, :format, :id, :logo, :provider, :type]
69
+
70
+ @restricted_origins = []
103
71
 
104
72
  @metadata_shown = ["mods", "fgdc", "iso19139", "html"]
105
73
  @webservices_shown = %w[
@@ -145,12 +113,5 @@ module Geoblacklight
145
113
  def fields
146
114
  @fields ||= FieldsConfig.new
147
115
  end
148
-
149
- ##
150
- # Returns Leaflet plugin settings to pass to the viewer.
151
- # @return[Geoblacklight::Configuration::LeafletConfig]
152
- def leaflet_options
153
- @leaflet_options ||= Geoblacklight::Configuration::LeafletConfig.new
154
- end
155
116
  end
156
117
  end
@@ -4,5 +4,9 @@ module Geoblacklight
4
4
  module Exceptions
5
5
  class WrongBoundingBoxFormat < StandardError
6
6
  end
7
+
8
+ # Raised when config/settings.yml sets a key GeoBlacklight does not recognize.
9
+ class InvalidSettings < StandardError
10
+ end
7
11
  end
8
12
  end
@@ -34,8 +34,6 @@ module Geoblacklight
34
34
  {type => endpoint}
35
35
  end
36
36
 
37
- private
38
-
39
37
  ##
40
38
  # The URI used for this instance's creation
41
39
  # Remove any trailing slashes
@@ -43,6 +43,17 @@ module Geoblacklight
43
43
  @refs.find { |reference| reference.type == ref_type }
44
44
  end
45
45
 
46
+ ##
47
+ # Finds a reference by its literal dct:references URI key, rather than by
48
+ # its registered Constants::URI type. Needed for configurable URI keys
49
+ # (e.g. Geoblacklight.configuration.thumbnail_reference_key) that aren't
50
+ # necessarily registered in Constants::URI.
51
+ # @param [String] uri
52
+ # @return [Geoblacklight::Reference, nil]
53
+ def find_by_uri(uri)
54
+ @refs.find { |reference| reference.uri == uri }
55
+ end
56
+
46
57
  ##
47
58
  # Returns all of the Esri webservices for given set of references
48
59
  def esri_webservices
@@ -57,11 +68,12 @@ module Geoblacklight
57
68
  # Parses the references field of a document
58
69
  # @return [Hash]
59
70
  def parse_references
60
- if @document[reference_field].nil?
61
- {}
62
- else
63
- JSON.parse(@document[reference_field])
64
- end
71
+ return {} if @document[reference_field].nil?
72
+
73
+ JSON.parse(@document[reference_field])
74
+ rescue JSON::ParserError
75
+ Geoblacklight.logger.warn("Could not parse #{reference_field} on document #{@document.id}: invalid JSON")
76
+ {}
65
77
  end
66
78
 
67
79
  ##
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Geoblacklight
4
+ module Relations
5
+ class Ancestors < Query
6
+ def create_search_params
7
+ {fq: ["{!join from=#{@field} to=#{Geoblacklight.configuration.fields.id}}#{Geoblacklight.configuration.fields.id}:#{@search_id}"]}
8
+ .merge(shared_search_params)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Geoblacklight
4
+ module Relations
5
+ class Descendants < Query
6
+ def create_search_params
7
+ {fq: "#{@field}:#{@search_id}"}.merge(shared_search_params)
8
+ end
9
+ end
10
+ end
11
+ end