Merge branch 'master' of https://git.electricmandarine.cloud/nicolo/caprigis
This commit is contained in:
commit
0ad8e5c7f9
@ -10,7 +10,7 @@ export class NotConservedSheet {
|
|||||||
this._data = data;
|
this._data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
async render() {
|
||||||
return `
|
return `
|
||||||
<div class="container ml-3">
|
<div class="container ml-3">
|
||||||
<p class="p-2">
|
<p class="p-2">
|
||||||
@ -39,7 +39,7 @@ export class NotConservedSheet {
|
|||||||
<span class="icon has-text-link">
|
<span class="icon has-text-link">
|
||||||
<i class="fa fa-book"></i>
|
<i class="fa fa-book"></i>
|
||||||
</span>
|
</span>
|
||||||
<strong>Bibliografia:</strong> ${this.biblio(this._data.bibliography)}
|
<strong>Bibliografia:</strong> ${await this.biblio(this._data.id)}
|
||||||
</p>
|
</p>
|
||||||
<p class="p-2">
|
<p class="p-2">
|
||||||
<strong>Autore scheda:</strong> ${this._data.author}
|
<strong>Autore scheda:</strong> ${this._data.author}
|
||||||
@ -47,11 +47,13 @@ export class NotConservedSheet {
|
|||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
biblio(records) {
|
async biblio(recordId) {
|
||||||
|
let record = await this.fetchData(`${window.API_URL}/not_conserved/${recordId}`);
|
||||||
|
|
||||||
let biblio = '';
|
let biblio = '';
|
||||||
|
|
||||||
if (records.length) {
|
if (record.bibliography.length) {
|
||||||
records.forEach(record => {
|
record.bibliography.forEach(record => {
|
||||||
biblio += `
|
biblio += `
|
||||||
<span class="is-capitalized">${record.citation.toLowerCase()}</span>,
|
<span class="is-capitalized">${record.citation.toLowerCase()}</span>,
|
||||||
${record.pages};
|
${record.pages};
|
||||||
@ -61,4 +63,8 @@ export class NotConservedSheet {
|
|||||||
|
|
||||||
return biblio.trim().slice(0, -1);
|
return biblio.trim().slice(0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fetchData(url) {
|
||||||
|
return await fetch(url).then(res => res.json());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ if (BASE_URL.includes('localhost')) {
|
|||||||
API_URL = API_CONFIG.prod;
|
API_URL = API_CONFIG.prod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.API_URL = API_URL;
|
||||||
|
|
||||||
// Global leaflet
|
// Global leaflet
|
||||||
/**
|
/**
|
||||||
* @namespace GIS
|
* @namespace GIS
|
||||||
|
@ -153,7 +153,7 @@ UI.openNotConserModal = async function (data, selector) {
|
|||||||
|
|
||||||
let sheet = new NotConservedSheet();
|
let sheet = new NotConservedSheet();
|
||||||
sheet.siteData = data;
|
sheet.siteData = data;
|
||||||
modal.querySelector('#not-conser-sheet').innerHTML = sheet.render();
|
modal.querySelector('#not-conser-sheet').innerHTML = await sheet.render();
|
||||||
|
|
||||||
modal.classList.add('is-active');
|
modal.classList.add('is-active');
|
||||||
const closeBtn = modal.querySelector('.modal-close');
|
const closeBtn = modal.querySelector('.modal-close');
|
||||||
|
Loading…
Reference in New Issue
Block a user