geoblacklight 2.4.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +152 -64
  3. data/.rubocop.yml +15 -13
  4. data/.rubocop_todo.yml +66 -10
  5. data/README.md +1 -1
  6. data/Rakefile +1 -0
  7. data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +1 -1
  8. data/app/assets/javascripts/geoblacklight/modules/svg_tooltips.js +31 -0
  9. data/app/assets/javascripts/geoblacklight/viewers/esri.js +2 -2
  10. data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +1 -1
  11. data/app/assets/javascripts/geoblacklight/viewers/wms.js +2 -2
  12. data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +2 -0
  13. data/app/assets/stylesheets/geoblacklight/modules/_base.scss +33 -0
  14. data/app/assets/stylesheets/geoblacklight/{_blacklight_overrides.scss → modules/_blacklight_overrides.scss} +0 -0
  15. data/app/assets/stylesheets/geoblacklight/{_styles.scss → modules/_styles.scss} +1 -0
  16. data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +37 -54
  17. data/app/assets/stylesheets/geoblacklight/modules/item.scss +1 -0
  18. data/app/assets/stylesheets/geoblacklight/modules/results.scss +16 -28
  19. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +12 -42
  20. data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +17 -59
  21. data/app/controllers/download_controller.rb +12 -12
  22. data/app/controllers/relation_controller.rb +1 -0
  23. data/app/controllers/wms_controller.rb +1 -0
  24. data/app/helpers/arcgis_helper.rb +1 -0
  25. data/app/helpers/blacklight_helper.rb +1 -0
  26. data/app/helpers/carto_helper.rb +1 -0
  27. data/app/helpers/geoblacklight_helper.rb +25 -72
  28. data/app/models/concerns/geoblacklight/solr_document.rb +7 -6
  29. data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +2 -1
  30. data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -13
  31. data/app/models/concerns/geoblacklight/solr_document/citation.rb +1 -0
  32. data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
  33. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +2 -1
  34. data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +3 -1
  35. data/app/presenters/geoblacklight/document_presenter.rb +2 -1
  36. data/app/views/catalog/_arcgis.html.erb +4 -0
  37. data/app/views/catalog/_carto.html.erb +4 -0
  38. data/app/views/catalog/_downloads_primary.html.erb +8 -1
  39. data/app/views/catalog/_header_icons.html.erb +3 -3
  40. data/app/views/catalog/_home_text.html.erb +3 -0
  41. data/app/views/catalog/_index_split_default.html.erb +21 -21
  42. data/app/views/relation/_ancestors.html.erb +1 -4
  43. data/app/views/relation/_descendants.html.erb +2 -5
  44. data/app/views/relation/index.html.erb +20 -8
  45. data/app/views/relation/index.json.jbuilder +2 -1
  46. data/app/views/shared/_header_navbar.html.erb +0 -2
  47. data/bin/coverage.rb +36 -0
  48. data/config/initializers/rails_config.rb +1 -0
  49. data/config/locales/geoblacklight.en.yml +3 -2
  50. data/geoblacklight.gemspec +3 -6
  51. data/lib/generators/geoblacklight/assets_generator.rb +46 -0
  52. data/lib/generators/geoblacklight/install_generator.rb +3 -9
  53. data/lib/generators/geoblacklight/templates/assets/_blacklight.scss +1 -0
  54. data/lib/generators/geoblacklight/templates/assets/_customizations.scss +28 -0
  55. data/{app/assets/stylesheets/geoblacklight/application.scss → lib/generators/geoblacklight/templates/assets/_geoblacklight.scss} +0 -1
  56. data/lib/generators/geoblacklight/templates/assets/application.scss +7 -0
  57. data/lib/generators/geoblacklight/templates/{geoblacklight.js → assets/geoblacklight.js} +0 -0
  58. data/lib/generators/geoblacklight/templates/catalog_controller.rb +3 -2
  59. data/lib/generators/geoblacklight/templates/settings.yml +0 -6
  60. data/lib/generators/geoblacklight/webpacker_generator.rb +1 -0
  61. data/lib/geoblacklight.rb +1 -0
  62. data/lib/geoblacklight/bounding_box.rb +1 -0
  63. data/lib/geoblacklight/catalog_helper_override.rb +1 -0
  64. data/lib/geoblacklight/constants.rb +1 -0
  65. data/lib/geoblacklight/download.rb +2 -1
  66. data/lib/geoblacklight/download/geojson_download.rb +1 -0
  67. data/lib/geoblacklight/download/geotiff_download.rb +1 -0
  68. data/lib/geoblacklight/download/hgl_download.rb +1 -0
  69. data/lib/geoblacklight/download/kmz_download.rb +2 -1
  70. data/lib/geoblacklight/download/shapefile_download.rb +1 -0
  71. data/lib/geoblacklight/engine.rb +1 -2
  72. data/lib/geoblacklight/exceptions.rb +1 -0
  73. data/lib/geoblacklight/geoblacklight_helper_behavior.rb +1 -0
  74. data/lib/geoblacklight/item_viewer.rb +1 -0
  75. data/lib/geoblacklight/metadata.rb +1 -0
  76. data/lib/geoblacklight/metadata/base.rb +1 -0
  77. data/lib/geoblacklight/metadata/fgdc.rb +1 -0
  78. data/lib/geoblacklight/metadata/html.rb +2 -2
  79. data/lib/geoblacklight/metadata/iso19139.rb +1 -0
  80. data/lib/geoblacklight/metadata_transformer.rb +1 -0
  81. data/lib/geoblacklight/metadata_transformer/base.rb +1 -0
  82. data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
  83. data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
  84. data/lib/geoblacklight/reference.rb +1 -0
  85. data/lib/geoblacklight/references.rb +7 -3
  86. data/lib/geoblacklight/relation/ancestors.rb +1 -0
  87. data/lib/geoblacklight/relation/descendants.rb +1 -0
  88. data/lib/geoblacklight/relation/relation_response.rb +2 -1
  89. data/lib/geoblacklight/routes.rb +1 -0
  90. data/lib/geoblacklight/routes/downloadable.rb +1 -0
  91. data/lib/geoblacklight/routes/exportable.rb +1 -0
  92. data/lib/geoblacklight/routes/wms.rb +1 -0
  93. data/lib/geoblacklight/version.rb +2 -1
  94. data/lib/geoblacklight/view_helper_override.rb +1 -0
  95. data/lib/geoblacklight/wms_layer.rb +1 -0
  96. data/lib/geoblacklight/wms_layer/feature_info_response.rb +1 -0
  97. data/lib/tasks/geoblacklight.rake +33 -32
  98. data/spec/controllers/catalog_controller_spec.rb +1 -0
  99. data/spec/controllers/download_controller_spec.rb +1 -0
  100. data/spec/controllers/relation_controller_spec.rb +1 -0
  101. data/spec/controllers/wms_controller_spec.rb +1 -0
  102. data/spec/factories/user.rb +1 -0
  103. data/spec/features/bookmarks_spec.rb +1 -0
  104. data/spec/features/configurable_basemap_spec.rb +1 -0
  105. data/spec/features/data_dictionary_download_spec.rb +1 -0
  106. data/spec/features/download_layer_spec.rb +1 -0
  107. data/spec/features/empty_search_spec.rb +1 -0
  108. data/spec/features/esri_viewer_spec.rb +1 -5
  109. data/spec/features/exports_spec.rb +4 -12
  110. data/spec/features/help_text_spec.rb +1 -0
  111. data/spec/features/home_page_spec.rb +6 -0
  112. data/spec/features/iiif_viewer_spec.rb +1 -0
  113. data/spec/features/index_map_spec.rb +1 -0
  114. data/spec/features/layer_inspection_spec.rb +1 -0
  115. data/spec/features/layer_opacity_spec.rb +1 -0
  116. data/spec/features/layer_preview_spec.rb +1 -0
  117. data/spec/features/layer_with_no_references_spec.rb +1 -0
  118. data/spec/features/linkified_attribute_table_spec.rb +1 -0
  119. data/spec/features/metadata_panel_spec.rb +1 -0
  120. data/spec/features/missing_metadata_spec.rb +1 -0
  121. data/spec/features/multiple_downloads_spec.rb +15 -0
  122. data/spec/features/oembed_spec.rb +1 -0
  123. data/spec/features/relations_spec.rb +10 -29
  124. data/spec/features/saved_searches_spec.rb +1 -0
  125. data/spec/features/search_bar_spec.rb +1 -0
  126. data/spec/features/search_results_map_spec.rb +1 -6
  127. data/spec/features/search_results_overlap_ratio_spec.rb +4 -3
  128. data/spec/features/search_spec.rb +1 -0
  129. data/spec/features/show_page_metadata_spec.rb +1 -0
  130. data/spec/features/sms_spec.rb +1 -0
  131. data/spec/features/split_view.html.erb_spec.rb +2 -1
  132. data/spec/features/suppressed_records_spec.rb +1 -0
  133. data/spec/features/web_services_modal_spec.rb +1 -0
  134. data/spec/fixtures/solr_documents/multiple-downloads.json +30 -0
  135. data/spec/helpers/arcgis_helper_spec.rb +1 -0
  136. data/spec/helpers/carto_helper_spec.rb +1 -0
  137. data/spec/helpers/geoblacklight_helper_spec.rb +47 -14
  138. data/spec/javascripts/geoblacklight/viewers/esri/tiled_map_layer_spec.js +12 -0
  139. data/spec/lib/geoblacklight/bounding_box_spec.rb +1 -0
  140. data/spec/lib/geoblacklight/controller_override_spec.rb +1 -0
  141. data/spec/lib/geoblacklight/document_presenter_spec.rb +3 -2
  142. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -0
  143. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -0
  144. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -0
  145. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +1 -0
  146. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -0
  147. data/spec/lib/geoblacklight/download_spec.rb +2 -1
  148. data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
  149. data/spec/lib/geoblacklight/item_viewer_spec.rb +1 -0
  150. data/spec/lib/geoblacklight/metadata/base_spec.rb +1 -0
  151. data/spec/lib/geoblacklight/metadata/html_spec.rb +1 -0
  152. data/spec/lib/geoblacklight/metadata_spec.rb +1 -0
  153. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +3 -2
  154. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +3 -2
  155. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +3 -2
  156. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +4 -3
  157. data/spec/lib/geoblacklight/reference_spec.rb +1 -0
  158. data/spec/lib/geoblacklight/references_spec.rb +2 -3
  159. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +1 -0
  160. data/spec/lib/geoblacklight/relation/descendants_spec.rb +1 -0
  161. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +1 -0
  162. data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
  163. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +5 -4
  164. data/spec/lib/geoblacklight/wms_layer_spec.rb +1 -0
  165. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +1 -20
  166. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +1 -0
  167. data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +1 -0
  168. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +1 -0
  169. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +1 -0
  170. data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +15 -2
  171. data/spec/routing/catalog_routing_spec.rb +1 -0
  172. data/spec/spec_helper.rb +12 -9
  173. data/spec/support/backport_test_helpers.rb +1 -0
  174. data/spec/support/features.rb +1 -0
  175. data/spec/support/features/session_helpers.rb +1 -0
  176. data/spec/support/fixtures.rb +1 -0
  177. data/spec/tasks/geoblacklight_spec.rb +4 -3
  178. data/spec/teaspoon_env.rb +1 -0
  179. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -0
  180. data/spec/views/catalog/_document_split.html.erb_spec.rb +1 -0
  181. data/spec/views/catalog/_index_split.html.erb_spec.rb +1 -0
  182. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -0
  183. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -0
  184. data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -4
  185. data/template.rb +1 -0
  186. metadata +42 -68
  187. data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +0 -36
  188. data/app/assets/stylesheets/geoblacklight/modules/relations.scss +0 -15
  189. data/app/views/catalog/_exports.html.erb +0 -3
  190. data/app/views/catalog/_show_tools.html.erb +0 -25
  191. data/lib/generators/geoblacklight/templates/geoblacklight.scss +0 -4
  192. data/vendor/assets/javascripts/readmore.js +0 -0
  193. data/vendor/assets/javascripts/readmore.min.js +0 -0
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Metadata
3
4
  class Fgdc < Base
@@ -1,9 +1,9 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Metadata
3
4
  class Html < Base
4
5
  def transform
5
- ActionController::Base.helpers.content_tag(:iframe,
6
- '',
6
+ ActionController::Base.helpers.tag.iframe('',
7
7
  src: @reference.endpoint,
8
8
  scrolling: 'yes',
9
9
  frameborder: 0)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Metadata
3
4
  class Iso19139 < Base
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'geo_combine'
2
3
 
3
4
  module Geoblacklight
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module MetadataTransformer
3
4
  ##
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module MetadataTransformer
3
4
  ##
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module MetadataTransformer
3
4
  ##
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  ##
3
4
  # Parses an array of dct_references to create useful reference information
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  # References is a geoblacklight-schema dct:references parser
3
4
  class References
@@ -43,7 +44,7 @@ module Geoblacklight
43
44
  # Preferred download (should be a file download)
44
45
  # @return [Hash, nil]
45
46
  def preferred_download
46
- return file_download unless download.blank?
47
+ return file_download if download.present?
47
48
  end
48
49
 
49
50
  ##
@@ -100,9 +101,12 @@ module Geoblacklight
100
101
  # present
101
102
  # @return (see #downloads_by_format)
102
103
  def vector_download_formats
103
- { shapefile: wfs.to_hash,
104
+ return unless wms.present? && wfs.present?
105
+ {
106
+ shapefile: wfs.to_hash,
104
107
  kmz: wms.to_hash,
105
- geojson: wfs.to_hash } if wms.present? && wfs.present?
108
+ geojson: wfs.to_hash
109
+ }
106
110
  end
107
111
 
108
112
  ##
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Relation
3
4
  class Ancestors
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Relation
3
4
  class Descendants
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Relation
3
4
  class RelationResponse
@@ -17,7 +18,7 @@ module Geoblacklight
17
18
  end
18
19
 
19
20
  def empty?
20
- !(ancestors['numFound'] > 0 || descendants['numFound'] > 0)
21
+ !(ancestors['numFound'].positive? || descendants['numFound'].positive?)
21
22
  end
22
23
  end
23
24
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Routes
3
4
  require 'geoblacklight/routes/exportable'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Routes
3
4
  class Downloadable
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Routes
3
4
  class Exportable
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module Routes
3
4
  class Wms
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
- VERSION = '2.4.0'.freeze
3
+ VERSION = '3.0.0'
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  module ViewHelperOverride
3
4
  include CatalogHelperOverride
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  class WmsLayer
3
4
  def initialize(params)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Geoblacklight
2
3
  class FeatureInfoResponse
3
4
  def initialize(response)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rails/generators'
2
3
  require 'generators/geoblacklight/install_generator'
3
4
 
@@ -7,15 +8,15 @@ namespace :geoblacklight do
7
8
  require 'solr_wrapper'
8
9
  SolrWrapper.wrap(port: '8983') do |solr|
9
10
  solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path('../../', File.dirname(__FILE__)), 'solr', 'conf')) do
10
- puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
11
- puts "\n^C to stop"
12
- puts ' '
13
- begin
14
- Rake::Task['geoblacklight:solr:seed'].invoke
15
- system "bundle exec rails s #{args[:rails_server_args]}"
16
- rescue Interrupt
17
- puts 'Shutting down...'
18
- end
11
+ puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
12
+ puts "\n^C to stop"
13
+ puts ' '
14
+ begin
15
+ Rake::Task['geoblacklight:solr:seed'].invoke
16
+ system "bundle exec rails s #{args[:rails_server_args]}"
17
+ rescue Interrupt
18
+ puts 'Shutting down...'
19
+ end
19
20
  end
20
21
  end
21
22
  end
@@ -30,7 +31,7 @@ namespace :geoblacklight do
30
31
  puts ' '
31
32
  begin
32
33
  Rake::Task['geoblacklight:solr:seed'].invoke
33
- system "foreman start"
34
+ system 'foreman start'
34
35
  rescue Interrupt
35
36
  puts 'Shutting down...'
36
37
  end
@@ -39,23 +40,23 @@ namespace :geoblacklight do
39
40
  end
40
41
 
41
42
  namespace :index do
42
- desc "Put sample data into solr"
43
+ desc 'Put sample data into solr'
43
44
  task :seed => :environment do
44
45
  docs = Dir['spec/fixtures/solr_documents/*.json'].map { |f| JSON.parse File.read(f) }.flatten
45
46
  Blacklight.default_index.connection.add docs
46
47
  Blacklight.default_index.connection.commit
47
48
  end
48
49
 
49
- desc "Ingests a GeoHydra transformed.json"
50
+ desc 'Ingests a GeoHydra transformed.json'
50
51
  task :ingest_all => :environment do
51
- docs = JSON::parse(File.read("#{Rails.root}/tmp/transformed.json"))
52
+ docs = JSON.parse(File.read(Rails.root.join('tmp', 'transformed.json')))
52
53
  docs.each do |doc|
53
54
  Blacklight.default_index.connection.add doc
54
55
  Blacklight.default_index.connection.commit
55
56
  end
56
57
  end
57
58
 
58
- desc "Ingests a directory of geoblacklight.json files"
59
+ desc 'Ingests a directory of geoblacklight.json files'
59
60
  task :ingest, [:directory] => :environment do |_t, args|
60
61
  args.with_defaults(directory: 'data')
61
62
  Dir.glob(File.join(args[:directory], '**', 'geoblacklight.json')).each do |fn|
@@ -66,7 +67,7 @@ namespace :geoblacklight do
66
67
  puts "Failed to ingest #{fn}: #{e.inspect}"
67
68
  end
68
69
  end
69
- puts "Committing changes to Solr"
70
+ puts 'Committing changes to Solr'
70
71
  Blacklight.default_index.connection.commit
71
72
  end
72
73
  end
@@ -74,33 +75,33 @@ namespace :geoblacklight do
74
75
  namespace :downloads do
75
76
  desc 'Delete all cached downloads'
76
77
  task delete: :environment do
77
- FileUtils.rm_rf Dir.glob("#{Rails.root}/tmp/cache/downloads/*")
78
+ FileUtils.rm_rf Dir.glob(Rails.root.join('tmp', 'cache', 'downloads', '*'))
78
79
  end
79
80
  desc 'Create download directory'
80
81
  task mkdir: :environment do
81
- FileUtils.mkdir_p Rails.root.join('tmp/cache/downloads'), verbose: true
82
+ FileUtils.mkdir_p(Rails.root.join('tmp', 'cache', 'downloads'), verbose: true)
82
83
  end
83
84
  desc 'Precaches a download'
84
- task :precache, [:doc_id, :download_type, :timeout] => [:environment] do |t, args|
85
- begin
86
- fail 'Please supply required arguments [document_id, download_type and timeout]' unless args[:doc_id] && args[:download_type] && args[:timeout]
87
- document = Geoblacklight::SolrDocument.find(args[:doc_id])
88
- fail Blacklight::Exceptions::RecordNotFound if document[:layer_slug_s] != args[:doc_id]
89
- download = "Geoblacklight::#{args[:download_type].capitalize}Download"
90
- .constantize.new(document, timeout: args[:timeout].to_i)
91
- download.get
92
- Rails.logger.info "Successfully downloaded #{download.file_name}"
93
- Rails.logger.info "#{Geoblacklight::ShapefileDownload.file_path}"
94
- rescue Geoblacklight::Exceptions::ExternalDownloadFailed => error
95
- Rails.logger.error error.message + ' ' + error.url
96
- rescue NameError
97
- Rails.logger.error "Could not find that download type \"#{args[:download_type]}\""
85
+ task :precache, [:doc_id, :download_type, :timeout] => [:environment] do |_t, args|
86
+ unless args[:doc_id] && args[:download_type] && args[:timeout]
87
+ fail 'Please supply required arguments [document_id, download_type and timeout]'
98
88
  end
89
+ document = Geoblacklight::SolrDocument.find(args[:doc_id])
90
+ fail Blacklight::Exceptions::RecordNotFound if document[:layer_slug_s] != args[:doc_id]
91
+ download = "Geoblacklight::#{args[:download_type].capitalize}Download"
92
+ .constantize.new(document, timeout: args[:timeout].to_i)
93
+ download.get
94
+ Rails.logger.info "Successfully downloaded #{download.file_name}"
95
+ Rails.logger.info Geoblacklight::ShapefileDownload.file_path.to_s
96
+ rescue Geoblacklight::Exceptions::ExternalDownloadFailed => error
97
+ Rails.logger.error error.message + ' ' + error.url
98
+ rescue NameError
99
+ Rails.logger.error "Could not find that download type \"#{args[:download_type]}\""
99
100
  end
100
101
  end
101
102
 
102
103
  namespace :solr do
103
- desc "Put sample data into solr"
104
+ desc 'Put sample data into solr'
104
105
  task :seed => :environment do
105
106
  Rake::Task['geoblacklight:index:seed'].invoke
106
107
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe CatalogController, type: :controller do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe DownloadController, type: :controller do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe RelationController, type: :controller do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe WmsController, type: :controller do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  FactoryBot.define do
2
3
  factory :user do
3
4
  sequence(:email) { |n| "user#{n}@example.com" }
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Blacklight Bookmarks' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Configurable basemap', js: true do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Data dictionary download tool' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Download layer' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Empty search' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'feature_layer reference', js: true do
@@ -24,11 +25,6 @@ feature 'feature_layer reference', js: true do
24
25
  expect(Nokogiri::HTML.parse(page.body).css('g').length).to eq 23
25
26
  fail
26
27
  end
27
- scenario 'displays image map layer' do
28
- visit solr_document_path '32653ed6-8d83-4692-8a06-bf13ffe2c018'
29
- expect(page).to have_css '.leaflet-control-zoom', visible: true
30
- expect(page).to have_css 'img.leaflet-image-layer', visible: true
31
- end
32
28
  scenario 'displays tiled map layer' do
33
29
  visit solr_document_path 'nyu-test-soil-survey-map'
34
30
  expect(page).to have_css '.leaflet-control-zoom', visible: true
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Export features' do
@@ -5,7 +6,7 @@ feature 'Export features' do
5
6
  feature 'Open in Carto' do
6
7
  scenario 'shows up in tools' do
7
8
  visit solr_document_path 'tufts-cambridgegrid100-04'
8
- expect(page).to have_css 'li.exports a', text: 'Open in Carto'
9
+ expect(page).to have_css 'li.carto a', text: 'Open in Carto'
9
10
  click_link 'Open in Carto'
10
11
  end
11
12
  end
@@ -14,23 +15,14 @@ feature 'Export features' do
14
15
  feature 'Open in ArcGIS Online' do
15
16
  scenario 'shows up in tools' do
16
17
  visit solr_document_path '90f14ff4-1359-4beb-b931-5cb41d20ab90'
17
- expect(page).to have_css 'li.exports a', text: 'Open in ArcGIS Online'
18
+ expect(page).to have_css 'li.arcgis a', text: 'Open in ArcGIS Online'
18
19
  end
19
20
  end
20
21
  end
21
22
  feature 'when restricted or no wfs' do
22
23
  scenario 'is not in tools' do
23
24
  visit solr_document_path 'princeton-02870w62c'
24
- expect(page).not_to have_css 'li.exports a', text: 'Open in Carto'
25
- end
26
- end
27
- context 'when carto is configured not to display' do
28
- before do
29
- allow(Settings).to receive(:CARTO_HIDE).and_return(true)
30
- end
31
- it 'will not display the carto link' do
32
- visit solr_document_path 'tufts-cambridgegrid100-04'
33
- expect(page).not_to have_css 'li.exports a', text: 'Open in Carto'
25
+ expect(page).not_to have_css 'li.carto a', text: 'Open in Carto'
34
26
  end
35
27
  end
36
28
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Help Text' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Home page', js: true do # use js: true for tests which require js, but it slows things down
@@ -37,4 +38,9 @@ feature 'Home page', js: true do # use js: true for tests which require js, but
37
38
  end
38
39
  expect(page).to have_css '#documents'
39
40
  end
41
+ scenario 'can search by placename' do
42
+ click_link 'Minnesota, United States'
43
+ results = page.all(:css, 'article.document')
44
+ expect(results.count).to equal(3)
45
+ end
40
46
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'iiif reference' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Index map' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Layer inspection', js: true do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Layer opacity', js: true do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  feature 'Layer preview', js: true do