-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This needs a refactor. Do not merge.
yes, I know the tests are failing too. It needs cassette regen but wanted to share the idea before tuning it up
- Loading branch information
Showing
5 changed files
with
105 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,56 @@ | |
</p> | ||
<% end %> | ||
|
||
|
||
<!-- We only care about geospatial locations for this, as place names are also subjects. --> | ||
<% if geospatial_coordinates?(result_geo['locations']) %> | ||
<% content_for :additional_meta_tag do %> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" | ||
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" | ||
crossorigin=""/> | ||
|
||
<!-- Make sure you put this AFTER Leaflet's CSS --> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" | ||
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" | ||
crossorigin=""></script> | ||
<% end %> | ||
<div id=<%= "map_#{result_geo_counter}" %> style="height: 180px"></div> | ||
|
||
<script> | ||
var <%= "map_#{result_geo_counter}" %> = L.map('<%= "map_#{result_geo_counter}" %>'); | ||
|
||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { | ||
maxZoom: 19, | ||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' | ||
}).addTo(<%= "map_#{result_geo_counter}" %>); | ||
|
||
// define rectangle geographical bounds | ||
// -71.158693, -71.064796, 42.395972, 42.351993 | ||
// var bounds = [[42.395972, -71.158693],[42.351993, -71.064796]]; | ||
|
||
console.log('#<%= bounding_box_to_coords(result_geo) %>'); | ||
var bounds = <%= bounding_box_to_coords(result_geo) %>; | ||
|
||
// create an orange rectangle | ||
L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(<%= "map_#{result_geo_counter}" %>); | ||
|
||
// zoom the map to the rectangle bounds | ||
<%= "map_#{result_geo_counter}" %>.fitBounds(bounds); | ||
</script> | ||
|
||
<p> | ||
<ul> | ||
<% parse_nested_field(result_geo['locations']).each do |location| %> | ||
<% if location['geoshape'].present? %> | ||
<li><%= "#{location['kind']}: #{location['geoshape']}" %></li> | ||
<% end %> | ||
<% end %> | ||
</ul> | ||
</p> | ||
<% else %> | ||
Hallo | ||
<% end %> | ||
<% if result_geo['highlight'] %> | ||
<div class="result-highlights"> | ||
<%= render partial: 'search/highlights', locals: { result: result_geo } %> | ||
|