forked from publiclab/plots2
-
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.
Add map of people to publiclab.org/people publiclab#1940 (publiclab#2158
) * Added maps * API made for people maps * Added API url for People map * Made helper function for People Map API * Updated self.people_map * Created _peopleLeaflet.html.erb * Drupal_user removed * Indentation done * search Recent People functionality * search Recent People helper
- Loading branch information
1 parent
6a31adb
commit bd222da
Showing
8 changed files
with
116 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<% unique_id = rand(100) %> | ||
<style> | ||
#map<%= unique_id %> { width:100%; height:300px; margin: 0; position: relative;} | ||
</style> | ||
|
||
<div class="leaflet-map" id="map<%= unique_id %>"></div> | ||
<% if defined? people %> | ||
<p><i><small> | ||
Share your own location on <a href='/profile'>your profile</a>. | ||
</small></i></p> | ||
<% end %> | ||
|
||
<script> | ||
var map<%= unique_id %> = L.map('map<%= unique_id %>').on('load', onMapLoad).setView([<%= lat %>,<%= lon %>], 2); | ||
L.tileLayer("//a.tiles.mapbox.com/v3/jywarren.map-lmrwb2em/{z}/{x}/{y}.png").addTo(map<%= unique_id %>); | ||
function onMapLoad(e){ | ||
$.getJSON("/api/srch/peoplelocations?srchString=100" , function(data){ | ||
if (!!data.items){ | ||
for (i = 0; i < data.items.length ; i++) { | ||
var url = data.items[i].docUrl ; | ||
var title = data.items[i].docTitle ; | ||
L.marker([data.items[i].latitude , data.items[i].longitude]).addTo(map<%= unique_id %>).bindPopup("<a href=" + url + ">" + title + "</a>") ; | ||
} | ||
} | ||
}); | ||
} | ||
</script> | ||
|
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 |
---|---|---|
@@ -1,4 +1,15 @@ | ||
require 'test_helper' | ||
|
||
class SearchHelperTest < ActionView::TestCase | ||
|
||
test "search Recent People helper" do | ||
sservice = SearchService.new | ||
result = sservice.recentPeople(100) | ||
assert_equal result.items.first.docType , "people_coordinates" | ||
assert_equal result.items.first.docTitle , users(:bob).username | ||
assert_equal result.items.first.docSummary , 0 | ||
assert_equal result.items.first.docScore , 0 | ||
assert_equal result.items.first.latitude , "41" | ||
assert_equal result.items.first.longitude , "-90" | ||
end | ||
end |