Use GisState for biblio as well
This commit is contained in:
parent
c265e4aa94
commit
5b5d0aeb3d
@ -23,7 +23,7 @@ export default API_CONFIG;
|
||||
|
||||
### Entry point
|
||||
|
||||
Il punto d'ingresso dell'applicazione è `webgis/js/index.js` che registra i controller Stimulus, inizializza alcune funzioni UI che potrebbero essere migrate in un controller Stimulus dedicato in futuro.
|
||||
Il punto d'ingresso dell'applicazione è `webgis/js/index.js` che registra i controller Stimulus e inizializza alcune funzioni UI (che potrebbero essere migrate in un controller Stimulus dedicato in futuro).
|
||||
|
||||
### Mappa
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
import { GisState } from "../state.js";
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ['biblio', 'cit', 'ref', 'close'];
|
||||
|
||||
open(event) {
|
||||
const biblio = window.Biblio;
|
||||
const biblio = GisState.bibliography;
|
||||
this.trigger = event.currentTarget;
|
||||
const id = this.trigger.id.replace('cit-', '');
|
||||
this.ref = this.biblioTarget;
|
||||
|
@ -8,18 +8,13 @@
|
||||
* A lookup table of Leaflet layer groups by category
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object.<string, Object>} BibliographyLookup
|
||||
* A lookup table of bibliography data by category
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} GisStateType
|
||||
* @property {L.Map|null} map
|
||||
* @property {String|null} apiUrl
|
||||
* @property {MarkerLookup} markers
|
||||
* @property {LayerGroupLookup} layers
|
||||
* @property {BibliographyLookup} bibliography
|
||||
* @property {Object|null} bibliography
|
||||
*/
|
||||
|
||||
/** @type {GisStateType} */
|
||||
@ -39,13 +34,7 @@ export const GisState = {
|
||||
prehistoric: {},
|
||||
underwater: {},
|
||||
},
|
||||
bibliography: {
|
||||
sites: {},
|
||||
notConserved: {},
|
||||
findings: {},
|
||||
prehistoric: {},
|
||||
underwater: {},
|
||||
},
|
||||
bibliography: null,
|
||||
apiUrl : null,
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import { NotConserved } from './components/NotConserved.js';
|
||||
import { Finding } from './components/Finding.js';
|
||||
import { Prehistoric } from './components/Prehistoric.js';
|
||||
import { Underwater } from './components/Underwater.js';
|
||||
import { GisState } from "./state.js";
|
||||
|
||||
/**
|
||||
* @namespace UI
|
||||
@ -107,7 +108,7 @@ UI.openSiteModal = function (data, selector) {
|
||||
let siteSheet = new SiteSheet();
|
||||
siteSheet.siteData = data;
|
||||
|
||||
window.Biblio = siteSheet;
|
||||
GisState.bibliography = siteSheet;
|
||||
|
||||
modal.querySelector('#short-sheet').innerHTML = siteSheet.renderShort();
|
||||
if (data.description) {
|
||||
@ -169,7 +170,7 @@ UI.openNotConserModal = function (data, selector) {
|
||||
let notConserved = new NotConserved();
|
||||
notConserved.data = data;
|
||||
// For Stimulus biblio_controller
|
||||
window.Biblio = notConserved;
|
||||
GisState.bibliography = notConserved;
|
||||
|
||||
notConserved.render().then(html => modal.querySelector('#not-conserved-sheet').innerHTML = html);
|
||||
notConserved.renderDocs().then(html => modal.querySelector('#documents').innerHTML = html);
|
||||
@ -191,7 +192,7 @@ UI.openFindingModal = function (data, selector) {
|
||||
finding.data = data;
|
||||
|
||||
// For Stimulus biblio_controller
|
||||
window.Biblio = finding;
|
||||
GisState.bibliography = finding;
|
||||
|
||||
finding.render().then(html => modal.querySelector('#finding-sheet').innerHTML = html);
|
||||
finding.setImages(modal.querySelector('#photos'), this.imageGallery);
|
||||
@ -214,7 +215,7 @@ UI.openPrehistModal = function (data, selector) {
|
||||
prehistoric.data = data;
|
||||
|
||||
// For Stimulus biblio_controller
|
||||
//window.Biblio = prehistoric;
|
||||
//GisState.bibliography = prehistoric;
|
||||
prehistoric.render().then(html => modal.querySelector('#prehist-sheet').innerHTML = html);
|
||||
prehistoric.setImages(modal.querySelector('#photos'), this.imageGallery);
|
||||
modal.classList.add('is-active');
|
||||
@ -231,7 +232,7 @@ UI.openUnderwaterModal = function (data, selector) {
|
||||
underwater.data = data;
|
||||
|
||||
// For Stimulus biblio_controller
|
||||
//window.Biblio = prehistoric;
|
||||
//GisState.bibliography = underwater;
|
||||
underwater.render().then(html => modal.querySelector('#underwater-sheet').innerHTML = html);
|
||||
modal.classList.add('is-active');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user