blacklight-maps 0.5.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +33 -0
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +103 -0
  5. data/.solr_wrapper.yml +8 -0
  6. data/Gemfile +38 -8
  7. data/README.md +15 -13
  8. data/Rakefile +35 -32
  9. data/app/assets/images/blacklight/maps.svg +1 -0
  10. data/app/assets/javascripts/blacklight-maps/blacklight-maps-browse.js +7 -8
  11. data/app/assets/javascripts/blacklight-maps.js +1 -4
  12. data/app/assets/stylesheets/blacklight_maps/blacklight-maps.scss +1 -2
  13. data/app/assets/stylesheets/blacklight_maps/default.scss +7 -10
  14. data/app/helpers/blacklight/blacklight_maps_helper_behavior.rb +81 -86
  15. data/app/helpers/blacklight_maps_helper.rb +2 -0
  16. data/app/views/catalog/_show_maplet_default.html.erb +8 -9
  17. data/app/views/catalog/map.html.erb +2 -2
  18. data/blacklight-maps.gemspec +27 -26
  19. data/config/locales/blacklight-maps-zh.yml +7 -7
  20. data/config/locales/blacklight-maps.ar.yml +21 -0
  21. data/config/locales/blacklight-maps.de.yml +21 -0
  22. data/config/locales/blacklight-maps.en.yml +1 -1
  23. data/config/locales/blacklight-maps.es.yml +21 -0
  24. data/config/locales/blacklight-maps.fr.yml +8 -8
  25. data/config/locales/blacklight-maps.hu.yml +21 -0
  26. data/config/locales/blacklight-maps.it.yml +8 -8
  27. data/config/locales/blacklight-maps.nl.yml +21 -0
  28. data/config/locales/blacklight-maps.pt-BR.yml +21 -0
  29. data/config/locales/blacklight-maps.sq.yml +21 -0
  30. data/config/routes.rb +3 -2
  31. data/lib/blacklight/maps/controller.rb +27 -0
  32. data/lib/blacklight/maps/engine.rb +15 -14
  33. data/lib/blacklight/maps/export.rb +114 -93
  34. data/lib/blacklight/maps/geometry.rb +30 -18
  35. data/lib/blacklight/maps/maps_search_builder.rb +4 -3
  36. data/lib/blacklight/maps/render_constraints_override.rb +63 -29
  37. data/lib/blacklight/maps/version.rb +3 -1
  38. data/lib/blacklight/maps.rb +8 -2
  39. data/lib/generators/blacklight_maps/install_generator.rb +38 -31
  40. data/lib/generators/blacklight_maps/templates/search_history_controller.rb +2 -0
  41. data/lib/railties/blacklight_maps.rake +10 -7
  42. data/spec/controllers/catalog_controller_spec.rb +20 -10
  43. data/spec/fixtures/sample_solr_documents.yml +909 -906
  44. data/spec/helpers/blacklight_maps_helper_spec.rb +60 -108
  45. data/spec/lib/blacklight/maps/export_spec.rb +109 -143
  46. data/spec/lib/blacklight/maps/geometry_spec.rb +34 -21
  47. data/spec/lib/blacklight/maps/maps_search_builder_spec.rb +17 -21
  48. data/spec/lib/blacklight/maps/render_constraints_override_spec.rb +42 -69
  49. data/spec/spec_helper.rb +18 -21
  50. data/spec/system/index_view_spec.rb +128 -0
  51. data/spec/system/initial_view_spec.rb +28 -0
  52. data/spec/system/map_view_spec.rb +50 -0
  53. data/spec/system/show_view_maplet_spec.rb +78 -0
  54. data/spec/test_app_templates/lib/generators/test_app_generator.rb +6 -21
  55. data/vendor/assets/images/layers-2x.png +0 -0
  56. data/vendor/assets/images/layers.png +0 -0
  57. data/vendor/assets/images/marker-icon-2x.png +0 -0
  58. data/vendor/assets/images/marker-icon.png +0 -0
  59. data/vendor/assets/images/marker-shadow.png +0 -0
  60. data/vendor/assets/javascripts/leaflet.js.erb +13922 -0
  61. data/vendor/assets/javascripts/leaflet.markercluster.js +3 -0
  62. data/vendor/assets/stylesheets/MarkerCluster.Default.css +60 -0
  63. data/vendor/assets/stylesheets/MarkerCluster.css +14 -0
  64. data/vendor/assets/stylesheets/leaflet.css +635 -0
  65. metadata +85 -90
  66. data/.travis.yml +0 -25
  67. data/config/jetty.yml +0 -7
  68. data/lib/blacklight/maps/controller_override.rb +0 -20
  69. data/lib/generators/blacklight_maps/templates/saved_searches_controller.rb +0 -5
  70. data/spec/features/initial_view_spec.rb +0 -21
  71. data/spec/features/maps_spec.rb +0 -202
  72. data/spec/features/show_view_maplet_spec.rb +0 -93
  73. data/spec/test_app_templates/Gemfile.extra +0 -5
  74. /data/{solr_conf → lib/generators/blacklight_maps/templates/solr}/conf/schema.xml +0 -0
  75. /data/{solr_conf → lib/generators/blacklight_maps/templates/solr}/conf/solrconfig.xml +0 -0
@@ -1,101 +1,96 @@
1
- module Blacklight::BlacklightMapsHelperBehavior
1
+ # frozen_string_literal: true
2
2
 
3
- # @param [String] id the html id
4
- # @param [Hash] tag_options options to put on the tag
5
- def blacklight_map_tag id, tag_options = {}, &block
6
- default_data = {
7
- maxzoom: blacklight_config.view.maps.maxzoom,
8
- tileurl: blacklight_config.view.maps.tileurl,
9
- mapattribution: blacklight_config.view.maps.mapattribution
10
- }
11
-
12
- options = {id: id, data: default_data}.deep_merge(tag_options)
13
- if block_given?
14
- content_tag(:div, options, &block)
15
- else
16
- tag(:div, options)
3
+ module Blacklight
4
+ module BlacklightMapsHelperBehavior
5
+ # @param id [String] the html element id
6
+ # @param tag_options [Hash] options to put on the tag
7
+ def blacklight_map_tag(id, tag_options = {}, &block)
8
+ maps_config = blacklight_config.view.maps
9
+ default_data = {
10
+ maxzoom: maps_config.maxzoom,
11
+ tileurl: maps_config.tileurl,
12
+ mapattribution: maps_config.mapattribution
13
+ }
14
+ options = { id: id, data: default_data }.deep_merge(tag_options)
15
+ block_given? ? content_tag(:div, options, &block) : tag.div(**options)
17
16
  end
18
- end
19
17
 
20
- # return the placename value to be used as a link
21
- def placename_value(geojson_hash)
22
- geojson_hash[:properties][blacklight_config.view.maps.placename_property.to_sym]
23
- end
24
-
25
- # create a link to a bbox spatial search
26
- def link_to_bbox_search bbox_coordinates
27
- coords_for_search = bbox_coordinates.map { |v| v.to_s }
28
- link_to(t('blacklight.maps.interactions.bbox_search'),
29
- search_catalog_path(spatial_search_type: "bbox",
30
- coordinates: "[#{coords_for_search[1]},#{coords_for_search[0]} TO #{coords_for_search[3]},#{coords_for_search[2]}]",
31
- view: default_document_index_view_type))
32
- end
33
-
34
- # create a link to a location name facet value
35
- def link_to_placename_field field_value, field, displayvalue = nil
36
- if params[:f] && params[:f][field] && params[:f][field].include?(field_value)
37
- new_params = params
38
- else
39
- new_params = search_state.add_facet_params(field, field_value)
18
+ # return the placename value to be used as a link
19
+ # @param geojson_hash [Hash]
20
+ def placename_value(geojson_hash)
21
+ geojson_hash[:properties][blacklight_config.view.maps.placename_property.to_sym]
40
22
  end
41
- new_params[:view] = default_document_index_view_type
42
- link_to(displayvalue.presence || field_value,
43
- search_catalog_path(new_params.except(:id, :spatial_search_type, :coordinates)))
44
- end
45
23
 
46
- # create a link to a spatial search for a set of point coordinates
47
- def link_to_point_search point_coordinates
48
- new_params = params.except(:controller, :action, :view, :id, :spatial_search_type, :coordinates)
49
- new_params[:spatial_search_type] = "point"
50
- new_params[:coordinates] = "#{point_coordinates[1]},#{point_coordinates[0]}"
51
- new_params[:view] = default_document_index_view_type
52
- link_to(t('blacklight.maps.interactions.point_search'), search_catalog_path(new_params))
53
- end
24
+ # create a link to a bbox spatial search
25
+ # @param bbox [Array]
26
+ def link_to_bbox_search(bbox)
27
+ bbox_coords = bbox.map(&:to_s)
28
+ bbox_search_coords = "[#{bbox_coords[1]},#{bbox_coords[0]} TO #{bbox_coords[3]},#{bbox_coords[2]}]"
29
+ link_to(t('blacklight.maps.interactions.bbox_search'),
30
+ search_catalog_path(spatial_search_type: 'bbox',
31
+ coordinates: bbox_search_coords,
32
+ view: default_document_index_view_type))
33
+ end
54
34
 
55
- # return the facet field containing geographic data
56
- def map_facet_field
57
- blacklight_config.view.maps.facet_mode == "coordinates" ?
58
- blacklight_config.view.maps.coordinates_facet_field :
59
- blacklight_config.view.maps.geojson_field
60
- end
35
+ # create a link to a location name facet value
36
+ # @param field_value [String] Solr field value
37
+ # @param field [String] Solr field name
38
+ # @param display_value [String] value to display instead of field_value
39
+ def link_to_placename_field(field_value, field, display_value = nil)
40
+ new_params = if params[:f] && params[:f][field]&.include?(field_value)
41
+ search_state.params
42
+ else
43
+ search_state.add_facet_params(field, field_value)
44
+ end
45
+ new_params[:view] = default_document_index_view_type
46
+ new_params.except!(:id, :spatial_search_type, :coordinates, :controller, :action)
47
+ link_to(display_value.presence || field_value, search_catalog_path(new_params))
48
+ end
61
49
 
62
- # return an array of Blacklight::SolrResponse::Facets::FacetItem items
63
- def map_facet_values
64
- if @response.aggregations[map_facet_field]
65
- @response.aggregations[map_facet_field].items
66
- else
67
- []
50
+ # create a link to a spatial search for a set of point coordinates
51
+ # @param point_coords [Array]
52
+ def link_to_point_search(point_coords)
53
+ new_params = params.except(:controller, :action, :view, :id, :spatial_search_type, :coordinates)
54
+ new_params[:spatial_search_type] = 'point'
55
+ new_params[:coordinates] = "#{point_coords[1]},#{point_coords[0]}"
56
+ new_params[:view] = default_document_index_view_type
57
+ new_params.permit!
58
+ link_to(t('blacklight.maps.interactions.point_search'), search_catalog_path(new_params))
68
59
  end
69
- end
70
60
 
71
- # render the location name for the Leaflet popup
72
- # separate from BlacklightMapsHelperBehavior#placename_value so
73
- # location name display can be easily customized
74
- def render_placename_heading(geojson_hash)
75
- geojson_hash[:properties][blacklight_config.view.maps.placename_property.to_sym]
76
- end
61
+ # render the location name for the Leaflet popup
62
+ # @param geojson_hash [Hash]
63
+ def render_placename_heading(geojson_hash)
64
+ geojson_hash[:properties][blacklight_config.view.maps.placename_property.to_sym]
65
+ end
77
66
 
78
- # render the map for #index and #map views
79
- def render_index_mapview
80
- render :partial => 'catalog/index_mapview',
81
- :locals => {:geojson_features => serialize_geojson(map_facet_values)}
82
- end
67
+ # render the map for #index and #map views
68
+ def render_index_mapview
69
+ maps_config = blacklight_config.view.maps
70
+ map_facet_field = if maps_config.facet_mode == 'coordinates'
71
+ maps_config.coordinates_facet_field
72
+ else
73
+ maps_config.geojson_field
74
+ end
75
+ map_facet_values = @response.aggregations[map_facet_field]&.items || []
76
+ render partial: 'catalog/index_mapview',
77
+ locals: { geojson_features: serialize_geojson(map_facet_values) }
78
+ end
83
79
 
84
- # determine the type of spatial search to use based on coordinates (bbox or point)
85
- def render_spatial_search_link coordinates
86
- if coordinates.length == 4
87
- link_to_bbox_search(coordinates)
88
- else
89
- link_to_point_search(coordinates)
80
+ # determine the type of spatial search to use based on coordinates (bbox or point)
81
+ # @param coords [Array]
82
+ def render_spatial_search_link(coords)
83
+ coords.length == 4 ? link_to_bbox_search(coords) : link_to_point_search(coords)
90
84
  end
91
- end
92
85
 
93
- # pass the document or facet values to BlacklightMaps::GeojsonExport
94
- def serialize_geojson(documents, options={})
95
- export = BlacklightMaps::GeojsonExport.new(controller,
96
- controller.action_name,
97
- documents,
98
- options)
99
- export.to_geojson
86
+ # pass the document or facet values to BlacklightMaps::GeojsonExport
87
+ # @param documents [Array || SolrDocument]
88
+ def serialize_geojson(documents, options = {})
89
+ export = BlacklightMaps::GeojsonExport.new(controller,
90
+ action_name.to_sym,
91
+ documents,
92
+ options)
93
+ export.to_geojson
94
+ end
100
95
  end
101
96
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module BlacklightMapsHelper
2
4
  include Blacklight::BlacklightMapsHelperBehavior
3
5
  end
@@ -1,10 +1,9 @@
1
1
  <% # map for catalog#show view %>
2
- <div id="blacklight-show-map-container">
3
- <% if @document[blacklight_config.view.maps.geojson_field.to_sym] || @document[blacklight_config.view.maps.coordinates_field.to_sym] %>
4
- <% geojson_features = serialize_geojson(@document) %>
5
- <%= blacklight_map_tag('blacklight-show-map',
6
- {data:{initialzoom:blacklight_config.view.maps.show_initial_zoom,
7
- singlemarkermode:false}}) %>
8
- <%= javascript_tag "$('#blacklight-show-map').blacklight_leaflet_map(#{geojson_features});" %>
9
- <% end %>
10
- </div>
2
+ <% if @document[blacklight_config.view.maps.geojson_field.to_sym] || @document[blacklight_config.view.maps.coordinates_field.to_sym] %>
3
+ <div id="blacklight-show-map-container">
4
+ <%= blacklight_map_tag('blacklight-show-map',
5
+ {data:{initialzoom:blacklight_config.view.maps.show_initial_zoom,
6
+ singlemarkermode:false}}) %>
7
+ <%= javascript_tag "$('#blacklight-show-map').blacklight_leaflet_map(#{serialize_geojson(@document)});" %>
8
+ </div>
9
+ <% end %>
@@ -1,8 +1,8 @@
1
1
  <div id="content" class="col-md-12 col-sm-12">
2
2
  <h1><%= t('blacklight.maps.title') %></h1>
3
- <div id="map_leader_text"><%= t('blacklight.maps.leader') %></div>
3
+ <div id="map_leader_text"><%= t('blacklight.maps.leader_html') %></div>
4
4
  <%= render 'search_results' %>
5
5
  </div>
6
6
 
7
7
  <%# have to put this at the end so it overrides 'catalog/search_results' %>
8
- <% @page_title = t('blacklight.maps.title', :application_name => application_name) %>
8
+ <% @page_title = t('blacklight.maps.title', application_name: application_name) %>
@@ -1,33 +1,34 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'blacklight/maps/version'
5
6
 
6
- Gem::Specification.new do |spec|
7
- spec.name = "blacklight-maps"
8
- spec.version = Blacklight::Maps::VERSION
9
- spec.authors = ["Chris Beer", "Jack Reed", "Eben English"]
10
- spec.email = ["cabeer@stanford.edu", "pjreed@stanford.edu", "eenglish@bpl.org"]
11
- spec.summary = %q{Maps for Blacklight}
12
- spec.homepage = "https://github.com/projectblacklight/blacklight-maps"
13
- spec.license = "Apache-2.0"
7
+ Gem::Specification.new do |s|
8
+ s.name = 'blacklight-maps'
9
+ s.version = Blacklight::Maps::VERSION
10
+ s.authors = ['Chris Beer', 'Jack Reed', 'Eben English']
11
+ s.email = %w[cabeer@stanford.edu pjreed@stanford.edu eenglish@bpl.org]
12
+ s.summary = 'Maps for Blacklight'
13
+ s.description = 'Blacklight plugin providing map views for records with geographic data.'
14
+ s.homepage = 'https://github.com/projectblacklight/blacklight-maps'
15
+ s.license = 'Apache-2.0'
14
16
 
15
- spec.files = `git ls-files -z`.split("\x0")
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
17
+ s.files = `git ls-files -z`.split("\x0")
18
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
+ s.bindir = 'exe'
20
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ s.require_paths = ['lib']
19
22
 
20
- spec.add_dependency "rails", "< 6"
21
- spec.add_dependency "blacklight", ">= 6.1.0", "< 7.0.0"
22
- spec.add_dependency "bootstrap-sass", "~> 3.2"
23
- spec.add_dependency "leaflet-rails", "0.7.7"
24
- spec.add_dependency "leaflet-markercluster-rails"
23
+ s.add_dependency 'blacklight', '>= 7.35.0', '< 8'
24
+ s.add_dependency 'rails', '>= 7.1', '< 8'
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.5"
27
- spec.add_development_dependency "rake"
28
- spec.add_development_dependency "rspec-rails", "~> 3.0"
29
- spec.add_development_dependency "jettywrapper"
30
- spec.add_development_dependency "engine_cart", "~> 0.4.0"
31
- spec.add_development_dependency "capybara"
32
- spec.add_development_dependency "poltergeist", ">= 1.5.0"
26
+ s.add_development_dependency 'capybara'
27
+ s.add_development_dependency 'engine_cart', '~> 2.6'
28
+ s.add_development_dependency 'rspec-rails', '~> 7.1'
29
+ s.add_development_dependency 'rubocop', '~> 1.72.2'
30
+ s.add_development_dependency 'rubocop-rspec', '~> 3.4'
31
+ s.add_development_dependency "rubocop-rails", '~> 2.30'
32
+ s.add_development_dependency 'selenium-webdriver', '~> 4.0'
33
+ s.add_development_dependency 'solr_wrapper', '~> 4.1'
33
34
  end
@@ -3,18 +3,18 @@ zh:
3
3
 
4
4
  maps:
5
5
  interactions:
6
- bbox_search: 'View items that intersect with this bounding box'
7
- placename_search: 'View items from this location'
6
+ bbox_search: '查看与此边界框相交的项目'
7
+ placename_search: '查看此位置的物品'
8
8
  item: '资料'
9
- point_search: 'View items from this location'
10
- search_ctrl_cue: 'Search for all items within the current map window'
9
+ point_search: '查看此位置的物品'
10
+ search_ctrl_cue: '在当前地图窗口中搜索所有项目'
11
11
  title: '地图'
12
- leader: 'Click on a marker to search for items from that location.'
12
+ leader: '单击标记以从该位置搜索项目,或使用 &#128269; 按钮搜索当前地图窗口中的所有项目。'
13
13
 
14
14
  search:
15
15
  filters:
16
16
  coordinates:
17
- bbox: 'Bounding Box'
18
- point: 'Coordinates'
17
+ bbox: '边界框'
18
+ point: '座标'
19
19
  view:
20
20
  maps: '地图'
@@ -0,0 +1,21 @@
1
+ ar:
2
+ blacklight:
3
+
4
+ maps:
5
+ interactions:
6
+ bbox_search: 'عرض العناصر التي تتقاطع مع هذا المربع المحيط'
7
+ placename_search: 'عرض العناصر من هذا الموقع'
8
+ item: 'مادة'
9
+ point_search: 'عرض العناصر من هذا الموقع'
10
+ search_ctrl_cue: 'ابحث عن جميع العناصر داخل نافذة الخريطة الحالية'
11
+ title: 'خريطة'
12
+ leader_html: "انقر فوق علامة للبحث عن عناصر من هذا الموقع ، أو استخدم الزر للبحث عن جميع العناصر الموجودة في نافذة الخريطة الحالية."
13
+
14
+ search:
15
+ filters:
16
+ coordinates:
17
+ bbox: 'المربع المحيط'
18
+ point: 'إحداثيات'
19
+ view:
20
+ maps: 'خريطة'
21
+
@@ -0,0 +1,21 @@
1
+ de:
2
+ blacklight:
3
+
4
+ maps:
5
+ interactions:
6
+ bbox_search: 'Zeigen Sie Elemente an, die sich mit diesem Begrenzungsrahmen überschneiden'
7
+ placename_search: 'Zeigen Sie Elemente von diesem Speicherort aus an'
8
+ item: 'Artikel'
9
+ point_search: 'Zeigen Sie Elemente von diesem Speicherort aus an'
10
+ search_ctrl_cue: 'Suchen Sie nach allen Elementen im aktuellen Kartenfenster'
11
+ title: 'Karte'
12
+ leader_html: "Klicken Sie auf eine Markierung, um nach Elementen von diesem Ort aus zu suchen, oder verwenden Sie die &#128269; Schaltfläche, um nach allen Elementen im aktuellen Kartenfenster zu suchen."
13
+
14
+ search:
15
+ filters:
16
+ coordinates:
17
+ bbox: 'Begrenzungsrahmen'
18
+ point: 'Koordinaten'
19
+ view:
20
+ maps: 'Karte'
21
+
@@ -9,7 +9,7 @@ en:
9
9
  point_search: 'View items from this location'
10
10
  search_ctrl_cue: 'Search for all items within the current map window'
11
11
  title: 'Map'
12
- leader: 'Click on a marker to search for items from that location.'
12
+ leader_html: "Click on a marker to search for items from that location, or use the &#128269; button to search for all items within the current map window."
13
13
 
14
14
  search:
15
15
  filters:
@@ -0,0 +1,21 @@
1
+ es:
2
+ blacklight:
3
+
4
+ maps:
5
+ interactions:
6
+ bbox_search: 'Ver elementos que se cruzan con este cuadro delimitador'
7
+ placename_search: 'Ver elementos desde esta ubicación'
8
+ item: 'articulo'
9
+ point_search: 'Ver elementos desde esta ubicación'
10
+ search_ctrl_cue: 'Buscar todos los elementos dentro de la ventana del mapa actual'
11
+ title: 'Mapa'
12
+ leader_html: "Haga clic en un marcador para buscar elementos desde esa ubicación, o use el &#128269; botón para buscar todos los elementos dentro de la ventana del mapa actual."
13
+
14
+ search:
15
+ filters:
16
+ coordinates:
17
+ bbox: 'Cuadro delimitador'
18
+ point: 'Coordenadas'
19
+ view:
20
+ maps: 'Mapa'
21
+
@@ -3,18 +3,18 @@ fr:
3
3
 
4
4
  maps:
5
5
  interactions:
6
- bbox_search: 'View items that intersect with this bounding box'
7
- placename_search: 'View items from this location'
8
- item: 'item'
9
- point_search: 'View items from this location'
10
- search_ctrl_cue: 'Search for all items within the current map window'
6
+ bbox_search: 'Afficher les éléments qui coupent avec ce cadre de sélection'
7
+ placename_search: 'Afficher les éléments de cet emplacement'
8
+ item: 'article'
9
+ point_search: 'Afficher les éléments de cet emplacement'
10
+ search_ctrl_cue: 'Rechercher tous les éléments dans la fenêtre de carte actuelle'
11
11
  title: 'Carte'
12
- leader: 'Click on a marker to search for items from that location.'
12
+ leader: 'Cliquez sur un marqueur pour rechercher des éléments à partir de cet emplacement, ou utilisez le &#128269; pour rechercher tous les éléments dans la fenêtre de carte actuelle.'
13
13
 
14
14
  search:
15
15
  filters:
16
16
  coordinates:
17
- bbox: 'Bounding Box'
18
- point: 'Coordinates'
17
+ bbox: 'Boîte de délimitation'
18
+ point: 'Coordonnés'
19
19
  view:
20
20
  maps: 'Carte'
@@ -0,0 +1,21 @@
1
+ hu:
2
+ blacklight:
3
+
4
+ maps:
5
+ interactions:
6
+ bbox_search: 'Tekintse meg azokat az elemeket, amelyek keresztezik ezt a határolódobozt'
7
+ placename_search: 'Tekintse meg az ezen a helyen található elemeket'
8
+ item: 'tétel'
9
+ point_search: 'Tekintse meg az ezen a helyen található elemeket'
10
+ search_ctrl_cue: 'Az összes elem keresése az aktuális térkép ablakban'
11
+ title: 'Térkép'
12
+ leader_html: "Kattintson a jelölőre az adott helyről elemek kereséséhez, vagy használja a &#128269; gombot az összes elem kereséséhez az aktuális térkép ablakban."
13
+
14
+ search:
15
+ filters:
16
+ coordinates:
17
+ bbox: 'Határoló doboz'
18
+ point: 'Koordináták'
19
+ view:
20
+ maps: 'Térkép'
21
+
@@ -3,18 +3,18 @@ it:
3
3
 
4
4
  maps:
5
5
  interactions:
6
- bbox_search: 'View items that intersect with this bounding box'
7
- placename_search: 'View items from this location'
8
- item: 'item'
9
- point_search: 'View items from this location'
10
- search_ctrl_cue: 'Search for all items within the current map window'
6
+ bbox_search: 'Visualizza gli elementi che si intersecano con questo rettangolo di selezione'
7
+ placename_search: 'Visualizza articoli da questa posizione'
8
+ item: 'articolo'
9
+ point_search: 'Visualizza articoli da questa posizione'
10
+ search_ctrl_cue: 'Cerca tutti gli elementi nella finestra della mappa corrente'
11
11
  title: 'Mappa'
12
- leader: 'Click on a marker to search for items from that location.'
12
+ leader: 'Fai clic su un marcatore per cercare elementi da quella posizione oppure usa &#128269; per cercare tutti gli elementi nella finestra della mappa corrente.'
13
13
 
14
14
  search:
15
15
  filters:
16
16
  coordinates:
17
- bbox: 'Bounding Box'
18
- point: 'Coordinates'
17
+ bbox: 'Rettangolo di selezione'
18
+ point: 'Coordinate'
19
19
  view:
20
20
  maps: 'Mappa'
@@ -0,0 +1,21 @@
1
+ nl:
2
+ blacklight:
3
+
4
+ maps:
5
+ interactions:
6
+ bbox_search: 'Bekijk items die kruisen met dit selectiekader'
7
+ placename_search: 'Bekijk items van deze locatie'
8
+ item: 'item'
9
+ point_search: 'Bekijk items van deze locatie'
10
+ search_ctrl_cue: 'Zoek naar alle items in het huidige kaartvenster'
11
+ title: 'Kaart'
12
+ leader_html: "Klik op een markering om naar items op die locatie te zoeken of gebruik de &#128269; knop om te zoeken naar alle items in het huidige kaartvenster."
13
+
14
+ search:
15
+ filters:
16
+ coordinates:
17
+ bbox: 'Begrenzende doos'
18
+ point: 'Coördinaten'
19
+ view:
20
+ maps: 'Kaart'
21
+
@@ -0,0 +1,21 @@
1
+ pt-BR:
2
+ blacklight:
3
+
4
+ maps:
5
+ interactions:
6
+ bbox_search: 'Exibir itens que se cruzam com esta caixa delimitadora'
7
+ placename_search: 'Ver itens deste local'
8
+ item: 'item'
9
+ point_search: 'Ver itens deste local'
10
+ search_ctrl_cue: 'Pesquise todos os itens na janela atual do mapa'
11
+ title: 'Mapa'
12
+ leader_html: "Clique em um marcador para procurar itens desse local ou use o &#128269; para procurar todos os itens na janela atual do mapa."
13
+
14
+ search:
15
+ filters:
16
+ coordinates:
17
+ bbox: 'Caixa delimitadora'
18
+ point: 'Coordenadas'
19
+ view:
20
+ maps: 'Mapa'
21
+
@@ -0,0 +1,21 @@
1
+ sq:
2
+ blacklight:
3
+
4
+ maps:
5
+ interactions:
6
+ bbox_search: 'Shikoni artikujt që kryqëzohen me këtë kuti kufizuese'
7
+ placename_search: 'Shikoni artikujt nga ky vendndodhje'
8
+ item: 'artikull'
9
+ point_search: 'Shikoni artikujt nga ky vendndodhje'
10
+ search_ctrl_cue: 'Kërkoni për të gjithë artikujt brenda dritares aktuale të hartës'
11
+ title: 'Hartë'
12
+ leader_html: "Klikoni në një shënues për të kërkuar artikuj nga ai vend, ose përdorni &#128269; butoni për të kërkuar të gjitha artikujt brenda dritares aktuale të hartës."
13
+
14
+ search:
15
+ filters:
16
+ coordinates:
17
+ bbox: 'Kuti kufizuese'
18
+ point: 'Koordinon'
19
+ view:
20
+ maps: 'Hartë'
21
+
data/config/routes.rb CHANGED
@@ -1,4 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.routes.draw do
2
- get 'map', :to => 'catalog#map', :as => 'map'
4
+ get 'map', to: 'catalog#map', as: 'map'
3
5
  end
4
-
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlacklightMaps
4
+ module Controller
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ helper BlacklightMaps::RenderConstraintsOverride
9
+ end
10
+
11
+ def map
12
+ (@response, @document_list) = search_service.search_results
13
+ params[:view] = 'maps'
14
+ respond_to do |format|
15
+ format.html
16
+ end
17
+ end
18
+
19
+ ##
20
+ # BlacklightMaps override: update to look for spatial query params
21
+ # Check if any search parameters have been set
22
+ # @return [Boolean]
23
+ def has_search_parameters?
24
+ params[:coordinates].present? || super
25
+ end
26
+ end
27
+ end
@@ -1,30 +1,31 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'blacklight'
2
- require 'leaflet-rails'
3
- require 'leaflet-markercluster-rails'
4
4
 
5
5
  module Blacklight
6
6
  module Maps
7
7
  class Engine < Rails::Engine
8
-
9
8
  # Set some default configurations
10
- initializer 'blacklight-maps.default_config' do |app|
11
- Blacklight::Configuration.default_values[:view].maps.geojson_field = "geojson"
12
- Blacklight::Configuration.default_values[:view].maps.placename_property = "placename"
13
- Blacklight::Configuration.default_values[:view].maps.coordinates_field = "coordinates"
14
- Blacklight::Configuration.default_values[:view].maps.search_mode = "placename" # or 'coordinates'
9
+ initializer 'blacklight-maps.default_config' do |_app|
10
+ Blacklight::Configuration.default_values[:view].maps.geojson_field = 'geojson_ssim'
11
+ Blacklight::Configuration.default_values[:view].maps.placename_property = 'placename'
12
+ Blacklight::Configuration.default_values[:view].maps.coordinates_field = 'coordinates_srpt'
13
+ Blacklight::Configuration.default_values[:view].maps.search_mode = 'placename' # or 'coordinates'
15
14
  Blacklight::Configuration.default_values[:view].maps.spatial_query_dist = 0.5
16
- Blacklight::Configuration.default_values[:view].maps.placename_field = "placename_field"
17
- Blacklight::Configuration.default_values[:view].maps.coordinates_facet_field = "coordinates_facet_field"
18
- Blacklight::Configuration.default_values[:view].maps.facet_mode = "geojson" # or 'coordinates'
19
- Blacklight::Configuration.default_values[:view].maps.tileurl = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
15
+ Blacklight::Configuration.default_values[:view].maps.placename_field = 'subject_geo_ssim'
16
+ Blacklight::Configuration.default_values[:view].maps.coordinates_facet_field = 'coordinates_ssim'
17
+ Blacklight::Configuration.default_values[:view].maps.facet_mode = 'geojson' # or 'coordinates'
18
+ Blacklight::Configuration.default_values[:view].maps.tileurl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
20
19
  Blacklight::Configuration.default_values[:view].maps.mapattribution = 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
21
20
  Blacklight::Configuration.default_values[:view].maps.maxzoom = 18
22
21
  Blacklight::Configuration.default_values[:view].maps.show_initial_zoom = 5
23
22
  end
24
23
 
25
24
  # Add our helpers
26
- initializer 'blacklight-maps.helpers' do |app|
27
- ActionView::Base.send :include, BlacklightMapsHelper
25
+ initializer 'blacklight-maps.helpers' do |_app|
26
+ config.after_initialize do
27
+ ActionView::Base.include BlacklightMapsHelper
28
+ end
28
29
  end
29
30
 
30
31
  # This makes our rake tasks visible.