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
@@ -1,29 +1,29 @@
1
1
  {
2
- "dct_title_s": "Wabash River Aerial Imagery: Indiana, 1929",
2
+ "dct_title_s": "USGS Digital Raster Graphic Mosaic: Illinois",
3
+ "dct_alternative_sm": ["esri-image-map-layer"],
3
4
  "dct_description_sm": [
4
- "See Related Records below to download individual GeoTIFFs. The images represented here are the raster orthophoto set collected by remote sensing of 25 aerial images owned by EAS library. Each aerial image was up to 450MB, 400dpi, grayscale. These images can be viewed and performed in the using either ArcGIS Desktop or QGIS (user choice), referencing against a number of known mapsets like the 2005 Indiana Orthophoto setand USGS DRGs. The geographic coordinate system reference of the maps included are applied in GCS_WGS_1984."
5
+ "ArcGIS Image Map Layer served from a statewide raster mosaic. ",
6
+ "A statewide raster mosaic of USGS Digital Raster Graphic (DRG) images of the 7.5-minute topographic quadrangles occurring in Illinois. These are unmodified DRG images as distributed by the USGS, except that collar information has been removed for map tiling and the data have been reprojected. The map scale is 1:24,000, and the images were scanned at 250 dpi, giving an approximate raster cell resolution of 2.5 meters."
5
7
  ],
6
8
  "dct_language_sm": ["eng"],
7
- "dct_creator_sm": ["Brock & Weymouth Inc.", "United States Engineer Office"],
8
- "schema_provider_s": "Purdue University",
9
- "gbl_resourceClass_sm": ["Imagery"],
9
+ "dct_publisher_sm": ["Illinois State Geological Survey"],
10
+ "schema_provider_s": "University of Illinois Urbana-Champaign",
11
+ "gbl_resourceClass_sm": ["Maps"],
12
+ "gbl_resourceType_sm": ["Topographic maps"],
10
13
  "dcat_theme_sm": ["Imagery"],
11
- "dcat_keyword_sm": ["Universities", "Campuses"],
12
- "dct_temporal_sm": ["1929"],
13
- "dct_issued_s": "2015-11-03",
14
- "gbl_indexYear_im": [1929],
15
- "gbl_dateRange_drsim": ["[1929 TO 1929]"],
16
- "dct_spatial_sm": ["Indiana", "West Lafayette, Indiana"],
17
- "locn_geometry": "ENVELOPE(-87.5291,-86.2066,40.8009,39.3999)",
18
- "dcat_bbox": "ENVELOPE(-87.5291,-86.2066,40.8009,39.3999)",
19
- "dcat_centroid": "40.1004,-86.86785",
20
- "pcdm_memberOf_sm": ["dc8c18df-7d64-4ff4-a754-d18d0891187d"],
21
- "dct_isPartOf_sm": ["09d-01"],
14
+ "dcat_keyword_sm": ["GBL Fixture records"],
15
+ "dct_temporal_sm": ["2015"],
16
+ "gbl_indexYear_im": [2015],
17
+ "gbl_dateRange_drsim": ["[2015 TO 2015]"],
18
+ "dct_spatial_sm": ["Illinois"],
19
+ "locn_geometry": "ENVELOPE(-91.7077,-87.2490,42.6314,36.8563)",
20
+ "dcat_bbox": "ENVELOPE(-91.7077,-87.2490,42.6314,36.8563)",
21
+ "dcat_centroid": "39.7438,-89.4784",
22
22
  "dct_accessRights_s": "Public",
23
23
  "dct_format_s": "Image Service",
24
- "dct_references_s": "{\"urn:x-esri:serviceType:ArcGIS#ImageMapLayer\":\"https://mapsweb.lib.purdue.edu/arcgis/rest/services/Purdue/wabashaerial/ImageServer\",\"http://schema.org/url\":\"https://mapsweb.lib.purdue.edu/wabashriver/\"}",
25
- "id": "eee6150b-ce2f-4837-9d17-ce72a0c1c26f",
26
- "dct_identifier_sm": ["eee6150b-ce2f-4837-9d17-ce72a0c1c26f"],
27
- "gbl_mdModified_dt": "2022-05-31T13:44:08Z",
24
+ "dct_references_s": "{\"urn:x-esri:serviceType:ArcGIS#ImageMapLayer\":\"https://data.isgs.illinois.edu/arcgis/rest/services/Imagery/IL_DRG_24K/ImageServer\",\"http://schema.org/url\":\"https://clearinghouse.isgs.illinois.edu/data/reference/usgs-digital-raster-graphic-drg-mosaic\"}",
25
+ "id": "32653ed6-8d83-4692-8a06-bf13ffe2c018",
26
+ "dct_identifier_sm": ["32653ed6-8d83-4692-8a06-bf13ffe2c018"],
27
+ "gbl_mdModified_dt": "2026-08-31T00:00:00Z",
28
28
  "gbl_mdVersion_s": "Aardvark"
29
29
  }
@@ -1,35 +1,33 @@
1
1
  {
2
- "dct_title_s": "Agriculture Census: Indiana, 1997",
2
+ "dct_title_s": "Bedrock Geology: Illinois, 2005",
3
3
  "dct_alternative_sm": ["esri-wms-layer"],
4
4
  "dct_description_sm": [
5
5
  "Dataset with ArcGIS Dynamic Map Layer, ArcGIS WMS, and direct download. ",
6
- "USGS National Atlas metadata states \"This data set portrays the National Agricultural Statistics Service, U.S. Department of Agriculture's 1997 Census data for the United States, presented by county. There are 25 categories of data which include information about farms, crops, livestock, values of products, and farm operator characteristics.\""
6
+ "This feature dataset shows the distribution and extent of the bedrock geologic units within the State of Illinois, as depicted on the map Bedrock Geology of Illinois (2005) by D. Kolata (compiler), published by the Illinois State Geological Survey. The component feature classes show geologic units (polygons) and faults (lines). The nominal scale of the published hardcopy map is 1:500,000."
7
7
  ],
8
- "dct_creator_sm": [
9
- "(creation): U.S. Geological Survey",
10
- "(selection/conversion): Bernardin, Lochmueller and Associates"
11
- ],
12
- "dct_publisher_sm": ["Bernardin, Lochmueller and Associates"],
13
- "schema_provider_s": "Purdue University",
14
- "gbl_resourceClass_sm": ["Datasets"],
15
- "gbl_resourceType_sm": ["Mixed data"],
16
- "dct_subject_sm": ["Agriculture"],
17
- "dcat_theme_sm": ["Farming"],
8
+ "dct_language_sm": ["eng"],
9
+ "dct_creator_sm": ["Illinois State Geological Survey"],
10
+ "dct_publisher_sm": ["Illinois State Geological Survey"],
11
+ "schema_provider_s": "University of Illinois Urbana-Champaign",
12
+ "gbl_resourceClass_sm": ["Datasets", "Web services"],
13
+ "gbl_resourceType_sm": ["Polygon data"],
14
+ "dct_subject_sm": ["Geology"],
15
+ "dcat_theme_sm": ["Geology"],
18
16
  "dcat_keyword_sm": ["GBL Fixture records"],
19
- "dct_temporal_sm": ["1972-1997"],
20
- "dct_issued_s": "2003-01-28",
21
- "gbl_indexYear_im": [1972],
22
- "gbl_dateRange_drsim": ["[1972 TO 1997]"],
23
- "dct_spatial_sm": ["Indiana"],
24
- "locn_geometry": "ENVELOPE(-88.1607,-84.6882,41.7753,37.7554)",
25
- "dcat_bbox": "ENVELOPE(-88.1607,-84.6882,41.7753,37.7554)",
26
- "dcat_centroid": "39.76,-86.42",
17
+ "dct_temporal_sm": ["2005"],
18
+ "dct_issued_s": "2005",
19
+ "gbl_indexYear_im": [2005],
20
+ "gbl_dateRange_drsim": ["[2005 TO 2005]"],
21
+ "dct_spatial_sm": ["Illinois"],
22
+ "locn_geometry": "ENVELOPE(-91.5826823,-87.38401652,42.49563968,36.95351896)",
23
+ "dcat_bbox": "ENVELOPE(-91.5826823,-87.38401652,42.49563968,36.95351896)",
24
+ "dcat_centroid": "39.72457932,-89.48334941",
27
25
  "dct_accessRights_s": "Public",
28
26
  "dct_format_s": "Shapefile",
29
27
  "gbl_wxsIdentifier_s": "0",
30
- "dct_references_s": "{\"http://schema.org/downloadUrl\":\"https://schema.org/downloadUrl:https://maps.indiana.edu/download/Environment/Agriculture_Census.zip\",\"http://schema.org/url\":\"http://indianamap.org/\",\"http://www.isotc211.org/schemas/2005/gmd/\":\"https://opengeometadata.github.io/edu.purdue/f0/82/ac/b1b01e4a089126fd62a23fd9aa/iso19139.xml\",\"urn:x-esri:serviceType:ArcGIS#DynamicMapLayer\":\"https://maps.indiana.edu/arcgis/rest/services/Environment/Agriculture_Census/MapServer\",\"http://www.opengis.net/def/serviceType/ogc/wms\":\"https://maps.indiana.edu/arcgis/services/Environment/Agriculture_Census/MapServer/WMSServer\"}",
31
- "id": "purdue-urn-f082acb1-b01e-4a08-9126-fd62a23fd9aa",
32
- "dct_identifier_sm": ["urn-f082acb1-b01e-4a08-9126-fd62a23fd9aa"],
33
- "gbl_mdModified_dt": "2021-06-01T22:14:15Z",
28
+ "dct_references_s": "{\"http://schema.org/downloadUrl\":\"https://clearinghouse.isgs.illinois.edu/sites/clearinghouse.isgs/files/Clearinghouse/data/ISGS/Geology/zips/IL_Bedrock_Geology_500K_2005_Py.zip\",\"http://schema.org/url\":\"https://clearinghouse.isgs.illinois.edu/data/geology/bedrock-geology-2005\",\"http://www.opengis.net/cat/csw/csdgm\":\"https://clearinghouse.isgs.illinois.edu/sites/clearinghouse.isgs/files/clearinghouse/data/metadata/ISGS/IL_Bedrock_Geology_500K_2005_Py.xml\",\"http://www.w3.org/1999/xhtml\":\"https://clearinghouse.isgs.illinois.edu/sites/clearinghouse.isgs/files/clearinghouse/data/metadata/ISGS/IL_Bedrock_Geology_500K_2005_Py.html\",\"urn:x-esri:serviceType:ArcGIS#DynamicMapLayer\":\"https://data.isgs.illinois.edu/arcgis/rest/services/Geology/Bedrock_Geology_500K_2005/MapServer\",\"http://www.opengis.net/def/serviceType/ogc/wms\":\"https://data.isgs.illinois.edu/arcgis/services/Geology/Bedrock_Geology_500K_2005/MapServer/WMSServer\"}",
29
+ "id": "5f92e192-7e3f-4ec7-a193-8c165288560a",
30
+ "dct_identifier_sm": ["5f92e192-7e3f-4ec7-a193-8c165288560a"],
31
+ "gbl_mdModified_dt": "2026-08-29T00:00:00Z",
34
32
  "gbl_mdVersion_s": "Aardvark"
35
33
  }
@@ -14,9 +14,9 @@
14
14
  "gbl_indexYear_im": [1960],
15
15
  "gbl_dateRange_drsim": ["[1960 TO 1969]"],
16
16
  "dct_spatial_sm": ["New York"],
17
- "locn_geometry": "ENVELOPE(-74.783,-74.733,40.2,40.166)",
18
- "dcat_bbox": "ENVELOPE(-74.783,-74.733,40.2,40.166)",
19
- "dcat_centroid": "40.183,-74.75800000000001",
17
+ "locn_geometry": "ENVELOPE(-77.354137,-75.866513,43.433722,42.261578)",
18
+ "dcat_bbox": "ENVELOPE(-77.354137,-75.866513,43.433722,42.261578)",
19
+ "dcat_centroid": "42.84765,-76.610325",
20
20
  "dct_accessRights_s": "Public",
21
21
  "dct_format_s": "GeoJSON",
22
22
  "dct_references_s": "{\"http://schema.org/downloadUrl\":\"https://raw.githubusercontent.com/OpenIndexMaps/edu.cornell/master/ny-aerial-photos-1960s.geojson\",\"https://openindexmaps.org\":\"https://raw.githubusercontent.com/geoblacklight/geoblacklight/main/spec/fixtures/index_maps/index-map-point.geojson\"}",
@@ -0,0 +1,28 @@
1
+ {
2
+ "dct_title_s": "1994 General Plan Land Use Designations, Stanislaus County, California, 2014",
3
+ "dct_alternative_sm": ["public_polygon"],
4
+ "dct_description_sm": ["Polygon shapefile with WMS and WFS, and no metadata reference"],
5
+ "dct_creator_sm": ["Stanislaus County (Calif.). Planning Department"],
6
+ "dct_publisher_sm": ["Stanislaus County (Calif.)"],
7
+ "schema_provider_s": "University of California Berkeley",
8
+ "gbl_resourceClass_sm": ["Datasets"],
9
+ "gbl_resourceType_sm": ["Polygon data", "Vector data"],
10
+ "dct_subject_sm": ["Land Use", "Land Use Mapping"],
11
+ "dcat_keyword_sm": ["GBL Fixture records"],
12
+ "dct_temporal_sm": ["2014"],
13
+ "dct_issued_s": "2014-10-22",
14
+ "gbl_indexYear_im": [2014],
15
+ "gbl_dateRange_drsim": ["[2014 TO 2014]"],
16
+ "dct_spatial_sm": ["Stanislaus County (Calif.)", "California"],
17
+ "locn_geometry": "ENVELOPE(-121.495138,-120.387591,38.07778,37.132488)",
18
+ "dcat_bbox": "ENVELOPE(-121.495138,-120.387591,38.07778,37.132488)",
19
+ "dcat_centroid": "37.605134,-120.9413645",
20
+ "dct_accessRights_s": "Public",
21
+ "dct_format_s": "Shapefile",
22
+ "gbl_wxsIdentifier_s": "s7pq31",
23
+ "dct_references_s": "{\"http://www.opengis.net/def/serviceType/ogc/wfs\":\"https://geoservices.lib.berkeley.edu/geoserver/wfs\",\"http://www.opengis.net/def/serviceType/ogc/wms\":\"https://geoservices.lib.berkeley.edu/geoserver/wms\"}",
24
+ "id": "berkeley-s7pq31",
25
+ "dct_identifier_sm": ["https://spatial.lib.berkeley.edu/viewpublic/berkeley-s7pq31"],
26
+ "gbl_mdModified_dt": "2018-02-23T23:34:35Z",
27
+ "gbl_mdVersion_s": "Aardvark"
28
+ }
@@ -7,6 +7,28 @@ RSpec.describe GeoblacklightHelper, type: :helper do
7
7
  include ActionView::Helpers::UrlHelper
8
8
  include ActionView::Helpers::TranslationHelper
9
9
 
10
+ describe "#geoblacklight_viewer_theme" do
11
+ before do
12
+ allow(helper).to receive(:blacklight_config).and_return(blacklight_config)
13
+ end
14
+
15
+ context "when dark mode support is disabled" do
16
+ let(:blacklight_config) { Struct.new(:dark_mode_support).new(false) }
17
+
18
+ it "states light explicitly" do
19
+ expect(helper.geoblacklight_viewer_theme).to eq "light"
20
+ end
21
+ end
22
+
23
+ context "when dark mode support is enabled" do
24
+ let(:blacklight_config) { Struct.new(:dark_mode_support).new(true) }
25
+
26
+ it "leaves the theme to the Bootstrap synchronizer" do
27
+ expect(helper.geoblacklight_viewer_theme).to be_nil
28
+ end
29
+ end
30
+ end
31
+
10
32
  describe "#geoblacklight_icon" do
11
33
  it "supports in use cases" do
12
34
  {
@@ -23,50 +45,106 @@ RSpec.describe GeoblacklightHelper, type: :helper do
23
45
  end
24
46
  end
25
47
 
26
- describe "#snippit" do
27
- let(:document) { SolrDocument.new(document_attributes) }
48
+ describe "#markdown_to_html" do
49
+ it "transforms markdown into HTML" do
50
+ expect(helper.markdown_to_html("a **short** description")).to eq "<p>a <strong>short</strong> description</p>\n"
51
+ end
52
+ end
53
+
54
+ describe "#geoblacklight_thumbnail" do
28
55
  let(:references_field) { Geoblacklight.configuration.fields.references }
29
- context "as a String" do
56
+ let(:document) { SolrDocument.new(document_attributes) }
57
+
58
+ context "with a thumbnail URL" do
30
59
  let(:document_attributes) do
31
60
  {
32
- value: "This is a really long string that should get truncated when it gets rendered" \
33
- "in the index view to give a brief description of the contents of a particular document" \
34
- "indexed into Solr"
61
+ references_field => {
62
+ "http://schema.org/thumbnailUrl" => "http://example.com/thumb.jpg"
63
+ }.to_json
35
64
  }
36
65
  end
37
- it "truncates longer strings to 150 characters" do
38
- expect(helper.snippit(document).length).to eq 150
39
- end
40
- it "truncated string ends with ..." do
41
- expect(helper.snippit(document)[-3..]).to eq "..."
66
+ it "renders an image tag" do
67
+ html = Capybara.string(helper.geoblacklight_thumbnail(document))
68
+ expect(html).to have_css "img[src='http://example.com/thumb.jpg']"
42
69
  end
43
70
  end
44
- context "as an Array" do
71
+
72
+ context "with only a IIIF image reference" do
45
73
  let(:document_attributes) do
46
74
  {
47
- value: ["This is a really long string that should get truncated when it gets rendered" \
48
- "in the index view to give a brief description of the contents of a particular document" \
49
- "indexed into Solr"]
75
+ references_field => {
76
+ "http://iiif.io/api/image" => "https://iiif.example.com/iiif/2/abc%2Fdef/info.json"
77
+ }.to_json
50
78
  }
51
79
  end
52
- it "truncates longer strings to 150 characters" do
53
- expect(helper.snippit(document).length).to eq 150
80
+ it "renders an image tag using the URL inferred from info.json" do
81
+ html = Capybara.string(helper.geoblacklight_thumbnail(document))
82
+ expect(html).to have_css "img[src='https://iiif.example.com/iiif/2/abc%2Fdef/full/400,/0/default.jpg']"
54
83
  end
55
- it "truncated string ends with ..." do
56
- expect(helper.snippit(document)[-3..]).to eq "..."
84
+ end
85
+
86
+ context "without a thumbnail URL" do
87
+ let(:document_attributes) { {} }
88
+ it "returns nil" do
89
+ expect(helper.geoblacklight_thumbnail(document)).to be_nil
57
90
  end
58
91
  end
59
- context "as a multivalued Array" do
92
+
93
+ context "when thumbnails are disabled" do
60
94
  let(:document_attributes) do
61
95
  {
62
- value: %w[short description]
96
+ references_field => {
97
+ "http://schema.org/thumbnailUrl" => "http://example.com/thumb.jpg"
98
+ }.to_json
63
99
  }
64
100
  end
65
- it "uses both values" do
66
- expect(helper.snippit(document)).to eq "short description"
101
+ it "returns nil even though a thumbnail URL is present" do
102
+ allow(Geoblacklight.configuration).to receive_messages(thumbnails_enabled: false)
103
+ expect(helper.geoblacklight_thumbnail(document)).to be_nil
104
+ end
105
+ end
106
+ end
107
+
108
+ describe "#geoblacklight_default_thumbnail" do
109
+ let(:resource_type_field) { Geoblacklight.configuration.fields.resource_type }
110
+ let(:resource_class_field) { Geoblacklight.configuration.fields.resource_class }
111
+ let(:document) { SolrDocument.new(document_attributes) }
112
+
113
+ context "with a recognized data-type resource_type" do
114
+ let(:document_attributes) { {resource_type_field => ["Raster data"]} }
115
+ it "renders the data-type icon" do
116
+ html = Capybara.string(helper.geoblacklight_default_thumbnail(document))
117
+ expect(html).to have_xpath "//*[local-name() = 'svg']"
118
+ end
119
+ end
120
+
121
+ context "without a matching resource_type icon, but a recognized resource_class" do
122
+ let(:document_attributes) { {resource_class_field => ["Datasets"]} }
123
+ it "falls back to the resource_class icon" do
124
+ html = Capybara.string(helper.geoblacklight_default_thumbnail(document))
125
+ expect(html).to have_xpath "//*[local-name() = 'svg']"
126
+ end
127
+ end
128
+
129
+ context "with neither a recognized resource_type nor resource_class" do
130
+ let(:document_attributes) { {resource_type_field => ["Nonexistent data"], resource_class_field => ["TotallyUnknown"]} }
131
+ it "uses the 'missing icon' icon as a fallback" do
132
+ expect(helper.geoblacklight_default_thumbnail(document)).to eq "<span class=\"icon-missing geoblacklight-none\"></span>"
133
+ end
134
+ end
135
+
136
+ context "without any resource_type or resource_class" do
137
+ let(:document_attributes) { {} }
138
+ it "uses the 'missing icon' icon as a fallback" do
139
+ expect(helper.geoblacklight_default_thumbnail(document)).to eq "<span class=\"icon-missing geoblacklight-none\"></span>"
67
140
  end
68
- it "does not truncate" do
69
- expect(helper.snippit(document)[-3..]).not_to eq "..."
141
+ end
142
+
143
+ context "when thumbnails are disabled" do
144
+ let(:document_attributes) { {resource_class_field => ["Datasets"]} }
145
+ it "returns nil even though a matching icon exists" do
146
+ allow(Geoblacklight.configuration).to receive_messages(thumbnails_enabled: false)
147
+ expect(helper.geoblacklight_default_thumbnail(document)).to be_nil
70
148
  end
71
149
  end
72
150
  end
@@ -16,6 +16,22 @@ RSpec.describe Geoblacklight::BoundingBox do
16
16
  expect(example_box.to_envelope).to eq "ENVELOPE(-160, 120, 70, -80)"
17
17
  end
18
18
  end
19
+ describe "#to_geojson" do
20
+ let(:example_box) { described_class.new(-160, -80, 120, 70) }
21
+
22
+ it "creates a GeoJSON polygon around the bounding box" do
23
+ expect(JSON.parse(example_box.to_geojson)).to eq(
24
+ "type" => "Polygon",
25
+ "coordinates" => [[
26
+ [-160.0, -80.0],
27
+ [-160.0, 70.0],
28
+ [120.0, 70.0],
29
+ [120.0, -80.0],
30
+ [-160.0, -80.0]
31
+ ]]
32
+ )
33
+ end
34
+ end
19
35
  describe "#from_rectangle" do
20
36
  let(:example_box) { described_class.from_rectangle("-160 -80 120 70") }
21
37
  it "parses and creates a Geoblacklight::BoundingBox from a Solr lat-lon" do
@@ -0,0 +1,121 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Geoblacklight::Configuration::RelationshipsConfig do
4
+ before do
5
+ allow(Geoblacklight::Deprecation).to receive(:warn)
6
+ Geoblacklight::Configuration::RelationshipConfig.reset_removed_attribute_warnings!
7
+ end
8
+
9
+ describe "the defaults" do
10
+ subject(:config) { described_class.new }
11
+
12
+ it "carries the twelve relationships, lowercased" do
13
+ expect(config.each_key.to_a).to eq(
14
+ %i[
15
+ member_of_ancestors member_of_descendants
16
+ part_of_ancestors part_of_descendants
17
+ relation_ancestors relation_descendants
18
+ replaces_ancestors replaces_descendants
19
+ source_ancestors source_descendants
20
+ version_of_ancestors version_of_descendants
21
+ ]
22
+ )
23
+ end
24
+
25
+ it "builds each entry as a RelationshipConfig" do
26
+ expect(config.map { |_name, entry| entry }).to all(be_a(Geoblacklight::Configuration::RelationshipConfig))
27
+ end
28
+
29
+ it "does not warn" do
30
+ config
31
+
32
+ expect(Geoblacklight::Deprecation).not_to have_received(:warn)
33
+ end
34
+ end
35
+
36
+ describe "a settings file carried over from GeoBlacklight 5" do
37
+ # Verbatim from the config/settings.yml that GeoBlacklight 4.0 and later wrote:
38
+ # uppercase entry names, an uppercase inverse, and an icon on every entry.
39
+ subject(:config) do
40
+ described_class.new(
41
+ MEMBER_OF_ANCESTORS: {
42
+ field: "pcdm_memberOf_sm",
43
+ icon: "parent-item",
44
+ inverse: :MEMBER_OF_DESCENDANTS,
45
+ label: "geoblacklight.relations.member_of_ancestors",
46
+ query_type: "ancestors"
47
+ },
48
+ MEMBER_OF_DESCENDANTS: {
49
+ field: "pcdm_memberOf_sm",
50
+ icon: "child-item",
51
+ inverse: :MEMBER_OF_ANCESTORS,
52
+ label: "geoblacklight.relations.member_of_descendants",
53
+ query_type: "descendants"
54
+ }
55
+ )
56
+ end
57
+
58
+ it "builds without raising" do
59
+ expect { config }.not_to raise_error
60
+ end
61
+
62
+ it "lowercases the entry names" do
63
+ expect(config.each_key.to_a).to eq(%i[member_of_ancestors member_of_descendants])
64
+ end
65
+
66
+ it "keeps the rest of each entry intact" do
67
+ expect(config[:member_of_ancestors].field).to eq("pcdm_memberOf_sm")
68
+ expect(config[:member_of_ancestors].query_type).to eq("ancestors")
69
+ expect(config[:member_of_ancestors].label).to eq("geoblacklight.relations.member_of_ancestors")
70
+ end
71
+
72
+ it "warns once about the icons rather than once per entry" do
73
+ config
74
+
75
+ expect(Geoblacklight::Deprecation).to have_received(:warn).once.with(/icon/)
76
+ end
77
+
78
+ # RelationsComponent builds each card's "Browse all ..." link from the entry
79
+ # name, and its regexp only matches the lowercase form. Left uppercase, the
80
+ # link renders as a titleized key instead of a sentence.
81
+ it "produces names that RelationsComponent can derive a browse label from" do
82
+ browse_keys = config.each_key.map { |name| name.to_s.sub(/_(ancestors|descendants)\z/, "") }
83
+
84
+ expect(browse_keys).to eq(%w[member_of member_of])
85
+ end
86
+ end
87
+
88
+ describe "lookup" do
89
+ subject(:config) { described_class.new(MEMBER_OF_ANCESTORS: {field: "pcdm_memberOf_sm"}) }
90
+
91
+ it "finds a normalized name with #[]" do
92
+ expect(config[:member_of_ancestors].field).to eq("pcdm_memberOf_sm")
93
+ end
94
+
95
+ it "reports a normalized name with #key?" do
96
+ expect(config.key?(:member_of_ancestors)).to be true
97
+ expect(config.key?(:MEMBER_OF_ANCESTORS)).to be false
98
+ end
99
+
100
+ it "answers a normalized name as a method" do
101
+ expect(config.member_of_ancestors.field).to eq("pcdm_memberOf_sm")
102
+ end
103
+
104
+ it "still raises NoMethodError for a name it does not have" do
105
+ expect { config.no_such_relationship }.to raise_error(NoMethodError)
106
+ end
107
+ end
108
+
109
+ describe "an unrecognized key" do
110
+ it "raises, naming the file and the key" do
111
+ expect { described_class.new(member_of_ancestors: {field: "x", quiery_type: "ancestors"}) }
112
+ .to raise_error(Geoblacklight::Exceptions::InvalidSettings, /"quiery_type"/)
113
+ end
114
+ end
115
+
116
+ it "passes an already-built RelationshipConfig through untouched" do
117
+ entry = Geoblacklight::Configuration::RelationshipConfig.new(field: "pcdm_memberOf_sm")
118
+
119
+ expect(described_class.new(member_of_ancestors: entry)[:member_of_ancestors]).to be(entry)
120
+ end
121
+ end
@@ -0,0 +1,113 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Geoblacklight::Configuration::SettingsAttributes do
4
+ # Exercised through the two real classes that include it rather than a stub, so
5
+ # these also cover the wiring in each class.
6
+ shared_examples "a settings-backed value object" do |section:|
7
+ it "declares the settings.yml section it is built from" do
8
+ expect(described_class.settings_section).to eq(section)
9
+ end
10
+
11
+ it "resolves an uppercase key to its lowercase attribute" do
12
+ attribute = described_class.attribute_names.first
13
+
14
+ expect(described_class.new(attribute.upcase.to_sym => "a value").public_send(attribute)).to eq("a value")
15
+ end
16
+
17
+ it "assigns recognized attributes without complaint" do
18
+ attributes = described_class.attribute_names.to_h { |name| [name.to_sym, "a value"] }
19
+
20
+ expect { described_class.new(attributes) }.not_to raise_error
21
+ end
22
+
23
+ it "raises for an unrecognized key, naming the section and what is accepted" do
24
+ expect { described_class.new(no_such_key: "a value") }.to raise_error(
25
+ Geoblacklight::Exceptions::InvalidSettings,
26
+ /#{section}.*"no_such_key".*#{Regexp.escape(described_class.attribute_names.join(", "))}/m
27
+ )
28
+ end
29
+
30
+ # ActiveModel::AttributeAssignment defines a raising attribute_writer_missing.
31
+ # If SettingsAttributes is ever included before ActiveModel -- for instance by
32
+ # rewriting it as an ActiveSupport::Concern that includes ActiveModel itself --
33
+ # ActiveModel's version wins and every example above starts failing for a
34
+ # reason that has nothing to do with the behavior being tested.
35
+ it "installs its override ahead of ActiveModel's raising default" do
36
+ expect(described_class.instance_method(:attribute_writer_missing).owner)
37
+ .to eq(Geoblacklight::Configuration::SettingsAttributes)
38
+ end
39
+ end
40
+
41
+ describe Geoblacklight::Configuration::RelationshipConfig do
42
+ before do
43
+ allow(Geoblacklight::Deprecation).to receive(:warn)
44
+ described_class.reset_removed_attribute_warnings!
45
+ end
46
+
47
+ it_behaves_like "a settings-backed value object", section: "RELATIONSHIPS_SHOWN"
48
+
49
+ it "treats icon as removed" do
50
+ expect(described_class.removed_attributes).to eq(%w[icon])
51
+ end
52
+
53
+ it "builds successfully from a verbatim GeoBlacklight 5 entry" do
54
+ config = described_class.new(
55
+ field: "pcdm_memberOf_sm",
56
+ icon: "parent-item",
57
+ inverse: :member_of_descendants,
58
+ label: "geoblacklight.relations.member_of_ancestors",
59
+ query_type: "ancestors"
60
+ )
61
+
62
+ expect(config.field).to eq("pcdm_memberOf_sm")
63
+ expect(config.query_type).to eq("ancestors")
64
+ end
65
+
66
+ it "does not carry the removed attribute" do
67
+ expect(described_class.attribute_names).not_to include("icon")
68
+ end
69
+
70
+ it "warns that icon is no longer read" do
71
+ described_class.new(icon: "parent-item")
72
+
73
+ expect(Geoblacklight::Deprecation).to have_received(:warn).with(/icon.*RELATIONSHIPS_SHOWN/)
74
+ end
75
+
76
+ it "warns about an uppercase removed attribute too" do
77
+ described_class.new({ICON: "parent-item"})
78
+
79
+ expect(Geoblacklight::Deprecation).to have_received(:warn).with(/icon/)
80
+ end
81
+
82
+ it "warns only once however many entries set it" do
83
+ 12.times { described_class.new(field: "pcdm_memberOf_sm", icon: "parent-item") }
84
+
85
+ expect(Geoblacklight::Deprecation).to have_received(:warn).once
86
+ end
87
+
88
+ it "does not warn when no removed attribute is set" do
89
+ described_class.new(field: "pcdm_memberOf_sm")
90
+
91
+ expect(Geoblacklight::Deprecation).not_to have_received(:warn)
92
+ end
93
+ end
94
+
95
+ describe Geoblacklight::Configuration::DisplayNoteShownConfig do
96
+ before { allow(Geoblacklight::Deprecation).to receive(:warn) }
97
+
98
+ it_behaves_like "a settings-backed value object", section: "DISPLAY_NOTES_SHOWN"
99
+
100
+ it "has no removed attributes" do
101
+ expect(described_class.removed_attributes).to be_empty
102
+ end
103
+
104
+ # icon means opposite things in the two classes: RelationshipConfig drops it,
105
+ # while here it is a real attribute that has to survive.
106
+ it "keeps icon, which is one of its own attributes" do
107
+ config = described_class.new(icon: "circle-info-solid", note_prefix: "Info: ")
108
+
109
+ expect(config.icon).to eq("circle-info-solid")
110
+ expect(Geoblacklight::Deprecation).not_to have_received(:warn)
111
+ end
112
+ end
113
+ end
@@ -19,8 +19,7 @@ RSpec.describe Geoblacklight::Configuration::SettingsBuilder do
19
19
  let(:settings) do
20
20
  {
21
21
  institution: "MIT",
22
- fields: {title: "my_title_s"},
23
- leaflet: {selected_color: "#abc123", sidebar: true}
22
+ fields: {title: "my_title_s"}
24
23
  }
25
24
  end
26
25
 
@@ -30,8 +29,6 @@ RSpec.describe Geoblacklight::Configuration::SettingsBuilder do
30
29
 
31
30
  it "resolves nested lowercase keys" do
32
31
  expect(config.fields.title).to eq("my_title_s")
33
- expect(config.leaflet_options.selected_color).to eq("#abc123")
34
- expect(config.leaflet_options.sidebar).to be true
35
32
  end
36
33
  end
37
34
 
@@ -194,6 +191,38 @@ RSpec.describe Geoblacklight::Configuration::SettingsBuilder do
194
191
  expect(Geoblacklight::Deprecation).to have_received(:warn).with(a_string_matching(/DISPLAY_NOTES_SHOWN/i))
195
192
  end
196
193
  end
194
+
195
+ describe "relationships_shown" do
196
+ it "preserves the defaults when RELATIONSHIPS_SHOWN is absent" do
197
+ expect(described_class.new(settings: {}).build.relationships_shown.each_key.to_a)
198
+ .to include(:member_of_ancestors, :version_of_descendants)
199
+ end
200
+
201
+ # The block every config/settings.yml generated since GeoBlacklight 4.0
202
+ # contains. Before GeoBlacklight tolerated the icon attribute, this raised
203
+ # ActiveModel::UnknownAttributeError while the configuration was built --
204
+ # which in production meant the application would not boot.
205
+ it "builds from a GeoBlacklight 5 block with icons and uppercase names" do
206
+ allow(Geoblacklight::Deprecation).to receive(:warn)
207
+ settings = {
208
+ RELATIONSHIPS_SHOWN: {
209
+ MEMBER_OF_ANCESTORS: {
210
+ field: "pcdm_memberOf_sm",
211
+ icon: "parent-item",
212
+ inverse: :MEMBER_OF_DESCENDANTS,
213
+ label: "geoblacklight.relations.member_of_ancestors",
214
+ query_type: "ancestors"
215
+ }
216
+ }
217
+ }
218
+
219
+ result = described_class.new(settings: settings).build.relationships_shown
220
+
221
+ expect(result.each_key.to_a).to eq([:member_of_ancestors])
222
+ expect(result[:member_of_ancestors].field).to eq("pcdm_memberOf_sm")
223
+ expect(result[:member_of_ancestors].query_type).to eq("ancestors")
224
+ end
225
+ end
197
226
  end
198
227
  end
199
228