geoblacklight 2.4.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +142 -0
  3. data/.gitignore +8 -0
  4. data/.rubocop.yml +24 -23
  5. data/.rubocop_todo.yml +398 -12
  6. data/README.md +3 -3
  7. data/Rakefile +13 -4
  8. data/app/assets/images/favicon.ico +0 -0
  9. data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +1 -1
  10. data/app/assets/javascripts/geoblacklight/geoblacklight.js +18 -1
  11. data/app/assets/javascripts/geoblacklight/modules/bookmarks.js +43 -0
  12. data/app/assets/javascripts/geoblacklight/modules/metadata_download_button.js +6 -1
  13. data/app/assets/javascripts/geoblacklight/modules/results.js +7 -8
  14. data/app/assets/javascripts/geoblacklight/modules/svg_tooltips.js +31 -0
  15. data/app/assets/javascripts/geoblacklight/modules/util.js +5 -0
  16. data/app/assets/javascripts/geoblacklight/viewers/esri.js +3 -3
  17. data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +1 -1
  18. data/app/assets/javascripts/geoblacklight/viewers/index_map.js +1 -1
  19. data/app/assets/javascripts/geoblacklight/viewers/map.js +12 -2
  20. data/app/assets/javascripts/geoblacklight/viewers/tms.js +10 -0
  21. data/app/assets/javascripts/geoblacklight/viewers/wms.js +3 -3
  22. data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +2 -0
  23. data/app/assets/stylesheets/geoblacklight/modules/_base.scss +33 -0
  24. data/app/assets/stylesheets/geoblacklight/{_blacklight_overrides.scss → modules/_blacklight_overrides.scss} +1 -1
  25. data/app/assets/stylesheets/geoblacklight/{_styles.scss → modules/_styles.scss} +1 -0
  26. data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +37 -54
  27. data/app/assets/stylesheets/geoblacklight/modules/item.scss +1 -0
  28. data/app/assets/stylesheets/geoblacklight/modules/results.scss +17 -29
  29. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +12 -42
  30. data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +17 -59
  31. data/app/controllers/download_controller.rb +12 -12
  32. data/app/controllers/relation_controller.rb +1 -0
  33. data/app/controllers/wms_controller.rb +1 -0
  34. data/app/helpers/arcgis_helper.rb +1 -0
  35. data/app/helpers/blacklight_helper.rb +1 -0
  36. data/app/helpers/carto_helper.rb +1 -0
  37. data/app/helpers/geoblacklight_helper.rb +37 -72
  38. data/app/models/concerns/geoblacklight/solr_document.rb +15 -19
  39. data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +2 -1
  40. data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -13
  41. data/app/models/concerns/geoblacklight/solr_document/citation.rb +1 -0
  42. data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
  43. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +2 -1
  44. data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +6 -4
  45. data/app/presenters/geoblacklight/document_presenter.rb +2 -1
  46. data/app/views/catalog/_arcgis.html.erb +4 -0
  47. data/app/views/catalog/_carto.html.erb +4 -0
  48. data/app/views/catalog/_document_split.html.erb +1 -1
  49. data/app/views/catalog/_downloads_primary.html.erb +8 -1
  50. data/app/views/catalog/_header_icons.html.erb +3 -3
  51. data/app/views/catalog/_home_text.html.erb +3 -0
  52. data/app/views/catalog/_index_split_default.html.erb +21 -21
  53. data/app/views/catalog/_show_default_viewer_container.html.erb +1 -1
  54. data/app/views/download/hgl.html.erb +13 -11
  55. data/app/views/relation/_ancestors.html.erb +3 -6
  56. data/app/views/relation/_descendants.html.erb +4 -7
  57. data/app/views/relation/index.html.erb +20 -8
  58. data/app/views/relation/index.json.jbuilder +2 -1
  59. data/app/views/shared/_header_navbar.html.erb +0 -2
  60. data/babel.config.json +4 -0
  61. data/bin/coverage.rb +36 -0
  62. data/config/initializers/new_gbl_settings_defaults_3_3.yml +10 -0
  63. data/config/initializers/rails_config.rb +5 -0
  64. data/config/locales/geoblacklight.en.yml +7 -2
  65. data/geoblacklight.gemspec +7 -9
  66. data/jest.config.js +25 -0
  67. data/lib/generators/geoblacklight/assets_generator.rb +46 -0
  68. data/lib/generators/geoblacklight/install_generator.rb +4 -10
  69. data/lib/generators/geoblacklight/templates/assets/_blacklight.scss +1 -0
  70. data/lib/generators/geoblacklight/templates/assets/_customizations.scss +28 -0
  71. data/{app/assets/stylesheets/geoblacklight/application.scss → lib/generators/geoblacklight/templates/assets/_geoblacklight.scss} +0 -1
  72. data/lib/generators/geoblacklight/templates/assets/application.scss +7 -0
  73. data/lib/generators/geoblacklight/templates/{geoblacklight.js → assets/geoblacklight.js} +0 -0
  74. data/lib/generators/geoblacklight/templates/catalog_controller.rb +5 -3
  75. data/lib/generators/geoblacklight/templates/settings.yml +20 -17
  76. data/lib/generators/geoblacklight/webpacker_generator.rb +1 -0
  77. data/lib/geoblacklight.rb +2 -2
  78. data/lib/geoblacklight/bounding_box.rb +2 -1
  79. data/lib/geoblacklight/catalog_helper_override.rb +1 -0
  80. data/lib/geoblacklight/constants.rb +2 -0
  81. data/lib/geoblacklight/download.rb +2 -1
  82. data/lib/geoblacklight/download/geojson_download.rb +1 -0
  83. data/lib/geoblacklight/download/geotiff_download.rb +1 -0
  84. data/lib/geoblacklight/download/hgl_download.rb +1 -0
  85. data/lib/geoblacklight/download/kmz_download.rb +3 -2
  86. data/lib/geoblacklight/download/shapefile_download.rb +1 -0
  87. data/lib/geoblacklight/engine.rb +2 -2
  88. data/lib/geoblacklight/exceptions.rb +1 -0
  89. data/lib/geoblacklight/geoblacklight_helper_behavior.rb +1 -0
  90. data/lib/geoblacklight/geometry.rb +70 -0
  91. data/lib/geoblacklight/item_viewer.rb +6 -1
  92. data/lib/geoblacklight/metadata.rb +1 -0
  93. data/lib/geoblacklight/metadata/base.rb +2 -7
  94. data/lib/geoblacklight/metadata/fgdc.rb +1 -0
  95. data/lib/geoblacklight/metadata/html.rb +2 -2
  96. data/lib/geoblacklight/metadata/iso19139.rb +1 -0
  97. data/lib/geoblacklight/metadata_transformer.rb +1 -0
  98. data/lib/geoblacklight/metadata_transformer/base.rb +1 -0
  99. data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
  100. data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
  101. data/lib/geoblacklight/reference.rb +1 -0
  102. data/lib/geoblacklight/references.rb +7 -3
  103. data/lib/geoblacklight/relation/ancestors.rb +3 -2
  104. data/lib/geoblacklight/relation/descendants.rb +2 -1
  105. data/lib/geoblacklight/relation/relation_response.rb +2 -1
  106. data/lib/geoblacklight/routes.rb +1 -0
  107. data/lib/geoblacklight/routes/downloadable.rb +1 -0
  108. data/lib/geoblacklight/routes/exportable.rb +1 -0
  109. data/lib/geoblacklight/routes/wms.rb +1 -0
  110. data/lib/geoblacklight/version.rb +2 -1
  111. data/lib/geoblacklight/view_helper_override.rb +1 -0
  112. data/lib/geoblacklight/wms_layer.rb +2 -4
  113. data/lib/geoblacklight/wms_layer/feature_info_response.rb +1 -0
  114. data/lib/tasks/geoblacklight.rake +38 -32
  115. data/package.json +17 -1
  116. data/setupJest.js +14 -0
  117. data/solr/conf/schema.xml +1 -3
  118. data/spec/config/initializers/rails_config_spec.rb +14 -0
  119. data/spec/controllers/catalog_controller_spec.rb +7 -6
  120. data/spec/controllers/download_controller_spec.rb +1 -0
  121. data/spec/controllers/relation_controller_spec.rb +1 -0
  122. data/spec/controllers/wms_controller_spec.rb +1 -0
  123. data/spec/factories/user.rb +1 -0
  124. data/spec/features/bookmarks_spec.rb +1 -0
  125. data/spec/features/configurable_basemap_spec.rb +1 -0
  126. data/spec/features/data_dictionary_download_spec.rb +1 -0
  127. data/spec/features/download_layer_spec.rb +2 -1
  128. data/spec/features/empty_search_spec.rb +1 -0
  129. data/spec/features/esri_viewer_spec.rb +1 -5
  130. data/spec/features/exports_spec.rb +4 -12
  131. data/spec/features/help_text_spec.rb +1 -0
  132. data/spec/features/home_page_spec.rb +6 -0
  133. data/spec/features/iiif_viewer_spec.rb +1 -0
  134. data/spec/features/index_map_spec.rb +1 -0
  135. data/spec/features/layer_inspection_spec.rb +1 -0
  136. data/spec/features/layer_opacity_spec.rb +1 -0
  137. data/spec/features/layer_preview_spec.rb +1 -0
  138. data/spec/features/layer_with_no_references_spec.rb +1 -0
  139. data/spec/features/linkified_attribute_table_spec.rb +1 -0
  140. data/spec/features/metadata_panel_spec.rb +1 -0
  141. data/spec/features/missing_metadata_spec.rb +1 -0
  142. data/spec/features/multiple_downloads_spec.rb +15 -0
  143. data/spec/features/oembed_spec.rb +1 -0
  144. data/spec/features/relations_spec.rb +10 -29
  145. data/spec/features/saved_searches_spec.rb +1 -0
  146. data/spec/features/search_bar_spec.rb +1 -0
  147. data/spec/features/search_results_map_spec.rb +1 -6
  148. data/spec/features/search_results_overlap_ratio_spec.rb +6 -5
  149. data/spec/features/search_spec.rb +1 -0
  150. data/spec/features/show_page_metadata_spec.rb +1 -0
  151. data/spec/features/sms_spec.rb +1 -0
  152. data/spec/features/split_view.html.erb_spec.rb +3 -2
  153. data/spec/features/suppressed_records_spec.rb +1 -0
  154. data/spec/features/tms_spec.rb +10 -0
  155. data/spec/features/web_services_modal_spec.rb +1 -0
  156. data/spec/fixtures/solr_documents/multiple-downloads.json +30 -0
  157. data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
  158. data/spec/fixtures/solr_documents/tms.json +29 -0
  159. data/spec/helpers/arcgis_helper_spec.rb +1 -0
  160. data/spec/helpers/carto_helper_spec.rb +1 -0
  161. data/spec/helpers/geoblacklight_helper_spec.rb +73 -14
  162. data/spec/javascripts/geoblacklight_spec.js +0 -6
  163. data/spec/javascripts/metadata_download_button_spec.js +5 -3
  164. data/spec/javascripts/util_spec.js +2 -4
  165. data/spec/lib/geoblacklight/bounding_box_spec.rb +1 -0
  166. data/spec/lib/geoblacklight/document_presenter_spec.rb +3 -2
  167. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -0
  168. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -0
  169. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -0
  170. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +3 -2
  171. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -0
  172. data/spec/lib/geoblacklight/download_spec.rb +3 -2
  173. data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
  174. data/spec/lib/geoblacklight/geometry_spec.rb +48 -0
  175. data/spec/lib/geoblacklight/item_viewer_spec.rb +13 -0
  176. data/spec/lib/geoblacklight/metadata/base_spec.rb +1 -0
  177. data/spec/lib/geoblacklight/metadata/html_spec.rb +1 -0
  178. data/spec/lib/geoblacklight/metadata_spec.rb +1 -0
  179. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +3 -2
  180. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +3 -2
  181. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +3 -2
  182. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +4 -3
  183. data/spec/lib/geoblacklight/reference_spec.rb +1 -0
  184. data/spec/lib/geoblacklight/references_spec.rb +3 -4
  185. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +2 -1
  186. data/spec/lib/geoblacklight/relation/descendants_spec.rb +2 -1
  187. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +1 -0
  188. data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
  189. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +5 -4
  190. data/spec/lib/geoblacklight/wms_layer_spec.rb +1 -0
  191. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +1 -20
  192. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +1 -0
  193. data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +1 -0
  194. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +1 -0
  195. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +1 -0
  196. data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +15 -2
  197. data/spec/routing/catalog_routing_spec.rb +1 -0
  198. data/spec/spec_helper.rb +12 -9
  199. data/spec/support/backport_test_helpers.rb +1 -0
  200. data/spec/support/features.rb +1 -0
  201. data/spec/support/features/session_helpers.rb +1 -0
  202. data/spec/support/fixtures.rb +1 -0
  203. data/spec/tasks/geoblacklight_spec.rb +4 -3
  204. data/spec/test_app_templates/Gemfile.extra +1 -0
  205. data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -8
  206. data/spec/views/catalog/_document_split.html.erb_spec.rb +2 -1
  207. data/spec/views/catalog/_index_split.html.erb_spec.rb +2 -1
  208. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -0
  209. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -0
  210. data/spec/views/catalog/_show_tools.html.erb_spec.rb +3 -5
  211. data/template.rb +4 -2
  212. metadata +74 -78
  213. data/.circleci/config.yml +0 -164
  214. data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +0 -36
  215. data/app/assets/stylesheets/geoblacklight/modules/relations.scss +0 -15
  216. data/app/views/catalog/_exports.html.erb +0 -3
  217. data/app/views/catalog/_show_tools.html.erb +0 -25
  218. data/lib/generators/geoblacklight/templates/geoblacklight.scss +0 -4
  219. data/spec/javascripts/spec_helper.js +0 -32
  220. data/spec/lib/geoblacklight/controller_override_spec.rb +0 -1
  221. data/spec/teaspoon_env.rb +0 -213
  222. data/vendor/assets/javascripts/readmore.js +0 -0
  223. data/vendor/assets/javascripts/readmore.min.js +0 -0
@@ -0,0 +1,10 @@
1
+ # New GeoBlacklight v3.3 Solr field mappings
2
+ FIELDS:
3
+ :IDENTIFIER: 'dc_identifier_s'
4
+ :LANGUAGE: 'dc_language_s'
5
+ :LAYER_MODIFIED: 'layer_modified_dt'
6
+ :OVERLAP_FIELD: 'solr_bboxtype'
7
+ :SOURCE: 'dc_source_sm'
8
+ :SUPPRESSED: 'suppressed_b'
9
+ :TYPE: 'dc_type_s'
10
+ :UNIQUE_KEY: 'layer_slug_s'
@@ -1,3 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  Config.setup do |config|
2
3
  config.const_name = 'Settings'
3
4
  end
5
+
6
+ # GeoBlacklight v3.3 - New Settings.FIELDS values
7
+ Settings.prepend_source!(File.expand_path('new_gbl_settings_defaults_3_3.yml', __dir__))
8
+ Settings.reload!
@@ -29,6 +29,7 @@ en:
29
29
  data_type: 'Data type'
30
30
  placename: 'Placename'
31
31
  subject: 'Subject'
32
+ version: 'GeoBlacklight version %{version}'
32
33
  tools:
33
34
  login_to_view: 'Login to View and Download'
34
35
  open_carto: 'Open in Carto'
@@ -63,12 +64,13 @@ en:
63
64
  data_dictionary: 'Documentation'
64
65
  services: 'Web services'
65
66
  services_close: 'Close'
67
+ tms: 'Tile Map Service'
66
68
  relations:
67
69
  ancestor: 'Source Datasets'
68
- descendant: 'Derived Datasets (%{count})'
70
+ descendant: 'Derived Datasets'
69
71
  browse_all: "Browse all %{count} records..."
70
- title: 'Data Relations'
71
72
  metadata:
73
+ toggle_summary: 'Toggle summary'
72
74
  view_metadata: 'View Metadata'
73
75
  more_details: 'More details at'
74
76
  metadata_error: 'The metadata view for selected schema is not available'
@@ -103,6 +105,9 @@ en:
103
105
  tiled_map_layer:
104
106
  title: ArcGIS Tiled Map Layer
105
107
  content: An ArcGIS Tiled Map Layer Service displays set of web-accessible tiles that reside on a server.
108
+ tms:
109
+ title: Tile Map Service
110
+ content: A Tile Map Service displays georeferenced map tiles as an image on a map.
106
111
  wms:
107
112
  title: Web Map Service (WMS)
108
113
  content: A Web Map Service displays a geospatial dataset as map images.
@@ -19,31 +19,29 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
  spec.required_rubygems_version = '>= 2.5.2'
21
21
 
22
- spec.add_dependency 'rails', '~> 5.0'
22
+ spec.add_dependency 'rails', '>= 5.2.4', '< 6.2'
23
23
  spec.add_dependency 'blacklight', '~> 7.0'
24
- spec.add_dependency 'font-awesome-rails'
25
24
  spec.add_dependency 'config'
26
25
  spec.add_dependency 'faraday', '~> 1.0'
27
26
  spec.add_dependency 'faraday_middleware', '~> 1.0.0.rc1'
28
27
  spec.add_dependency 'coderay'
29
- spec.add_dependency 'geoblacklight-icons', '>= 0.2'
30
28
  spec.add_dependency 'deprecation'
31
29
  spec.add_dependency 'geo_combine', '~> 0.4'
32
30
  spec.add_dependency 'mime-types'
33
31
  spec.add_dependency 'handlebars_assets'
34
- spec.add_dependency 'webpacker'
32
+ spec.add_dependency 'rgeo-geojson'
35
33
 
36
34
  spec.add_development_dependency 'solr_wrapper'
37
35
  spec.add_development_dependency 'rails-controller-testing'
38
- spec.add_development_dependency 'rspec-rails', '~> 3.1'
36
+ spec.add_development_dependency 'rspec-rails'
39
37
  spec.add_development_dependency 'engine_cart', '~> 2.0'
40
38
  spec.add_development_dependency 'capybara', '>= 2.5.0'
41
39
  spec.add_development_dependency 'webdrivers'
42
40
  spec.add_development_dependency 'factory_bot_rails'
43
41
  spec.add_development_dependency 'database_cleaner', '~> 1.3'
44
- spec.add_development_dependency 'bixby'
45
- spec.add_development_dependency 'coveralls'
46
- spec.add_development_dependency 'simplecov', '~> 0.16'
42
+ spec.add_development_dependency 'simplecov', '~> 0.17.1'
47
43
  spec.add_development_dependency 'foreman'
48
- spec.add_development_dependency 'teaspoon'
44
+ spec.add_development_dependency 'rubocop', '~> 1.10'
45
+ spec.add_development_dependency 'rubocop-rails', '~> 2.9'
46
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.2'
49
47
  end
data/jest.config.js ADDED
@@ -0,0 +1,25 @@
1
+ const util = require('util');
2
+ const exec = util.promisify(require('child_process').exec);
3
+
4
+ module.exports = async () => {
5
+ console.log('Getting asset pipeline lookup path from Rails');
6
+ const { stdout, stderr } = await exec('bundle exec rake geoblacklight:asset_paths');
7
+ if (stderr) {
8
+ console.error(stderr);
9
+ }
10
+ const paths = stdout.trim().split('\n');
11
+ return {
12
+ moduleDirectories: [
13
+ 'node_modules',
14
+ 'spec/javascripts',
15
+ ...paths,
16
+ ],
17
+ rootDir: './',
18
+ setupFilesAfterEnv: [
19
+ '<rootDir>/setupJest.js',
20
+ ],
21
+ testMatch: [
22
+ '<rootDir>/spec/javascripts/**/*_spec.js',
23
+ ],
24
+ };
25
+ };
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators'
4
+
5
+ module Geoblacklight
6
+ class AssetsGenerator < Rails::Generators::Base
7
+ source_root File.expand_path('templates', __dir__)
8
+
9
+ desc <<-DESCRIPTION
10
+ This generator makes the following changes to your application:
11
+ 1. Copies GBL javascript into the application
12
+ 2. Removes stock Rails and Blacklight stylesheets from the application
13
+ 3. Copies GBL stylesheets into the local application
14
+ 4. Sets asset initializer values into the local application
15
+ DESCRIPTION
16
+
17
+ def add_javascript
18
+ copy_file 'assets/geoblacklight.js', 'app/assets/javascripts/geoblacklight.js'
19
+
20
+ if Rails.version.to_i == 6
21
+ append_to_file 'app/assets/javascripts/application.js',
22
+ "\n// Required by GeoBlacklight\n//= require geoblacklight"
23
+ end
24
+ end
25
+
26
+ def remove_stylesheets
27
+ remove_file 'app/assets/stylesheets/application.css'
28
+ remove_file 'app/assets/stylesheets/blacklight.scss'
29
+ end
30
+
31
+ def add_stylesheets
32
+ copy_file 'assets/application.scss', 'app/assets/stylesheets/application.scss'
33
+ copy_file 'assets/_blacklight.scss', 'app/assets/stylesheets/_blacklight.scss'
34
+ copy_file 'assets/_customizations.scss', 'app/assets/stylesheets/_customizations.scss'
35
+ copy_file 'assets/_geoblacklight.scss', 'app/assets/stylesheets/_geoblacklight.scss'
36
+ end
37
+
38
+ def add_initializers
39
+ append_to_file 'config/initializers/assets.rb',
40
+ "\nRails.application.config.assets.precompile += %w( favicon.ico )\n"
41
+
42
+ append_to_file 'config/initializers/assets.rb',
43
+ "\nRails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'images')\n"
44
+ end
45
+ end
46
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rails/generators'
2
3
 
3
4
  module Geoblacklight
@@ -30,15 +31,8 @@ module Geoblacklight
30
31
  inject_into_file 'config/routes.rb', routes, before: /^end/
31
32
  end
32
33
 
33
- def assets
34
- copy_file 'geoblacklight.scss', 'app/assets/stylesheets/geoblacklight.scss'
35
- copy_file 'geoblacklight.js', 'app/assets/javascripts/geoblacklight.js'
36
-
37
- append_to_file 'config/initializers/assets.rb',
38
- "\nRails.application.config.assets.precompile += %w( favicon.ico )\n"
39
-
40
- append_to_file 'config/initializers/assets.rb',
41
- "\nRails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'images')\n"
34
+ def generate_assets
35
+ generate 'geoblacklight:assets'
42
36
  end
43
37
 
44
38
  def create_blacklight_catalog
@@ -62,7 +56,7 @@ module Geoblacklight
62
56
 
63
57
  def add_unique_key
64
58
  inject_into_file 'app/models/solr_document.rb', after: "# self.unique_key = 'id'" do
65
- "\n self.unique_key = 'layer_slug_s'"
59
+ "\n self.unique_key = Settings.FIELDS.UNIQUE_KEY"
66
60
  end
67
61
  end
68
62
 
@@ -0,0 +1 @@
1
+ @import 'blacklight/blacklight';
@@ -0,0 +1,28 @@
1
+ // Local Application Customizations
2
+
3
+ // Set Header Logo
4
+ $logo-image: image_url('blacklight/logo.svg') !default;
5
+
6
+ .navbar-brand { /* The main logo image for the Blacklight instance */
7
+ @if $logo-image {
8
+ background: transparent $logo-image no-repeat top left;
9
+ }
10
+ }
11
+
12
+ // Optional
13
+ // Override default Bootstrap variables here
14
+
15
+ // Example: Bootstrap Colors
16
+ $blue: #007bff !default;
17
+ $indigo: #6610f2 !default;
18
+ $purple: #6f42c1 !default;
19
+ $pink: #e83e8c !default;
20
+ $red: #dc3545 !default;
21
+ $orange: #fd7e14 !default;
22
+ $yellow: #ffc107 !default;
23
+ $green: #28a745 !default;
24
+ $teal: #20c997 !default;
25
+ $cyan: #17a2b8 !default;
26
+
27
+ // Example: Bootstrap Link color
28
+ $link-color: $blue;
@@ -1,2 +1 @@
1
- @import 'bootstrap';
2
1
  @import 'geoblacklight/geoblacklight';
@@ -0,0 +1,7 @@
1
+ /*
2
+ *= require leaflet-label
3
+ */
4
+ @import 'customizations';
5
+ @import 'bootstrap';
6
+ @import 'blacklight';
7
+ @import 'geoblacklight';
@@ -29,7 +29,7 @@ class CatalogController < ApplicationController
29
29
  #
30
30
  config.default_document_solr_params = {
31
31
  :qt => 'document',
32
- :q => '{!raw f=layer_slug_s v=$id}'
32
+ :q => "{!raw f=#{Settings.FIELDS.UNIQUE_KEY} v=$id}"
33
33
  }
34
34
 
35
35
 
@@ -97,6 +97,7 @@ class CatalogController < ApplicationController
97
97
  config.add_facet_field Settings.FIELDS.RIGHTS, label: 'Access', limit: 8, partial: "icon_facet"
98
98
  config.add_facet_field Settings.FIELDS.GEOM_TYPE, label: 'Data type', limit: 8, partial: "icon_facet"
99
99
  config.add_facet_field Settings.FIELDS.FILE_FORMAT, :label => 'Format', :limit => 8
100
+ config.add_facet_field Settings.FIELDS.SOURCE, show: false
100
101
 
101
102
  # Have BL send all facet field names to Solr, which has been the default
102
103
  # previously. Simply remove these lines if you'd rather use Solr request
@@ -245,8 +246,9 @@ class CatalogController < ApplicationController
245
246
  # Custom tools for GeoBlacklight
246
247
  config.add_show_tools_partial :web_services, if: proc { |_context, _config, options| options[:document] && (Settings.WEBSERVICES_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? }
247
248
  config.add_show_tools_partial :metadata, if: proc { |_context, _config, options| options[:document] && (Settings.METADATA_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? }
248
- config.add_show_tools_partial :exports, partial: 'exports', if: proc { |_context, _config, options| options[:document] }
249
- config.add_show_tools_partial :data_dictionary, partial: 'data_dictionary', if: proc { |_context, _config, options| options[:document] }
249
+ config.add_show_tools_partial :carto, partial: 'carto', if: proc { |_context, _config, options| options[:document] && options[:document].carto_reference.present? }
250
+ config.add_show_tools_partial :arcgis, partial: 'arcgis', if: proc { |_context, _config, options| options[:document] && options[:document].arcgis_urls.present? }
251
+ config.add_show_tools_partial :data_dictionary, partial: 'data_dictionary', if: proc { |_context, _config, options| options[:document] && options[:document].data_dictionary_download.present? }
250
252
 
251
253
  # Configure basemap provider for GeoBlacklight maps (uses https only basemap
252
254
  # providers with open licenses)
@@ -4,12 +4,6 @@ APPLICATION_LOGO_URL: 'http://geoblacklight.org/images/geoblacklight-logo.png'
4
4
  # Carto OneClick Service https://carto.com/engine/open-in-carto/
5
5
  CARTO_ONECLICK_LINK: 'http://oneclick.carto.com/'
6
6
 
7
- # Hide Carto export link
8
- # CARTO_HIDE: true
9
-
10
- # Hide ArcGIS export link
11
- # ARCGIS_HIDE: true
12
-
13
7
  # ArcGIS Online Base URL
14
8
  ARCGIS_BASE_URL: 'https://www.arcgis.com/home/webmap/viewer.html'
15
9
 
@@ -27,24 +21,31 @@ OVERLAP_RATIO_BOOST: '2'
27
21
 
28
22
  # Solr field mappings
29
23
  FIELDS:
24
+ :CREATOR: 'dc_creator_sm'
25
+ :DESCRIPTION: 'dc_description_s'
30
26
  :FILE_FORMAT: 'dc_format_s'
27
+ :GEOM_TYPE: 'layer_geom_type_s'
31
28
  :GEOMETRY: 'solr_geom'
32
- :WXS_IDENTIFIER: 'layer_id_s'
33
- :RIGHTS: 'dc_rights_s'
29
+ :IDENTIFIER: 'dc_identifier_s'
30
+ :ISSUED: 'dct_issued_s'
31
+ :LANGUAGE: 'dc_language_s'
32
+ :LAYER_MODIFIED: 'layer_modified_dt'
33
+ :OVERLAP_FIELD: 'solr_bboxtype'
34
+ :PART_OF: 'dct_isPartOf_sm'
35
+ :PUBLISHER: 'dc_publisher_s'
34
36
  :PROVENANCE: 'dct_provenance_s'
35
- :GEOM_TYPE: 'layer_geom_type_s'
37
+ :REFERENCES: 'dct_references_s'
38
+ :RIGHTS: 'dc_rights_s'
36
39
  :SPATIAL_COVERAGE: 'dct_spatial_sm'
37
40
  :SUBJECT: 'dc_subject_sm'
38
- :REFERENCES: 'dct_references_s'
39
- :YEAR: 'solr_year_i'
40
- :CREATOR: 'dc_creator_sm'
41
- :DESCRIPTION: 'dc_description_s'
42
- :PUBLISHER: 'dc_publisher_s'
43
- :PART_OF: 'dct_isPartOf_sm'
41
+ :SOURCE: 'dc_source_sm'
42
+ :SUPPRESSED: 'suppressed_b'
44
43
  :TEMPORAL: 'dct_temporal_sm'
45
44
  :TITLE: 'dc_title_s'
46
- :SOURCE: 'dc_source_sm'
47
- :ISSUED: 'dct_issued_s'
45
+ :TYPE: 'dc_type_s'
46
+ :UNIQUE_KEY: 'layer_slug_s'
47
+ :WXS_IDENTIFIER: 'layer_id_s'
48
+ :YEAR: 'solr_year_i'
48
49
 
49
50
  # Institution deployed at
50
51
  INSTITUTION: 'Stanford'
@@ -68,6 +69,7 @@ USE_GEOM_FOR_RELATIONS_ICON: false
68
69
  # Web services shown in tool panel
69
70
  WEBSERVICES_SHOWN:
70
71
  - 'wms'
72
+ - 'tms'
71
73
  - 'wfs'
72
74
  - 'iiif'
73
75
  - 'feature_layer'
@@ -128,4 +130,5 @@ HELP_TEXT:
128
130
  - 'index_map'
129
131
  - 'tiled_map_layer'
130
132
  - 'wms'
133
+ - 'tms'
131
134
  - 'oembed'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rails/generators'
2
3
 
3
4
  module Geoblacklight
data/lib/geoblacklight.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'active_support/dependencies'
2
3
  require 'geoblacklight/engine'
3
4
 
@@ -5,9 +6,9 @@ module Geoblacklight
5
6
  require 'geoblacklight/bounding_box'
6
7
  require 'geoblacklight/catalog_helper_override'
7
8
  require 'geoblacklight/constants'
8
- # require 'geoblacklight/controller_override'
9
9
  require 'geoblacklight/exceptions'
10
10
  require 'geoblacklight/geoblacklight_helper_behavior'
11
+ require 'geoblacklight/geometry'
11
12
  require 'geoblacklight/view_helper_override'
12
13
  require 'geoblacklight/item_viewer'
13
14
  require 'geoblacklight/wms_layer'
@@ -35,7 +36,6 @@ module Geoblacklight
35
36
  require 'geoblacklight/relation/relation_response'
36
37
 
37
38
  def self.inject!
38
- # CatalogController.send(:include, Geoblacklight::ControllerOverride)
39
39
  CatalogController.send(:include, Geoblacklight::CatalogHelperOverride)
40
40
  CatalogController.send(:include, Geoblacklight::ViewHelperOverride)
41
41
  CatalogController.send(:helper, Geoblacklight::ViewHelperOverride) unless
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  ##
3
4
  # Transforms and parses a bounding box for various formats
@@ -27,7 +28,7 @@ module Geoblacklight
27
28
  # @param [String] bbox as "W S E N"
28
29
  # @return [Geoblacklight::BoundingBox]
29
30
  def self.from_rectangle(rectangle)
30
- rectangle_array = rectangle.split(' ')
31
+ rectangle_array = rectangle.split
31
32
  message = 'Bounding box should be a string in Solr rectangle syntax e.g."W S E N"'
32
33
  fail Geoblacklight::Exceptions::WrongBoundingBoxFormat, message if rectangle_array.count != 4
33
34
  new(
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module CatalogHelperOverride
3
4
  ##
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  # Module to declare application level constants and lookup hash
3
4
  module Constants
@@ -15,6 +16,7 @@ module Geoblacklight
15
16
  wcs: 'http://www.opengis.net/def/serviceType/ogc/wcs',
16
17
  wfs: 'http://www.opengis.net/def/serviceType/ogc/wfs',
17
18
  wms: 'http://www.opengis.net/def/serviceType/ogc/wms',
19
+ tms: 'https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification',
18
20
  hgl: 'http://schema.org/DownloadAction',
19
21
  feature_layer: 'urn:x-esri:serviceType:ArcGIS#FeatureLayer',
20
22
  tiled_map_layer: 'urn:x-esri:serviceType:ArcGIS#TiledMapLayer',
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  class Download
3
4
  def initialize(document, options = {})
@@ -14,7 +15,7 @@ module Geoblacklight
14
15
  end
15
16
 
16
17
  def self.file_path
17
- Settings.DOWNLOAD_PATH || "#{Rails.root}/tmp/cache/downloads"
18
+ Settings.DOWNLOAD_PATH || Rails.root.join('tmp', 'cache', 'downloads')
18
19
  end
19
20
 
20
21
  def file_path_and_name
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  class GeojsonDownload < Geoblacklight::Download
3
4
  GEOJSON_DOWNLOAD_PARAMS = {
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  class GeotiffDownload < Geoblacklight::Download
3
4
  GEOTIFF_DOWNLOAD_PARAMS = {
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  class HglDownload < Geoblacklight::Download
3
4
  def initialize(document, email, options = {})