Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions web/app/scripts/views/map/layers-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@

new L.popup(popupOptions)
.setLatLng(e.latlng)
.setContent(ctl.buildRecordPopup(e.data, popupParams))
.setContent(ctl.buildRecordPopup(e.data, popupParams, e.latlng))
.openOn(ctl.map);

$compile($('#record-popup'))($scope);
Expand Down Expand Up @@ -708,12 +708,25 @@
* @param {Object} UTFGrid interactivity data from interaction event object
* @returns {String} HTML snippet for a Leaflet popup.
*/
ctl.buildRecordPopup = function(record, popupParams) {
ctl.buildRecordPopup = function(record, popupParams, e.latlng) {
// add header with record date constant field
/* jshint camelcase: false */
// DateTimes come back from Windshaft without tz information, but they're all UTC
var url = "https://a.mapillary.com/v3/images?lookat=" + e.latlng.lng + "," + e.latlng.lat + "&closeto=" + e.latlng.lng + "," + e.latlng.lat + "&client_id=UTZhSnNFdGpxSEFFREUwb01GYzlXZzo5ZWIxZWYxNzM1YWY2MjNm&radius=400";
var imgkey;
var mly;
$.ajax({
dataType: 'json',
url: url,
success: function (data) {
imgkey = data.images[0]["key"];
mly = '<iframe width=\"320\" height=\"200\" src=\"https://embed-v1.mapillary.com/embed?show_segmentation=true&version=1&filter=%5B%22all%22%5D&map_filter=%5B%22all%22%5D&image_key=" + imgkey + "&client_id=UTZhSnNFdGpxSEFFREUwb01GYzlXZzo5ZWIxZWYxNzM1YWY2MjNm&style=photo\" frameborder=\"0\"></iframe>';
},
async: false
});
var occurredStr = localizeRecordDateFilter(moment.utc(record.occurred_from), dateFormat, true);
var str = '<div id="record-popup" class="record-popup">';
str += mly;
str += '<div><h5>' + popupParams.label + ' ' + detailsLabel +
'</h5><h3>' + occurredStr + '</h3>';
/* jshint camelcase: true */
Expand Down