mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Render the asset map_popup view inside map popups.
This commit is contained in:
parent
8a1802ffd3
commit
9f7906d2c6
|
@ -59,30 +59,22 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo: Display area details in popup.
|
|
||||||
// Load area details via AJAX when an area popup is displayed.
|
// Load area details via AJAX when an area popup is displayed.
|
||||||
// instance.popup.on('farmOS-map.popup', function (event) {
|
instance.popup.on('farmOS-map.popup', function (event) {
|
||||||
// var area_details = jQuery('.ol-popup-description .area-details');
|
var link = event.target.element.querySelector('.ol-popup-name a');
|
||||||
// if (area_details.attr('id') === undefined) {
|
if (link) {
|
||||||
// return;
|
var assetLink = link.getAttribute('href')
|
||||||
// }
|
var description = event.target.element.querySelector('.ol-popup-description');
|
||||||
// area_details.html('test!');
|
description.innerHTML = 'Loading asset details...';
|
||||||
// var area_id = area_details.attr('id').replace('area-details-', '');
|
fetch(assetLink + '/map_popup')
|
||||||
// if (area_id) {
|
.then((response) => {
|
||||||
// area_details.html('Loading area details...');
|
return response.text();
|
||||||
// jQuery.getJSON(Drupal.settings.farm_map.base_path + 'farm/area/' + area_id + '/details', function(data) {
|
})
|
||||||
// if (data) {
|
.then((html) => {
|
||||||
// area_details.html(data);
|
description.innerHTML = html;
|
||||||
// var position = event.target.getPosition();
|
});
|
||||||
// event.target.setPosition();
|
}
|
||||||
// event.target.setPosition(position);
|
});
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// area_details.html('');
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
Loading…
Reference in a new issue