+
-
+
diff --git a/webgis/js/components/NotConservedSheet.js b/webgis/js/components/NotConservedSheet.js
index ed8a041..eb0c4f2 100644
--- a/webgis/js/components/NotConservedSheet.js
+++ b/webgis/js/components/NotConservedSheet.js
@@ -3,6 +3,7 @@
* @class NotConservedSheet
*/
export class NotConservedSheet {
+ biblioElements = [];
/**
* @param {object} data
*/
@@ -12,7 +13,7 @@ export class NotConservedSheet {
async render() {
return `
-
+
@@ -41,6 +42,8 @@ export class NotConservedSheet { Bibliografia: ${await this.biblio(this._data.id)}
+
+
Autore scheda: ${this._data.author}
@@ -50,18 +53,32 @@ export class NotConservedSheet { async biblio(recordId) { let record = await this.fetchData(`${window.API_URL}/not_conserved/${recordId}`); - let biblio = ''; + let citations = ''; if (record.bibliography.length) { record.bibliography.forEach(record => { - biblio += ` - ${record.citation.toLowerCase()}, - ${record.pages}; + citations += ` + + ${record.citation.toLowerCase()}, + ${record.pages}; `; + + this.biblioElements.push(` +
+
+ `
+ );
});
}
- return biblio.trim().slice(0, -1);
+ return citations.trim().slice(0, -1);
+ }
+
+ getReference(id) {
+ return this.biblioElements.find(ref => ref.includes(`ref-${id}`));
}
async fetchData(url) {
diff --git a/webgis/js/package.json b/webgis/js/package.json
index 94038bb..627c4ec 100644
--- a/webgis/js/package.json
+++ b/webgis/js/package.json
@@ -5,6 +5,7 @@
"author": "Nicolò P.",
"license": "GPLv3",
"dependencies": {
+ "@hotwired/stimulus": "^3.2.2",
"@kalisio/leaflet-graphicscale": "^1.0.0",
"bulma": "^1.0.1",
"fontawesome-free": "^1.0.4",
diff --git a/webgis/js/ui.js b/webgis/js/ui.js
index 0bfbe46..089f30b 100644
--- a/webgis/js/ui.js
+++ b/webgis/js/ui.js
@@ -69,8 +69,8 @@ UI.toggleMenu = function (triggerId) {
trigger.addEventListener('click', () => {
const menu = document.querySelector('#menu');
menu.classList.toggle('is-hidden');
- menu.classList.toggle('is-2');
- document.querySelector('#map').parentElement.classList.toggle('is-full');
+ menu.classList.toggle('is-3');
+ //document.querySelector('#map').parentElement.classList.toggle('is-full');
});
}
/**
@@ -154,6 +154,19 @@ UI.openNotConserModal = async function (data, selector) {
let sheet = new NotConservedSheet();
sheet.siteData = data;
modal.querySelector('#not-conser-sheet').innerHTML = await sheet.render();
+ modal.addEventListener('click', event => {
+ const biblio = document.querySelector('#biblio');
+ if (event.target.id.includes('cit')) {
+ const id = event.target.id.replace('cit-','');
+ biblio.innerHTML = '';
+ biblio.innerHTML += sheet.getReference(id);
+ biblio.classList.remove('is-hidden');
+ }
+
+ if (event.target.className == 'delete') {
+ biblio.classList.add('is-hidden');
+ }
+ });
modal.classList.add('is-active');
const closeBtn = modal.querySelector('.modal-close');
@@ -162,6 +175,7 @@ UI.openNotConserModal = async function (data, selector) {
// CLose modal when clicking either on the X button or on the background
closeBtn.addEventListener('click', () => closeModal());
modalBg.addEventListener('click', () => closeModal());
+
}
/**
* Open a modal with project info
diff --git a/webgis/js/yarn.lock b/webgis/js/yarn.lock
index a354ecb..40761ae 100644
--- a/webgis/js/yarn.lock
+++ b/webgis/js/yarn.lock
@@ -2,6 +2,11 @@
# yarn lockfile v1
+"@hotwired/stimulus@^3.2.2":
+ version "3.2.2"
+ resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.2.2.tgz#071aab59c600fed95b97939e605ff261a4251608"
+ integrity sha512-eGeIqNOQpXoPAIP7tC1+1Yc1yl1xnwYqg+3mzqxyrbE5pg5YFBZcA6YoTiByJB6DKAEsiWtl6tjTJS4IYtbB7A==
+
"@kalisio/leaflet-graphicscale@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@kalisio/leaflet-graphicscale/-/leaflet-graphicscale-1.0.0.tgz#5a163e01805208b08ddafd9301e6ad0d4c603e51"
Riferimento
+${record.reference}
+