Refactor with less awaits (WIP)
This commit is contained in:
@@ -96,14 +96,12 @@ UI.toggleMenu = function (triggerId, listId = null) {
|
||||
* @param {object} data The data retrieved from the DB to display as modal content
|
||||
* @param {string} selector The modal selector
|
||||
*/
|
||||
UI.openSiteModal = async function (data, selector) {
|
||||
UI.openSiteModal = function (data, selector) {
|
||||
const modal = document.querySelector(selector);
|
||||
let dataTabs = modal.querySelectorAll('.data-tabs');
|
||||
|
||||
// Reset data tabs content
|
||||
for (let tab of dataTabs) {
|
||||
tab.innerHTML = '';
|
||||
}
|
||||
for (let tab of dataTabs) tab.innerHTML = '';
|
||||
|
||||
let siteSheet = new SiteSheet();
|
||||
siteSheet.siteData = data;
|
||||
@@ -161,7 +159,7 @@ UI.openSiteModal = async function (data, selector) {
|
||||
* @param {object} data The data retrieved from the DB to display as modal content
|
||||
* @param {string} selector The modal selector
|
||||
*/
|
||||
UI.openNotConserModal = async function (data, selector) {
|
||||
UI.openNotConserModal = function (data, selector) {
|
||||
const modal = document.querySelector(selector);
|
||||
|
||||
let sheet = new NotConservedSheet();
|
||||
@@ -169,21 +167,19 @@ UI.openNotConserModal = async function (data, selector) {
|
||||
// For Stimulus biblio_controller
|
||||
window.Biblio = sheet;
|
||||
|
||||
modal.querySelector('#not-conser-sheet').innerHTML = await sheet.render();
|
||||
sheet.render().then(html => modal.querySelector('#not-conser-sheet').innerHTML = html);
|
||||
modal.classList.add('is-active');
|
||||
}
|
||||
/**
|
||||
* @param {object} data The data retrieved from the DB to display as modal content
|
||||
* @param {string} selector The modal selector
|
||||
*/
|
||||
UI.openFindingModal = async function (data, selector) {
|
||||
UI.openFindingModal = function (data, selector) {
|
||||
const modal = document.querySelector(selector);
|
||||
let dataTabs = modal.querySelectorAll('.data-tabs');
|
||||
|
||||
// Reset data tabs content
|
||||
for (let tab of dataTabs) {
|
||||
tab.innerHTML = '';
|
||||
}
|
||||
for (let tab of dataTabs) tab.innerHTML = '';
|
||||
|
||||
let finding = new Finding();
|
||||
finding.data = data;
|
||||
@@ -191,12 +187,9 @@ UI.openFindingModal = async function (data, selector) {
|
||||
// For Stimulus biblio_controller
|
||||
window.Biblio = finding;
|
||||
|
||||
finding.setImages();
|
||||
modal.querySelector('#finding-sheet').innerHTML = await finding.render();
|
||||
if (finding.images) {
|
||||
modal.querySelector('#photos').innerHTML = finding.renderImages();
|
||||
this.imageGallery('finding-gallery', finding.images);
|
||||
}
|
||||
finding.render().then(html => modal.querySelector('#finding-sheet').innerHTML = html);
|
||||
finding.setImages(modal.querySelector('#photos'), this.imageGallery);
|
||||
|
||||
modal.classList.add('is-active');
|
||||
}
|
||||
/**
|
||||
@@ -204,7 +197,7 @@ UI.openFindingModal = async function (data, selector) {
|
||||
* @param {object} data The data retrieved from the DB to display as modal content
|
||||
* @param {string} selector The modal selector
|
||||
*/
|
||||
UI.openPrehistModal = async function (data, selector) {
|
||||
UI.openPrehistModal = function (data, selector) {
|
||||
const modal = document.querySelector(selector);
|
||||
|
||||
let prehistoric = new Prehistoric();
|
||||
@@ -212,8 +205,7 @@ UI.openPrehistModal = async function (data, selector) {
|
||||
|
||||
// For Stimulus biblio_controller
|
||||
//window.Biblio = prehistoric;
|
||||
|
||||
modal.querySelector('#prehist-sheet').innerHTML = await prehistoric.render();
|
||||
prehistoric.render().then(html => modal.querySelector('#prehist-sheet').innerHTML = html);
|
||||
modal.classList.add('is-active');
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user