|
24 | 24 |
|
25 | 25 | <!-- We only care about geospatial locations for this, as place names are also subjects. --> |
26 | 26 | <% if geospatial_coordinates?(result_geo['locations']) %> |
27 | | - <% content_for :additional_meta_tag do %> |
28 | | - <link rel=" stylesheet" href=" https://unpkg.com/[email protected]/dist/leaflet.css" |
29 | | - integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" |
30 | | - crossorigin=""/> |
31 | | - |
32 | | - <!-- Make sure you put this AFTER Leaflet's CSS --> |
33 | | - <script src=" https://unpkg.com/[email protected]/dist/leaflet.js" |
34 | | - integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" |
35 | | - crossorigin=""></script> |
36 | | - <% end %> |
37 | | - <div id=<%= "map_#{result_geo_counter}" %> style="height: 180px"></div> |
38 | | - |
39 | | - <script> |
40 | | - var <%= "map_#{result_geo_counter}" %> = L.map('<%= "map_#{result_geo_counter}" %>'); |
41 | | - |
42 | | - L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { |
43 | | - maxZoom: 19, |
44 | | - attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' |
45 | | - }).addTo(<%= "map_#{result_geo_counter}" %>); |
46 | | - |
47 | | - // define rectangle geographical bounds |
48 | | - // -71.158693, -71.064796, 42.395972, 42.351993 |
49 | | - // var bounds = [[42.395972, -71.158693],[42.351993, -71.064796]]; |
50 | | - |
51 | | - console.log('#<%= bounding_box_to_coords(result_geo) %>'); |
52 | | - var bounds = <%= bounding_box_to_coords(result_geo) %>; |
53 | | - |
54 | | - // create an orange rectangle |
55 | | - L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(<%= "map_#{result_geo_counter}" %>); |
56 | | - |
57 | | - // zoom the map to the rectangle bounds |
58 | | - <%= "map_#{result_geo_counter}" %>.fitBounds(bounds); |
59 | | - </script> |
| 27 | + |
| 28 | + <%= render partial: 'shared/map', locals: { result_geo_counter: result_geo_counter, result_geo: result_geo} %> |
60 | 29 |
|
61 | 30 | <p> |
62 | 31 | <ul> |
|
0 commit comments