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,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Geoblacklight
4
- class Configuration
5
- class LeafletLayersConfig
6
- include ActiveModel::Model
7
- include ActiveModel::Attributes
8
-
9
- attribute :detect_retina, :boolean, default: true
10
-
11
- attr_reader :index
12
-
13
- def initialize(attributes = {})
14
- super
15
- self.index = attributes[:index]
16
- end
17
-
18
- def index=(values)
19
- @index = (values || {}).transform_values do |val|
20
- if val.is_a?(LayerConfig)
21
- val
22
- else
23
- LayerConfig.new(val)
24
- end
25
- end
26
- end
27
-
28
- def to_h
29
- attributes.merge({"index" => index.transform_values(&:to_h)})
30
- end
31
- end
32
- end
33
- end
@@ -1,20 +0,0 @@
1
- module Geoblacklight
2
- class Configuration
3
- class LeafletSleepConfig
4
- include ActiveModel::Model
5
- include ActiveModel::Attributes
6
-
7
- attribute :sleep, :boolean, default: true # set to false to disable
8
- attribute :margin_distance, :integer, default: 100 # set to zero / false if you want to disable this check
9
- attribute :sleeptime, :integer, default: 750
10
- attribute :waketime, :integer, default: 750
11
- attribute :hovertowake, :boolean, default: false
12
- attribute :message, :string, default: -> { I18n.t("geoblacklight.map.sleep.click_to_wake") }
13
- attribute :background, :string, default: "rgba(214, 214, 214, .7)"
14
-
15
- def to_h
16
- attributes
17
- end
18
- end
19
- end
20
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Geoblacklight
4
- module Relation
5
- class Ancestors
6
- def initialize(id, field, repository)
7
- @search_id = id
8
- @field = field
9
- @repository = repository
10
- end
11
-
12
- def create_search_params
13
- {fq: ["{!join from=#{@field} to=#{Geoblacklight.configuration.fields.id}}#{Geoblacklight.configuration.fields.id}:#{@search_id}"],
14
- fl: [Geoblacklight.configuration.fields.title, Geoblacklight.configuration.fields.id,
15
- Geoblacklight.configuration.fields.resource_type]}
16
- end
17
-
18
- def execute_query
19
- @repository.connection.send_and_receive(
20
- @repository.blacklight_config.solr_path,
21
- params: create_search_params
22
- )
23
- end
24
-
25
- def results
26
- response = execute_query
27
- response["response"]
28
- end
29
- end
30
- end
31
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Geoblacklight
4
- module Relation
5
- class Descendants
6
- def initialize(id, field, repository)
7
- @search_id = id
8
- @field = field
9
- @repository = repository
10
- end
11
-
12
- def create_search_params
13
- {fq: "#{@field}:#{@search_id}",
14
- fl: [Geoblacklight.configuration.fields.title, Geoblacklight.configuration.fields.id,
15
- Geoblacklight.configuration.fields.resource_type]}
16
- end
17
-
18
- def execute_query
19
- @repository.connection.send_and_receive(
20
- @repository.blacklight_config.solr_path,
21
- params: create_search_params
22
- )
23
- end
24
-
25
- def results
26
- response = execute_query
27
- response["response"]
28
- end
29
- end
30
- end
31
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Geoblacklight
4
- module Routes
5
- class Wms
6
- def initialize(defaults = {})
7
- @defaults = defaults
8
- end
9
-
10
- def call(mapper, _options = {})
11
- mapper.post "handle"
12
- end
13
- end
14
- end
15
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Geoblacklight
4
- class FeatureInfoResponse
5
- def initialize(response)
6
- @response = response
7
- end
8
-
9
- def check
10
- if error?
11
- @response
12
- else
13
- format
14
- end
15
- end
16
-
17
- def format
18
- JSON.parse(@response.body)
19
- rescue
20
- page = Nokogiri::HTML(@response.body)
21
- properties = {}
22
- values = {}
23
- page.css("td").each_with_index do |td, index|
24
- values[index] = td.text
25
- end
26
- page.css("th").each_with_index do |th, index|
27
- properties[th.text] = values[index] unless index >= values.keys.count
28
- end
29
- {features: [{properties: properties, isHTML: true}]}
30
- end
31
-
32
- def error?
33
- @response[:error] ||
34
- @response.headers["content-type"].slice(0, 9) == "text/xml"
35
- end
36
- end
37
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Geoblacklight
4
- class WmsLayer
5
- def initialize(params)
6
- @params = params.to_h.merge(Geoblacklight.configuration.wms_params)
7
- @response = Geoblacklight::FeatureInfoResponse.new(request_response)
8
- end
9
-
10
- def url
11
- @params["URL"]
12
- end
13
-
14
- def search_params
15
- @params.except("URL")
16
- end
17
-
18
- def feature_info
19
- @response.check
20
- end
21
-
22
- def request_response
23
- conn = Faraday.new(url: url)
24
- conn.get do |request|
25
- request.params = search_params
26
- request.options.timeout = Geoblacklight.configuration.timeout_wms
27
- request.options.open_timeout = Geoblacklight.configuration.timeout_wms
28
- end
29
- rescue Faraday::ConnectionFailed, Faraday::TimeoutError => error
30
- Geoblacklight.logger.error error.inspect
31
- {error: error.inspect}
32
- end
33
- end
34
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe Geoblacklight::AttributeTableComponent, type: :component do
6
- let(:document) { instance_double(SolrDocument, inspectable?: true) }
7
-
8
- before do
9
- allow_any_instance_of(GeoblacklightHelper).to receive(:document_available?).and_return(true)
10
- end
11
-
12
- it "displays attribute table body element" do
13
- render_inline(described_class.new(document:))
14
- expect(page).to have_selector(".attribute-table-body")
15
- end
16
-
17
- context "when the document is not inspectable" do
18
- before { allow(document).to receive(:inspectable?).and_return(false) }
19
-
20
- it "does not render the attribute table" do
21
- render_inline(described_class.new(document:))
22
- expect(page).not_to have_selector(".attribute-table-body")
23
- end
24
- end
25
-
26
- context "when the document is not available" do
27
- before do
28
- allow_any_instance_of(GeoblacklightHelper).to receive(:document_available?).and_return(false)
29
- end
30
-
31
- it "does not render the attribute table" do
32
- render_inline(described_class.new(document:))
33
- expect(page).not_to have_selector(".attribute-table-body")
34
- end
35
- end
36
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe Geoblacklight::IndexMapLegendComponent, type: :component do
6
- let(:document) { instance_double(SolrDocument) }
7
-
8
- context "when the document has an index map" do
9
- before do
10
- allow(document).to receive_message_chain(:item_viewer, :index_map).and_return(true)
11
- end
12
-
13
- it "renders the legend" do
14
- render_inline(described_class.new(document:))
15
- expect(page.text.strip).to include "Green tile indicates Map held by collection"
16
- end
17
- end
18
-
19
- context "when the document does not have an index map" do
20
- before do
21
- allow(document).to receive_message_chain(:item_viewer, :index_map).and_return(false)
22
- end
23
-
24
- it "does not render" do
25
- render_inline(described_class.new(document:))
26
- expect(page.text.strip).to be_empty
27
- end
28
- end
29
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe Geoblacklight::ViewerHelpTextComponent, type: :component do
6
- let(:feature) { "viewer_protocol" }
7
- let(:key) { "wms" }
8
-
9
- context "when the help text exists for an existing viewer protocol" do
10
- it "shows correct help text title for wms" do
11
- render_inline(described_class.new(feature, key))
12
- expect(page).to have_css(".help-text", count: 1)
13
- expect(page).to have_text(I18n.t("geoblacklight.help_text.viewer_protocol.wms.title"))
14
- end
15
- end
16
-
17
- context "when the help text is missing for a viewer protocol that exists" do
18
- before do
19
- allow(I18n).to receive(:exists?).and_return(false)
20
- end
21
-
22
- it "shows missing help text class" do
23
- render_inline(described_class.new(feature, key))
24
- expect(page).to have_css(".translation-missing")
25
- end
26
- end
27
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe WmsController, type: :controller do
6
- let(:wms_layer) { instance_double(Geoblacklight::WmsLayer) }
7
- let(:feature_info) { {values: ["fid", "layer:example"]} }
8
- let(:params) do
9
- {"format" => "json", "URL" => "http://www.example.com/", "LAYERS" => "layer:example",
10
- "BBOX" => "-74, 40, -68, 43", "WIDTH" => "500", "HEIGHT" => "400",
11
- "QUERY_LAYERS" => "layer:example", "X" => "277", "Y" => "195"}
12
- end
13
-
14
- before do
15
- allow(Geoblacklight::WmsLayer).to receive(:new).and_return(wms_layer)
16
- allow(wms_layer).to receive(:feature_info).and_return(feature_info)
17
- end
18
-
19
- describe "#handle" do
20
- it "returns feature info as json" do
21
- get :handle, params: params
22
- expect(response.body).to eq(feature_info.to_json)
23
- end
24
- end
25
-
26
- describe "#wms_params" do
27
- let(:wms_params) { controller.instance_eval { wms_params } }
28
-
29
- it "returns only permitted params" do
30
- get :handle, params: params
31
- expect(wms_params.to_h).to eq(params)
32
- end
33
- end
34
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.feature "Configurable basemap", js: true do
6
- scenario "defaults to positron" do
7
- visit root_path
8
- expect(page).to have_css "img[src*='carto']", visible: :all
9
- end
10
-
11
- feature "without provided basemap config" do
12
- before do
13
- Geoblacklight.configuration.basemap_provider = nil
14
- end
15
- scenario "has Carto map" do
16
- visit root_path
17
- expect(page).to have_css "img[src*='carto']", visible: :all
18
- end
19
- end
20
-
21
- feature "using dark matter" do
22
- before do
23
- Geoblacklight.configuration.basemap_provider = "dark_matter"
24
- end
25
- scenario "has dark matter map" do
26
- visit root_path
27
- expect(page).to have_css "img[src*='dark_all']", visible: :all
28
- end
29
- end
30
-
31
- feature "using openstreetmap hot" do
32
- before do
33
- Geoblacklight.configuration.basemap_provider = "openstreetmap_hot"
34
- end
35
- scenario "has openstreetmap hot map" do
36
- visit root_path
37
- expect(page).to have_css "img[src*='hot']", visible: :all
38
- end
39
- end
40
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.feature "IIIF fullscreen control", js: true do
6
- scenario "IIIF layer should have full screen control" do
7
- visit solr_document_path("princeton-sx61dn82p")
8
- expect(page).to have_button("Full screen")
9
- end
10
-
11
- scenario "IIIF image should have full screen control" do
12
- visit solr_document_path("princeton-02870w62c")
13
- expect(page).to have_css("img[alt='Toggle full page']")
14
- end
15
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.feature "Layer inspection", js: true do
6
- scenario "clicking map should trigger inspection" do
7
- visit solr_document_path("tufts-cambridgegrid100-04")
8
- expect(page).to have_css("th", text: "Attribute")
9
- find("#leaflet-viewer").click
10
- expect(page).not_to have_css("td.default-text")
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.feature "Layer opacity", js: true do
6
- scenario "WMS layer should have opacity control" do
7
- visit solr_document_path("mit-f6rqs4ucovjk2")
8
- expect(page).to have_css("div.opacity-text", text: "75%")
9
- expect(page.all("div.leaflet-layer")[1][:style]).to match(/opacity: 0.75;/)
10
- end
11
-
12
- scenario "IIIF layer should not have opacity control" do
13
- visit solr_document_path("princeton-02870w62c")
14
- expect(page).not_to have_css("div.opacity-text", text: "75%")
15
- end
16
- end
@@ -1,39 +0,0 @@
1
- {
2
- "dct_title_s": "Saint Petersburg Region, Russia, 1834 (Raster Image)",
3
- "dct_alternative_sm": ["harvard_raster"],
4
- "dct_description_sm": [
5
- "This layer is a georeferenced raster image of the historic paper map entitled: [Karta mesta zanimaemago Sanktpeterburgom : v tom vide v kakom onoe nakhodilos' za god do osnovaniia goroda; sostavlena dlia panoramy S. Peterburga, 1834]. It was published in 1834. Scale [ca. 1:76,000]. Covers Saint Petersburg Region, Russia. Map in Russian and Swedish.\\n\\nThe image inside the map neatline is georeferenced to the surface of the earth and fit to the 'Pulkovo 1995 Gauss Kruger Zone 6N' coordinate system. All map collar and inset information is also available as part of the raster image, including any inset maps, profiles, statistical tables, directories, text, illustrations, index maps, legends, or other information associated with the principal map.\\n\\nThis map shows features such as roads, drainage, built-up areas and selected buildings, ground cover, and more. Relief is shown by hachures. Depths shown by soundings. Includes insets: [Retusari island] -- [Sluselberg]. \\n\\nThis layer is part of a selection of digitally scanned and georeferenced historic maps from The Harvard Map Collection as part of the Imaging the Urban Environment project. Maps selected for this project represent major urban areas and cities of the world, at various time periods. These maps typically portray both natural and manmade features at a large scale. The selection represents a range of regions, originators, ground condition dates, scales, and purposes."
6
- ],
7
- "dct_language_sm": ["eng"],
8
- "dct_publisher_sm": ["Harvard Map Collection, Harvard College Library"],
9
- "schema_provider_s": "Harvard",
10
- "gbl_resourceClass_sm": ["Datasets"],
11
- "gbl_resourceType_sm": ["Raster data"],
12
- "dct_subject_sm": [
13
- "Human settlements",
14
- "Cities and towns",
15
- "Land use",
16
- "Landforms",
17
- "Infrastructure",
18
- "Economics",
19
- "Bodies of water"
20
- ],
21
- "dcat_theme_sm": ["Imagery", "Transportation"],
22
- "dcat_keyword_sm": ["GBL Fixture records"],
23
- "dct_temporal_sm": ["1834"],
24
- "dct_issued_s": "1905-06-22",
25
- "gbl_indexYear_im": [1834],
26
- "gbl_dateRange_drsim": ["[1834 TO 1834]"],
27
- "dct_spatial_sm": ["Russia Saint Petersburg"],
28
- "locn_geometry": "ENVELOPE(30.013108,30.875309,60.041712,59.669749)",
29
- "dcat_bbox": "ENVELOPE(30.013108,30.875309,60.041712,59.669749)",
30
- "dcat_centroid": "59.8557305,30.444208500000002",
31
- "dct_accessRights_s": "Public",
32
- "dct_format_s": "GeoTIFF",
33
- "gbl_wxsIdentifier_s": "cite:G7064_S2_1834_K3",
34
- "dct_references_s": "{\"http://www.opengis.net/def/serviceType/ogc/wcs\":\"http://pelham.lib.harvard.edu:8090/geoserver/wcs\",\"http://www.opengis.net/def/serviceType/ogc/wms\":\"http://pelham.lib.harvard.edu:8090/geoserver/wms\",\"http://www.opengis.net/cat/csw/csdgm\":\"https://raw.githubusercontent.com/OpenGeoMetadata/edu.harvard/master/217/121/227/77/fgdc.xml\"}",
35
- "id": "harvard-g7064-s2-1834-k3",
36
- "dct_identifier_sm": ["urn:hul.harvard.edu:HARVARD.SDE2.G7064_S2_1834_K3"],
37
- "gbl_mdModified_dt": "2021-06-01T22:14:15Z",
38
- "gbl_mdVersion_s": "Aardvark"
39
- }
@@ -1,23 +0,0 @@
1
- {
2
- "dct_title_s": "Massachusetts (ZCTA - 5 digit zip code tabulation area, 2000)",
3
- "dct_alternative_sm": ["public_polygon_mit"],
4
- "dct_description_sm": ["Polygon shapefile with WMS and WFS"],
5
- "dct_creator_sm": ["United States. Bureau of the Census"],
6
- "dct_publisher_sm": ["United States. Bureau of the Census"],
7
- "schema_provider_s": "MIT",
8
- "gbl_resourceClass_sm": ["Maps"],
9
- "gbl_resourceType_sm": ["Polygon data"],
10
- "dct_subject_sm": ["Zip codes", "Census data", "Demographic surveys", "Population"],
11
- "dcat_keyword_sm": ["GBL Fixture records"],
12
- "dct_spatial_sm": ["Massachusetts"],
13
- "locn_geometry": "ENVELOPE(-73.533237,-69.898565,42.888068,41.230345)",
14
- "dcat_bbox": "ENVELOPE(-73.533237,-69.898565,42.888068,41.230345)",
15
- "dcat_centroid": "42.0592065,-71.715901",
16
- "dct_accessRights_s": "Public",
17
- "dct_format_s": "Shapefile",
18
- "gbl_wxsIdentifier_s": "mit:SDE_DATA_US_MA_E25ZCTA5DCT_2000",
19
- "dct_references_s": "{\"http://www.opengis.net/def/serviceType/ogc/wfs\":\"https://geodata.mit.edu/geoserver/wfs\",\"http://www.opengis.net/def/serviceType/ogc/wms\":\"https://geodata.mit.edu/geoserver/wms\"}",
20
- "id": "mit-f6rqs4ucovjk2",
21
- "gbl_mdModified_dt": "2021-06-11T18:42:45Z",
22
- "gbl_mdVersion_s": "Aardvark"
23
- }
@@ -1,29 +0,0 @@
1
- {
2
- "dct_title_s": "Norfolk 2005 Police Stations",
3
- "dct_alternative_sm": ["uva_slug_colon"],
4
- "dct_description_sm": [
5
- "Multipoint dataset with WMS and WFS and a colon in the slug and layer ID. ",
6
- "Police stations for Norfolk, Virginia."
7
- ],
8
- "dct_language_sm": ["eng"],
9
- "schema_provider_s": "UVa",
10
- "gbl_resourceClass_sm": ["Datasets"],
11
- "gbl_resourceType_sm": ["Multipoint data"],
12
- "dcat_theme_sm": ["Location"],
13
- "dcat_keyword_sm": ["GBL Fixture records"],
14
- "dct_temporal_sm": ["2015-2018"],
15
- "dct_issued_s": "2008-10-17",
16
- "gbl_indexYear_im": [2015],
17
- "gbl_dateRange_drsim": ["[2015 TO 2018]"],
18
- "locn_geometry": "ENVELOPE(-76.346,-76.176,36.971,36.82)",
19
- "dcat_bbox": "ENVELOPE(-76.346,-76.176,36.971,36.82)",
20
- "dcat_centroid": "36.8955,-76.261",
21
- "dct_accessRights_s": "Public",
22
- "dct_format_s": "Shapefile",
23
- "gbl_wxsIdentifier_s": "Norfolk:police_point",
24
- "dct_references_s": "{\"http://schema.org/downloadUrl\":\"https://gis.lib.virginia.edu/geoserver/ows?service=WFS\\\\u0026typeName=Norfolk:police_point\\\\u0026request=GetFeature\\\\u0026outputFormat=shape-zip\",\"http://www.isotc211.org/schemas/2005/gmd/\":\"https://opengeometadata.github.io/edu.virginia/382/13/iso19139.xml\",\"http://www.opengis.net/def/serviceType/ogc/wfs\":\"http://gis.lib.virginia.edu/geoserver/wfs\",\"http://www.opengis.net/def/serviceType/ogc/wms\":\"http://www.opengis.net/def/serviceType/ogc/wms:http://gis.lib.virginia.edu/geoserver/wms\"}",
25
- "id": "uva-Norfolk:police_point",
26
- "dct_identifier_sm": ["315fc8ee-3b57-4ebb-aa24-4300f1c42dc9-13"],
27
- "gbl_mdModified_dt": "2021-06-01T22:14:17Z",
28
- "gbl_mdVersion_s": "Aardvark"
29
- }
@@ -1,11 +0,0 @@
1
- describe("GeoBlacklight", function () {
2
- describe("loads and makes available libraries", function () {
3
- it("Leaflet is defined", function () {
4
- expect(L).toBeDefined()
5
- })
6
-
7
- it("History.js is defined", function () {
8
- expect(History).toBeDefined()
9
- })
10
- })
11
- })
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe Geoblacklight::Configuration::LayerConfig do
6
- subject(:config) { described_class.new(attributes) }
7
-
8
- let(:attributes) { {} }
9
-
10
- describe "defaults" do
11
- it "has weight defaulting to 1" do
12
- expect(config.weight).to eq(1)
13
- end
14
-
15
- it "has radius defaulting to 4" do
16
- expect(config.radius).to eq(4)
17
- end
18
-
19
- it "has color defaulting to nil" do
20
- expect(config.color).to be_nil
21
- end
22
-
23
- it "has sr_color_name defaulting to nil" do
24
- expect(config.sr_color_name).to be_nil
25
- end
26
- end
27
-
28
- describe "with attributes" do
29
- let(:attributes) { {color: "#FF0000", sr_color_name: "Red", weight: 2, radius: 5} }
30
-
31
- it "sets the passed-in attributes" do
32
- expect(config.color).to eq("#FF0000")
33
- expect(config.sr_color_name).to eq("Red")
34
- expect(config.weight).to eq(2)
35
- expect(config.radius).to eq(5)
36
- end
37
- end
38
-
39
- describe "hash-like access []" do
40
- let(:attributes) { {color: "#00FF00", sr_color_name: "Green"} }
41
-
42
- it "supports key lookup with symbols" do
43
- expect(config[:color]).to eq("#00FF00")
44
- expect(config[:weight]).to eq(1)
45
- expect(config[:sr_color_name]).to eq("Green")
46
- end
47
-
48
- it "supports key lookup with strings" do
49
- expect(config["color"]).to eq("#00FF00")
50
- expect(config["weight"]).to eq(1)
51
- expect(config["sr_color_name"]).to eq("Green")
52
- end
53
-
54
- it "returns nil for non-existent attributes" do
55
- expect(config[:foo]).to be_nil
56
- end
57
- end
58
-
59
- describe "#to_h" do
60
- let(:attributes) { {color: "#FFFF00", sr_color_name: "Yellow"} }
61
-
62
- it "returns symbolized attributes hash" do
63
- expect(config.to_h).to eq(
64
- color: "#FFFF00",
65
- weight: 1,
66
- radius: 4,
67
- sr_color_name: "Yellow"
68
- )
69
- end
70
- end
71
- end