geoblacklight 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +21 -6
  3. data/.solr_wrapper +1 -0
  4. data/.standard.yml +1 -0
  5. data/Gemfile +13 -11
  6. data/README.md +1 -1
  7. data/Rakefile +42 -50
  8. data/app/assets/images/blacklight/american-geographical-society-library-uwm-libraries.svg +26 -0
  9. data/app/assets/images/blacklight/arizona.svg +4 -0
  10. data/app/assets/images/blacklight/circle-info-solid.svg +1 -0
  11. data/app/assets/images/blacklight/fire-solid.svg +1 -0
  12. data/app/assets/images/blacklight/lightbulb-solid.svg +1 -0
  13. data/app/assets/images/blacklight/nebraska.svg +4 -0
  14. data/app/assets/images/blacklight/rutgers.svg +5 -0
  15. data/app/assets/images/blacklight/triangle-exclamation-solid.svg +1 -0
  16. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +8 -0
  17. data/app/components/geoblacklight/display_note_component.html.erb +1 -0
  18. data/app/components/geoblacklight/display_note_component.rb +47 -0
  19. data/app/components/geoblacklight/icon_facet_item_component.rb +2 -2
  20. data/app/controllers/download_controller.rb +36 -37
  21. data/app/controllers/relation_controller.rb +1 -0
  22. data/app/controllers/wms_controller.rb +1 -0
  23. data/app/helpers/arcgis_helper.rb +2 -1
  24. data/app/helpers/blacklight_helper.rb +2 -1
  25. data/app/helpers/carto_helper.rb +3 -2
  26. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +2 -1
  27. data/app/helpers/geoblacklight_helper.rb +44 -36
  28. data/app/models/concerns/geoblacklight/bbox_filter_query.rb +1 -1
  29. data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +1 -0
  30. data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -0
  31. data/app/models/concerns/geoblacklight/solr_document/citation.rb +3 -2
  32. data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
  33. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -0
  34. data/app/models/concerns/geoblacklight/solr_document.rb +17 -9
  35. data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +2 -1
  36. data/app/presenters/geoblacklight/document_presenter.rb +3 -2
  37. data/app/views/catalog/_show_default_display_note.html.erb +7 -0
  38. data/app/views/catalog/_show_sidebar.html.erb +1 -0
  39. data/app/views/catalog/_show_sidebar_static_map.html.erb +10 -0
  40. data/app/views/relation/index.json.jbuilder +1 -1
  41. data/config/initializers/new_gbl_settings_defaults_4.1.yml +104 -0
  42. data/config/initializers/rails_config.rb +5 -1
  43. data/config/locales/geoblacklight.en.yml +18 -10
  44. data/geoblacklight.gemspec +36 -40
  45. data/lib/generators/geoblacklight/assets_generator.rb +15 -15
  46. data/lib/generators/geoblacklight/install_generator.rb +24 -23
  47. data/lib/generators/geoblacklight/templates/catalog_controller.rb +66 -71
  48. data/lib/generators/geoblacklight/templates/settings.yml +74 -22
  49. data/lib/geoblacklight/bounding_box.rb +1 -0
  50. data/lib/geoblacklight/constants.rb +26 -25
  51. data/lib/geoblacklight/download/geojson_download.rb +10 -9
  52. data/lib/geoblacklight/download/geotiff_download.rb +6 -5
  53. data/lib/geoblacklight/download/hgl_download.rb +4 -3
  54. data/lib/geoblacklight/download/kmz_download.rb +11 -10
  55. data/lib/geoblacklight/download/shapefile_download.rb +10 -9
  56. data/lib/geoblacklight/download.rb +12 -11
  57. data/lib/geoblacklight/engine.rb +10 -9
  58. data/lib/geoblacklight/exceptions.rb +3 -0
  59. data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +12 -11
  60. data/lib/geoblacklight/geometry.rb +6 -5
  61. data/lib/geoblacklight/item_viewer.rb +4 -3
  62. data/lib/geoblacklight/metadata/base.rb +4 -3
  63. data/lib/geoblacklight/metadata/fgdc.rb +1 -0
  64. data/lib/geoblacklight/metadata/html.rb +5 -4
  65. data/lib/geoblacklight/metadata/iso19139.rb +1 -0
  66. data/lib/geoblacklight/metadata.rb +1 -0
  67. data/lib/geoblacklight/metadata_transformer/base.rb +5 -4
  68. data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
  69. data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
  70. data/lib/geoblacklight/metadata_transformer.rb +6 -2
  71. data/lib/geoblacklight/reference.rb +3 -2
  72. data/lib/geoblacklight/references.rb +11 -6
  73. data/lib/geoblacklight/relation/ancestors.rb +4 -3
  74. data/lib/geoblacklight/relation/descendants.rb +4 -3
  75. data/lib/geoblacklight/relation/relation_response.rb +3 -2
  76. data/lib/geoblacklight/routes/downloadable.rb +3 -2
  77. data/lib/geoblacklight/routes/exportable.rb +4 -3
  78. data/lib/geoblacklight/routes/wms.rb +2 -1
  79. data/lib/geoblacklight/routes.rb +4 -3
  80. data/lib/geoblacklight/version.rb +2 -1
  81. data/lib/geoblacklight/view_helper_override.rb +3 -2
  82. data/lib/geoblacklight/wms_layer/feature_info_response.rb +5 -4
  83. data/lib/geoblacklight/wms_layer.rb +4 -3
  84. data/lib/geoblacklight.rb +32 -31
  85. data/lib/tasks/geoblacklight.rake +45 -44
  86. data/schema/geoblacklight-schema-aardvark.json +6 -0
  87. data/spec/components/geoblacklight/display_note_component_spec.rb +27 -0
  88. data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +11 -10
  89. data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +8 -7
  90. data/spec/config/initializers/rails_config_spec.rb +10 -9
  91. data/spec/controllers/catalog_controller_spec.rb +27 -26
  92. data/spec/controllers/download_controller_spec.rb +50 -49
  93. data/spec/controllers/relation_controller_spec.rb +5 -4
  94. data/spec/controllers/wms_controller_spec.rb +10 -9
  95. data/spec/factories/user.rb +3 -2
  96. data/spec/features/bookmarks_spec.rb +7 -6
  97. data/spec/features/configurable_basemap_spec.rb +12 -11
  98. data/spec/features/data_dictionary_download_spec.rb +11 -10
  99. data/spec/features/download_layer_spec.rb +64 -63
  100. data/spec/features/empty_search_spec.rb +6 -5
  101. data/spec/features/esri_viewer_spec.rb +33 -32
  102. data/spec/features/exports_spec.rb +18 -17
  103. data/spec/features/full_screen_controll_spec.rb +8 -8
  104. data/spec/features/help_text_spec.rb +6 -5
  105. data/spec/features/home_page_spec.rb +30 -29
  106. data/spec/features/iiif_viewer_spec.rb +6 -5
  107. data/spec/features/index_map_spec.rb +17 -16
  108. data/spec/features/layer_inspection_spec.rb +8 -7
  109. data/spec/features/layer_opacity_spec.rb +15 -14
  110. data/spec/features/layer_preview_spec.rb +11 -10
  111. data/spec/features/layer_with_no_references_spec.rb +5 -4
  112. data/spec/features/linkified_attribute_table_spec.rb +8 -7
  113. data/spec/features/metadata_panel_spec.rb +32 -31
  114. data/spec/features/missing_metadata_spec.rb +18 -17
  115. data/spec/features/multiple_downloads_spec.rb +11 -10
  116. data/spec/features/oembed_spec.rb +6 -5
  117. data/spec/features/relations_spec.rb +51 -26
  118. data/spec/features/saved_searches_spec.rb +7 -6
  119. data/spec/features/search_bar_spec.rb +9 -8
  120. data/spec/features/search_results_complex_geometry_spec.rb +12 -11
  121. data/spec/features/search_results_icons_spec.rb +10 -9
  122. data/spec/features/search_results_map_spec.rb +21 -20
  123. data/spec/features/search_results_overlap_ratio_spec.rb +17 -16
  124. data/spec/features/search_spec.rb +19 -18
  125. data/spec/features/show_page_download_spec.rb +15 -14
  126. data/spec/features/show_page_metadata_spec.rb +9 -8
  127. data/spec/features/show_page_sidebar_static_map_spec.rb +21 -0
  128. data/spec/features/sms_spec.rb +12 -11
  129. data/spec/features/split_view.html.erb_spec.rb +56 -55
  130. data/spec/features/suppressed_records_spec.rb +10 -9
  131. data/spec/features/tilejson_spec.rb +9 -8
  132. data/spec/features/tms_spec.rb +6 -5
  133. data/spec/features/web_services_modal_spec.rb +37 -36
  134. data/spec/features/wmts_spec.rb +16 -15
  135. data/spec/features/xyz_spec.rb +6 -5
  136. data/spec/fixtures/solr_documents/actual-papermap1.json +1 -1
  137. data/spec/fixtures/solr_documents/actual-point1.json +1 -1
  138. data/spec/fixtures/solr_documents/actual-polygon1.json +1 -1
  139. data/spec/fixtures/solr_documents/actual-raster1.json +1 -1
  140. data/spec/fixtures/solr_documents/baruch_ancestor1.json +1 -1
  141. data/spec/fixtures/solr_documents/baruch_ancestor2.json +1 -1
  142. data/spec/fixtures/solr_documents/baruch_documentation_download.json +2 -2
  143. data/spec/fixtures/solr_documents/cornell_html_metadata.json +1 -1
  144. data/spec/fixtures/solr_documents/display-note.json +52 -0
  145. data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +1 -1
  146. data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +1 -1
  147. data/spec/fixtures/solr_documents/esri-feature-layer.json +1 -1
  148. data/spec/fixtures/solr_documents/esri-image-map-layer.json +1 -1
  149. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
  150. data/spec/fixtures/solr_documents/esri-wms-layer.json +1 -1
  151. data/spec/fixtures/solr_documents/harvard_raster.json +1 -1
  152. data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +1 -1
  153. data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +1 -1
  154. data/spec/fixtures/solr_documents/index-map-polygon.json +1 -1
  155. data/spec/fixtures/solr_documents/index-map-stanford.json +1 -1
  156. data/spec/fixtures/solr_documents/index_map_point.json +1 -1
  157. data/spec/fixtures/solr_documents/princeton-parent.json +1 -1
  158. data/spec/fixtures/solr_documents/public_direct_download.json +1 -1
  159. data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
  160. data/spec/fixtures/solr_documents/restricted-line.json +1 -1
  161. data/spec/fixtures/solr_documents/tilejson.json +2 -2
  162. data/spec/fixtures/solr_documents/umn_metro_result1.json +2 -2
  163. data/spec/fixtures/solr_documents/umn_state_result1.json +1 -1
  164. data/spec/fixtures/solr_documents/umn_state_result2.json +1 -1
  165. data/spec/fixtures/solr_documents/uva_slug_colon.json +1 -1
  166. data/spec/fixtures/solr_documents/wmts-multiple.json +1 -1
  167. data/spec/fixtures/solr_documents/wmts-single-layer.json +6 -6
  168. data/spec/fixtures/solr_documents/xyz.json +3 -3
  169. data/spec/helpers/arcgis_helper_spec.rb +8 -7
  170. data/spec/helpers/carto_helper_spec.rb +6 -5
  171. data/spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb +10 -15
  172. data/spec/helpers/geoblacklight_helper_spec.rb +139 -138
  173. data/spec/lib/geoblacklight/bounding_box_spec.rb +14 -13
  174. data/spec/lib/geoblacklight/document_presenter_spec.rb +26 -25
  175. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +8 -7
  176. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +8 -7
  177. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +16 -15
  178. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +9 -8
  179. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +8 -7
  180. data/spec/lib/geoblacklight/download_spec.rb +61 -60
  181. data/spec/lib/geoblacklight/geometry_spec.rb +29 -28
  182. data/spec/lib/geoblacklight/item_viewer_spec.rb +25 -24
  183. data/spec/lib/geoblacklight/metadata/base_spec.rb +44 -43
  184. data/spec/lib/geoblacklight/metadata/html_spec.rb +7 -6
  185. data/spec/lib/geoblacklight/metadata_spec.rb +15 -14
  186. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +13 -12
  187. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +8 -7
  188. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +8 -7
  189. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +15 -14
  190. data/spec/lib/geoblacklight/reference_spec.rb +28 -27
  191. data/spec/lib/geoblacklight/references_spec.rb +89 -76
  192. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +17 -16
  193. data/spec/lib/geoblacklight/relation/descendants_spec.rb +17 -16
  194. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +29 -28
  195. data/spec/lib/geoblacklight/view_helper_override_spec.rb +14 -13
  196. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +19 -18
  197. data/spec/lib/geoblacklight/wms_layer_spec.rb +31 -30
  198. data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +31 -31
  199. data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +32 -32
  200. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +16 -15
  201. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +7 -6
  202. data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +16 -17
  203. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +7 -6
  204. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +121 -107
  205. data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +8 -7
  206. data/spec/presenters/geoblacklight/bbox_item_presenter_spec.rb +10 -10
  207. data/spec/routing/catalog_routing_spec.rb +4 -3
  208. data/spec/spec_helper.rb +34 -33
  209. data/spec/support/backport_test_helpers.rb +6 -5
  210. data/spec/support/features/session_helpers.rb +8 -7
  211. data/spec/support/features.rb +2 -1
  212. data/spec/support/fixtures.rb +2 -1
  213. data/spec/tasks/geoblacklight_spec.rb +10 -9
  214. data/spec/test_app_templates/lib/generators/test_app_generator.rb +16 -15
  215. data/spec/views/catalog/_document_split.html.erb_spec.rb +3 -2
  216. data/spec/views/catalog/_index_split.html.erb_spec.rb +3 -2
  217. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +5 -4
  218. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +11 -10
  219. data/spec/views/catalog/_show_tools.html.erb_spec.rb +13 -12
  220. data/template.rb +9 -8
  221. metadata +29 -212
  222. data/.gitmodules +0 -0
  223. data/.rubocop.yml +0 -111
  224. data/.rubocop_todo.yml +0 -437
  225. data/config/initializers/new_gbl_settings_defaults_3_4.yml +0 -6
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Metadata
4
5
  class Iso19139 < Base
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Metadata
4
5
  ##
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module MetadataTransformer
4
5
  ##
@@ -10,7 +11,7 @@ module Geoblacklight
10
11
  def initialize(metadata)
11
12
  @metadata = metadata
12
13
  # Access the Nokogiri::XML Document from the metadata Object
13
- fail EmptyMetadataError, 'Failed to retrieve the metadata' if @metadata.blank?
14
+ fail EmptyMetadataError, "Failed to retrieve the metadata" if @metadata.blank?
14
15
  end
15
16
 
16
17
  ##
@@ -30,11 +31,11 @@ module Geoblacklight
30
31
  # @return [Nokogiri::XML::Document] the Nokogiri XML Document for the cleaned HTML
31
32
  def cleaned_metadata
32
33
  transformed_doc = Nokogiri::XML(@metadata.to_html)
33
- if transformed_doc.xpath('//body').children.empty?
34
+ if transformed_doc.xpath("//body").children.empty?
34
35
  fail TransformError, \
35
- 'Failed to extract the <body> child elements from the transformed metadata'
36
+ "Failed to extract the <body> child elements from the transformed metadata"
36
37
  end
37
- transformed_doc.xpath('//body').children
38
+ transformed_doc.xpath("//body").children
38
39
  rescue => e
39
40
  raise TransformError, e.message
40
41
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module MetadataTransformer
4
5
  ##
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module MetadataTransformer
4
5
  ##
@@ -1,17 +1,21 @@
1
1
  # frozen_string_literal: true
2
- require 'geo_combine'
2
+
3
+ require "geo_combine"
3
4
 
4
5
  module Geoblacklight
5
6
  module MetadataTransformer
6
7
  ##
7
8
  # Exceptions raised for the types of geospatial metadata
8
9
  class TypeError < EncodingError; end
10
+
9
11
  ##
10
12
  # Exceptions raised when parsing geospatial metadata in the XML
11
13
  class ParseError < EncodingError; end
14
+
12
15
  ##
13
16
  # Exception raised when the geospatial metadata content is empty
14
17
  class EmptyMetadataError < ParseError; end
18
+
15
19
  ##
16
20
  # Exceptions raised when transforming the metadata into the HTML
17
21
  class TransformError < EncodingError; end
@@ -21,7 +25,7 @@ module Geoblacklight
21
25
  # @param [Geoblacklight::Metadata::Base] metadata string or File path to the raw metadata
22
26
  # @return [Geoblacklight::MetadataTransformer::BaseTransformer]
23
27
  def self.instance(metadata)
24
- type = metadata.class.name.split('::').last
28
+ type = metadata.class.name.split("::").last
25
29
  begin
26
30
  klass = "Geoblacklight::MetadataTransformer::#{type.capitalize}".constantize
27
31
  rescue
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  ##
4
5
  # Parses an array of dct_references to create useful reference information
@@ -30,7 +31,7 @@ module Geoblacklight
30
31
  # Creates a hash, using its type as key and endpoint as value
31
32
  # @return [Hash]
32
33
  def to_hash
33
- { type => endpoint }
34
+ {type => endpoint}
34
35
  end
35
36
 
36
37
  private
@@ -40,7 +41,7 @@ module Geoblacklight
40
41
  # Remove any trailing slashes
41
42
  # @return [String]
42
43
  def uri
43
- @reference[0].sub(/(\/)+$/, '') if @reference[0].present?
44
+ @reference[0].sub(/(\/)+$/, "") if @reference[0].present?
44
45
  end
45
46
  end
46
47
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  # References is a geoblacklight-schema dct:references parser
4
5
  class References
@@ -52,11 +53,11 @@ module Geoblacklight
52
53
  # @return [Hash, nil]
53
54
  def downloads_by_format
54
55
  case format
55
- when 'Shapefile'
56
+ when "Shapefile"
56
57
  vector_download_formats
57
- when 'GeoTIFF'
58
+ when "GeoTIFF"
58
59
  geotiff_download_formats
59
- when 'ArcGRID'
60
+ when "ArcGRID"
60
61
  arcgrid_download_formats
61
62
  end
62
63
  end
@@ -93,7 +94,7 @@ module Geoblacklight
93
94
  # Download hash for a static file download
94
95
  # @return (see #downloads_by_format)
95
96
  def file_download
96
- { file_download: download.to_hash }
97
+ {file_download: download.to_hash}
97
98
  end
98
99
 
99
100
  ##
@@ -113,14 +114,14 @@ module Geoblacklight
113
114
  # Download hash for a GeoTiff file with a WMS reference present
114
115
  # @return (see #downloads_by_format)
115
116
  def geotiff_download_formats
116
- { geotiff: wms.to_hash } if wms.present?
117
+ {geotiff: wms.to_hash} if wms.present?
117
118
  end
118
119
 
119
120
  ##
120
121
  # Download hash for an ArcGRID file with a WMS reference present
121
122
  # @return (see #downloads_by_format)
122
123
  def arcgrid_download_formats
123
- { geotiff: wms.to_hash } if wms.present?
124
+ {geotiff: wms.to_hash} if wms.present?
124
125
  end
125
126
 
126
127
  ##
@@ -132,5 +133,9 @@ module Geoblacklight
132
133
  super
133
134
  end
134
135
  end
136
+
137
+ def respond_to_missing?(m, *args, &b)
138
+ Geoblacklight::Constants::URI.key?(m) || super
139
+ end
135
140
  end
136
141
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Relation
4
5
  class Ancestors
@@ -9,8 +10,8 @@ module Geoblacklight
9
10
  end
10
11
 
11
12
  def create_search_params
12
- { fq: ["{!join from=#{@field} to=#{Settings.FIELDS.ID}}#{Settings.FIELDS.ID}:#{@search_id}"],
13
- fl: [Settings.FIELDS.TITLE, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE] }
13
+ {fq: ["{!join from=#{@field} to=#{Settings.FIELDS.ID}}#{Settings.FIELDS.ID}:#{@search_id}"],
14
+ fl: [Settings.FIELDS.TITLE, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE]}
14
15
  end
15
16
 
16
17
  def execute_query
@@ -22,7 +23,7 @@ module Geoblacklight
22
23
 
23
24
  def results
24
25
  response = execute_query
25
- response['response']
26
+ response["response"]
26
27
  end
27
28
  end
28
29
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Relation
4
5
  class Descendants
@@ -9,8 +10,8 @@ module Geoblacklight
9
10
  end
10
11
 
11
12
  def create_search_params
12
- { fq: "#{@field}:#{@search_id}",
13
- fl: [Settings.FIELDS.TITLE, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE] }
13
+ {fq: "#{@field}:#{@search_id}",
14
+ fl: [Settings.FIELDS.TITLE, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE]}
14
15
  end
15
16
 
16
17
  def execute_query
@@ -22,7 +23,7 @@ module Geoblacklight
22
23
 
23
24
  def results
24
25
  response = execute_query
25
- response['response']
26
+ response["response"]
26
27
  end
27
28
  end
28
29
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Relation
4
5
  class RelationResponse
@@ -27,9 +28,9 @@ module Geoblacklight
27
28
 
28
29
  def query_type(option)
29
30
  case option.query_type
30
- when 'ancestors'
31
+ when "ancestors"
31
32
  Geoblacklight::Relation::Ancestors
32
- when 'descendants'
33
+ when "descendants"
33
34
  Geoblacklight::Relation::Descendants
34
35
  else
35
36
  fail ArgumentError, "Bad RelationResponse query_type: #{option.query_type}. Only 'ancestors' or 'descendants' is allowed."
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Routes
4
5
  class Downloadable
@@ -7,8 +8,8 @@ module Geoblacklight
7
8
  end
8
9
 
9
10
  def call(mapper, _options = {})
10
- mapper.get 'file/:id', action: 'file', as: :file
11
- mapper.get 'hgl/:id', action: 'hgl', as: :hgl
11
+ mapper.get "file/:id", action: "file", as: :file
12
+ mapper.get "hgl/:id", action: "hgl", as: :hgl
12
13
  end
13
14
  end
14
15
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Routes
4
5
  class Exportable
@@ -8,9 +9,9 @@ module Geoblacklight
8
9
 
9
10
  def call(mapper, _options = {})
10
11
  mapper.member do
11
- mapper.get 'web_services'
12
- mapper.get 'metadata'
13
- mapper.get 'relations' => 'relation#index'
12
+ mapper.get "web_services"
13
+ mapper.get "metadata"
14
+ mapper.get "relations" => "relation#index"
14
15
  end
15
16
  end
16
17
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Routes
4
5
  class Wms
@@ -7,7 +8,7 @@ module Geoblacklight
7
8
  end
8
9
 
9
10
  def call(mapper, _options = {})
10
- mapper.post 'handle'
11
+ mapper.post "handle"
11
12
  end
12
13
  end
13
14
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Routes
4
- require 'geoblacklight/routes/exportable'
5
- require 'geoblacklight/routes/downloadable'
6
- require 'geoblacklight/routes/wms'
5
+ require "geoblacklight/routes/exportable"
6
+ require "geoblacklight/routes/downloadable"
7
+ require "geoblacklight/routes/wms"
7
8
  end
8
9
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
- VERSION = '4.0.0'
4
+ VERSION = "4.1.0"
4
5
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  # Override Blacklight helpers to inject behavior
4
5
  module ViewHelperOverride
@@ -7,9 +8,9 @@ module Geoblacklight
7
8
  end
8
9
 
9
10
  def render_search_to_s_bbox(params)
10
- return ''.html_safe if params['bbox'].blank?
11
+ return "".html_safe if params["bbox"].blank?
11
12
 
12
- render_search_to_s_element(t('geoblacklight.bbox_label'), render_filter_value(params['bbox']))
13
+ render_search_to_s_element(t("geoblacklight.bbox_label"), render_filter_value(params["bbox"]))
13
14
  end
14
15
  end
15
16
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  class FeatureInfoResponse
4
5
  def initialize(response)
@@ -15,11 +16,11 @@ module Geoblacklight
15
16
 
16
17
  def format
17
18
  page = Nokogiri::HTML(@response.body)
18
- table_values = { values: [] }
19
- page.css('th').each do |th|
19
+ table_values = {values: []}
20
+ page.css("th").each do |th|
20
21
  table_values[:values].push([th.text])
21
22
  end
22
- page.css('td').each_with_index do |td, index|
23
+ page.css("td").each_with_index do |td, index|
23
24
  table_values[:values][index].push(td.text) unless index >= table_values[:values].count
24
25
  end
25
26
  table_values
@@ -27,7 +28,7 @@ module Geoblacklight
27
28
 
28
29
  def error?
29
30
  @response[:error] ||
30
- @response.headers['content-type'].slice(0, 9) == 'text/xml'
31
+ @response.headers["content-type"].slice(0, 9) == "text/xml"
31
32
  end
32
33
  end
33
34
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  class WmsLayer
4
5
  def initialize(params)
@@ -7,11 +8,11 @@ module Geoblacklight
7
8
  end
8
9
 
9
10
  def url
10
- @params['URL']
11
+ @params["URL"]
11
12
  end
12
13
 
13
14
  def search_params
14
- @params.except('URL')
15
+ @params.except("URL")
15
16
  end
16
17
 
17
18
  def feature_info
@@ -27,7 +28,7 @@ module Geoblacklight
27
28
  end
28
29
  rescue Faraday::ConnectionFailed, Faraday::TimeoutError => error
29
30
  Geoblacklight.logger.error error.inspect
30
- { error: error.inspect }
31
+ {error: error.inspect}
31
32
  end
32
33
  end
33
34
  end
data/lib/geoblacklight.rb CHANGED
@@ -1,37 +1,38 @@
1
1
  # frozen_string_literal: true
2
- require 'active_support/dependencies'
3
- require 'geoblacklight/engine'
2
+
3
+ require "active_support/dependencies"
4
+ require "geoblacklight/engine"
4
5
 
5
6
  module Geoblacklight
6
- require 'geoblacklight/bounding_box'
7
- require 'geoblacklight/constants'
8
- require 'geoblacklight/exceptions'
9
- require 'geoblacklight/geometry'
10
- require 'geoblacklight/view_helper_override'
11
- require 'geoblacklight/item_viewer'
12
- require 'geoblacklight/wms_layer'
13
- require 'geoblacklight/wms_layer/feature_info_response'
14
- require 'geoblacklight/download'
15
- require 'geoblacklight/download/geojson_download'
16
- require 'geoblacklight/download/geotiff_download'
17
- require 'geoblacklight/download/kmz_download'
18
- require 'geoblacklight/download/shapefile_download'
19
- require 'geoblacklight/download/hgl_download'
20
- require 'geoblacklight/metadata'
21
- require 'geoblacklight/metadata/base'
22
- require 'geoblacklight/metadata/fgdc'
23
- require 'geoblacklight/metadata/html'
24
- require 'geoblacklight/metadata/iso19139'
25
- require 'geoblacklight/metadata_transformer'
26
- require 'geoblacklight/metadata_transformer/base'
27
- require 'geoblacklight/metadata_transformer/fgdc'
28
- require 'geoblacklight/metadata_transformer/iso19139'
29
- require 'geoblacklight/reference'
30
- require 'geoblacklight/references'
31
- require 'geoblacklight/routes'
32
- require 'geoblacklight/relation/descendants'
33
- require 'geoblacklight/relation/ancestors'
34
- require 'geoblacklight/relation/relation_response'
7
+ require "geoblacklight/bounding_box"
8
+ require "geoblacklight/constants"
9
+ require "geoblacklight/exceptions"
10
+ require "geoblacklight/geometry"
11
+ require "geoblacklight/view_helper_override"
12
+ require "geoblacklight/item_viewer"
13
+ require "geoblacklight/wms_layer"
14
+ require "geoblacklight/wms_layer/feature_info_response"
15
+ require "geoblacklight/download"
16
+ require "geoblacklight/download/geojson_download"
17
+ require "geoblacklight/download/geotiff_download"
18
+ require "geoblacklight/download/kmz_download"
19
+ require "geoblacklight/download/shapefile_download"
20
+ require "geoblacklight/download/hgl_download"
21
+ require "geoblacklight/metadata"
22
+ require "geoblacklight/metadata/base"
23
+ require "geoblacklight/metadata/fgdc"
24
+ require "geoblacklight/metadata/html"
25
+ require "geoblacklight/metadata/iso19139"
26
+ require "geoblacklight/metadata_transformer"
27
+ require "geoblacklight/metadata_transformer/base"
28
+ require "geoblacklight/metadata_transformer/fgdc"
29
+ require "geoblacklight/metadata_transformer/iso19139"
30
+ require "geoblacklight/reference"
31
+ require "geoblacklight/references"
32
+ require "geoblacklight/routes"
33
+ require "geoblacklight/relation/descendants"
34
+ require "geoblacklight/relation/ancestors"
35
+ require "geoblacklight/relation/relation_response"
35
36
 
36
37
  def self.logger
37
38
  ::Rails.logger
@@ -1,39 +1,40 @@
1
1
  # frozen_string_literal: true
2
- require 'rails/generators'
3
- require 'generators/geoblacklight/install_generator'
2
+
3
+ require "rails/generators"
4
+ require "generators/geoblacklight/install_generator"
4
5
 
5
6
  namespace :geoblacklight do
6
- desc 'Run Solr and GeoBlacklight for interactive development'
7
+ desc "Run Solr and GeoBlacklight for interactive development"
7
8
  task :server, [:rails_server_args] do |_t, args|
8
- require 'solr_wrapper'
9
- SolrWrapper.wrap(port: '8983') do |solr|
10
- solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path('../../', File.dirname(__FILE__)), 'solr', 'conf')) do
9
+ require "solr_wrapper"
10
+ SolrWrapper.wrap(port: "8983") do |solr|
11
+ solr.with_collection(name: "blacklight-core", dir: File.join(File.expand_path("../../", File.dirname(__FILE__)), "solr", "conf")) do
11
12
  puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
12
13
  puts "\n^C to stop"
13
- puts ' '
14
+ puts " "
14
15
  begin
15
- Rake::Task['geoblacklight:solr:seed'].invoke
16
+ Rake::Task["geoblacklight:solr:seed"].invoke
16
17
  system "bundle exec rails s #{args[:rails_server_args]}"
17
18
  rescue Interrupt
18
- puts 'Shutting down...'
19
+ puts "Shutting down..."
19
20
  end
20
21
  end
21
22
  end
22
23
  end
23
24
 
24
- desc 'Run Solr and GeoBlacklight for interactive development with Webpack enabled'
25
+ desc "Run Solr and GeoBlacklight for interactive development with Webpack enabled"
25
26
  task :webpack do |_t|
26
- require 'solr_wrapper'
27
- SolrWrapper.wrap(port: '8983') do |solr|
28
- solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path('../../', File.dirname(__FILE__)), 'solr', 'conf')) do
27
+ require "solr_wrapper"
28
+ SolrWrapper.wrap(port: "8983") do |solr|
29
+ solr.with_collection(name: "blacklight-core", dir: File.join(File.expand_path("../../", File.dirname(__FILE__)), "solr", "conf")) do
29
30
  puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
30
31
  puts "\n^C to stop"
31
- puts ' '
32
+ puts " "
32
33
  begin
33
- Rake::Task['geoblacklight:solr:seed'].invoke
34
- system 'foreman start'
34
+ Rake::Task["geoblacklight:solr:seed"].invoke
35
+ system "foreman start"
35
36
  rescue Interrupt
36
- puts 'Shutting down...'
37
+ puts "Shutting down..."
37
38
  end
38
39
  end
39
40
  end
@@ -42,41 +43,41 @@ namespace :geoblacklight do
42
43
  # Local fixtures: bundle exec rake "geoblacklight:index:seed"
43
44
  # Remote fixtures: bundle exec rake "geoblacklight:index:seed[:remote]"
44
45
  namespace :index do
45
- desc 'Index GBL test fixture metadata into Solr'
46
+ desc "Index GBL test fixture metadata into Solr"
46
47
  task :seed, [:remote] => :environment do |t, args|
47
48
  docs = []
48
49
 
49
50
  if args.remote
50
- puts 'Indexing - Remote test fixtures'
51
- JSON.load(
52
- URI.open("https://api.github.com/repos/geoblacklight/geoblacklight/contents/spec/fixtures/solr_documents")
51
+ puts "Indexing - Remote test fixtures"
52
+ JSON.parse(
53
+ URI.parse("https://api.github.com/repos/geoblacklight/geoblacklight/contents/spec/fixtures/solr_documents").open.read
53
54
  ).each do |fixture|
54
- if fixture['name'].include?('.json')
55
- docs << JSON.load(URI.open(fixture['download_url']))
55
+ if fixture["name"].include?(".json")
56
+ docs << JSON.parse(URI.parse(fixture["download_url"]).open.read)
56
57
  end
57
58
  end
58
59
  else
59
- puts 'Indexing - Local test fixtures'
60
- docs = Dir['spec/fixtures/solr_documents/*.json'].map { |f| JSON.parse File.read(f) }.flatten
60
+ puts "Indexing - Local test fixtures"
61
+ docs = Dir["spec/fixtures/solr_documents/*.json"].map { |f| JSON.parse File.read(f) }.flatten
61
62
  end
62
63
 
63
64
  Blacklight.default_index.connection.add docs
64
65
  Blacklight.default_index.connection.commit
65
66
  end
66
67
 
67
- desc 'Ingests a GeoHydra transformed.json'
68
- task :ingest_all => :environment do
69
- docs = JSON.parse(File.read(Rails.root.join('tmp', 'transformed.json')))
68
+ desc "Ingests a GeoHydra transformed.json"
69
+ task ingest_all: :environment do
70
+ docs = JSON.parse(File.read(Rails.root.join("tmp", "transformed.json")))
70
71
  docs.each do |doc|
71
72
  Blacklight.default_index.connection.add doc
72
73
  Blacklight.default_index.connection.commit
73
74
  end
74
75
  end
75
76
 
76
- desc 'Ingests a directory of geoblacklight.json files'
77
+ desc "Ingests a directory of geoblacklight.json files"
77
78
  task :ingest, [:directory] => :environment do |_t, args|
78
- args.with_defaults(directory: 'data')
79
- Dir.glob(File.join(args[:directory], '**', 'geoblacklight.json')).each do |fn|
79
+ args.with_defaults(directory: "data")
80
+ Dir.glob(File.join(args[:directory], "**", "geoblacklight.json")).each do |fn|
80
81
  puts "Ingesting #{fn}"
81
82
  begin
82
83
  Blacklight.default_index.connection.add(JSON.parse(File.read(fn)))
@@ -84,47 +85,47 @@ namespace :geoblacklight do
84
85
  puts "Failed to ingest #{fn}: #{e.inspect}"
85
86
  end
86
87
  end
87
- puts 'Committing changes to Solr'
88
+ puts "Committing changes to Solr"
88
89
  Blacklight.default_index.connection.commit
89
90
  end
90
91
  end
91
92
 
92
93
  namespace :downloads do
93
- desc 'Delete all cached downloads'
94
+ desc "Delete all cached downloads"
94
95
  task delete: :environment do
95
- FileUtils.rm_rf Dir.glob(Rails.root.join('tmp', 'cache', 'downloads', '*'))
96
+ FileUtils.rm_rf Dir.glob(Rails.root.join("tmp", "cache", "downloads", "*"))
96
97
  end
97
- desc 'Create download directory'
98
+ desc "Create download directory"
98
99
  task mkdir: :environment do
99
- FileUtils.mkdir_p(Rails.root.join('tmp', 'cache', 'downloads'), verbose: true)
100
+ FileUtils.mkdir_p(Rails.root.join("tmp", "cache", "downloads"), verbose: true)
100
101
  end
101
- desc 'Precaches a download'
102
+ desc "Precaches a download"
102
103
  task :precache, [:doc_id, :download_type, :timeout] => [:environment] do |_t, args|
103
104
  unless args[:doc_id] && args[:download_type] && args[:timeout]
104
- fail 'Please supply required arguments [document_id, download_type and timeout]'
105
+ fail "Please supply required arguments [document_id, download_type and timeout]"
105
106
  end
106
107
  document = Geoblacklight::SolrDocument.find(args[:doc_id])
107
108
  fail Blacklight::Exceptions::RecordNotFound if document[:id] != args[:doc_id]
108
109
  download = "Geoblacklight::#{args[:download_type].capitalize}Download"
109
- .constantize.new(document, timeout: args[:timeout].to_i)
110
+ .constantize.new(document, timeout: args[:timeout].to_i)
110
111
  download.get
111
112
  Rails.logger.info "Successfully downloaded #{download.file_name}"
112
113
  Rails.logger.info Geoblacklight::ShapefileDownload.file_path.to_s
113
114
  rescue Geoblacklight::Exceptions::ExternalDownloadFailed => error
114
- Rails.logger.error error.message + ' ' + error.url
115
+ Rails.logger.error error.message + " " + error.url
115
116
  rescue NameError
116
117
  Rails.logger.error "Could not find that download type \"#{args[:download_type]}\""
117
118
  end
118
119
  end
119
120
 
120
121
  namespace :solr do
121
- desc 'Put sample data into solr'
122
- task :seed => :environment do
123
- Rake::Task['geoblacklight:index:seed'].invoke
122
+ desc "Put sample data into solr"
123
+ task seed: :environment do
124
+ Rake::Task["geoblacklight:index:seed"].invoke
124
125
  end
125
126
  end
126
127
 
127
- desc 'Stdout output asset paths'
128
+ desc "Stdout output asset paths"
128
129
  task application_asset_paths: [:environment] do
129
130
  puts Rails.application.config.assets.paths
130
131
  end
@@ -24,6 +24,12 @@
24
24
  "type": "string"
25
25
  }
26
26
  },
27
+ "gbl_displayNote_sm": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "string"
31
+ }
32
+ },
27
33
  "dct_creator_sm": {
28
34
  "type": "array",
29
35
  "items": {