Biblio controller + update findings
This commit is contained in:
@@ -172,24 +172,9 @@ UI.openNotConserModal = async function (data, selector) {
|
||||
|
||||
let sheet = new NotConservedSheet();
|
||||
sheet.siteData = data;
|
||||
// For Stimulus biblio_controller
|
||||
window.Biblio = sheet;
|
||||
modal.querySelector('#not-conser-sheet').innerHTML = await sheet.render();
|
||||
modal.addEventListener('click', event => {
|
||||
const biblio = modal.querySelector('#biblio');
|
||||
if (event.target.id.includes('cit')) {
|
||||
|
||||
const id = event.target.id.replace('cit-','');
|
||||
|
||||
biblio.innerHTML = '<button class="delete"></button>';
|
||||
biblio.innerHTML += sheet.getReference(id);
|
||||
biblio.classList.remove('is-hidden');
|
||||
biblio.scrollIntoView({behavior: 'smooth'});
|
||||
}
|
||||
|
||||
if (event.target.className == 'delete') {
|
||||
biblio.classList.add('is-hidden');
|
||||
}
|
||||
});
|
||||
|
||||
modal.classList.add('is-active');
|
||||
}
|
||||
/**
|
||||
@@ -210,22 +195,8 @@ UI.openFindingModal = async function (data, selector) {
|
||||
finding.data = data;
|
||||
finding.setImages();
|
||||
modal.querySelector('#finding-sheet').innerHTML = await finding.render();
|
||||
modal.addEventListener('click', event => {
|
||||
const biblio = modal.querySelector('#biblio');
|
||||
|
||||
if (event.target.id.includes('cit')) {
|
||||
const id = event.target.id.replace('cit-','');
|
||||
|
||||
biblio.innerHTML = '<button class="delete"></button>';
|
||||
biblio.innerHTML += finding.getReference(id);
|
||||
biblio.classList.remove('is-hidden');
|
||||
biblio.scrollIntoView({behavior: 'smooth'});
|
||||
}
|
||||
|
||||
if (event.target.className == 'delete') {
|
||||
biblio.classList.add('is-hidden');
|
||||
}
|
||||
});
|
||||
// For Stimulus biblio_controller
|
||||
window.Biblio = finding;
|
||||
if (finding.images) {
|
||||
modal.querySelector('#photos').innerHTML = finding.renderImages();
|
||||
this.imageGallery('finding-gallery', finding.images);
|
||||
@@ -254,38 +225,6 @@ UI.openFindingModal = async function (data, selector) {
|
||||
});
|
||||
modal.classList.add('is-active');
|
||||
}
|
||||
/**
|
||||
* @param {string} menuListSel Menu list selector
|
||||
* @param {L.Map} map
|
||||
* @param {L.LayerGroup} sites
|
||||
*/
|
||||
UI.sitesMenu = function (menuListSel, map, sites) {
|
||||
let markers = [];
|
||||
|
||||
map.eachLayer(layer => {
|
||||
if (layer instanceof L.Marker) {
|
||||
markers.push(layer);
|
||||
}
|
||||
})
|
||||
|
||||
const menu = document.querySelector(menuListSel);
|
||||
menu.addEventListener('click', async event => {
|
||||
if (event.target.nodeName === 'A') {
|
||||
const layerId = event.target.id;
|
||||
const marker = markers.filter(m => m.id === layerId)[0];
|
||||
|
||||
// zoom to layer...
|
||||
const layer = sites.customGetLayer(layerId);
|
||||
map.setView(
|
||||
layer.getBounds().getCenter(),
|
||||
19,
|
||||
{animate: true, duration: 1, easeLinearity: 0.25}
|
||||
);
|
||||
|
||||
marker.openTooltip();
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Open Spotlight gallery
|
||||
* @param {string} galleryId The id of the trigger element
|
||||
|
||||
Reference in New Issue
Block a user