Skip to content

Commit

Permalink
[metadata] Page de chargement aussi pour la lecture pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
wincelau committed Oct 12, 2024
1 parent 591e92d commit 186f795
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions public/js/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let pdffile = null
let deletedMetadata = [];
let isLocalPath = false;
let hasModifications = false;
const modalLoading = new bootstrap.Modal('#modalLoading')

function responsiveDisplay() {
let menu = document.getElementById('sidebarTools');
Expand Down Expand Up @@ -259,6 +260,7 @@ async function pageUpload() {
}

async function pageMetadata(url) {
modalLoading.show();
document.querySelector('body').classList.add('bg-light');
document.getElementById('page-upload').classList.add('d-none');
document.getElementById('page-metadata').classList.remove('d-none');
Expand All @@ -272,12 +274,11 @@ async function pageMetadata(url) {
if(url && url.match(/^cache:\/\//)) {
await loadFileFromCache(url.replace(/^cache:\/\//, ''));
} else if (url) {
const modalLoading = new bootstrap.Modal('#modalLoading')
modalLoading.show();
await loadFileFromUrl(url);
modalLoading.hide();
}

document.getElementById('modalLoading').querySelector('p').innerText = 'Chargement du PDF'

if(!document.getElementById('input_pdf_upload').files.length) {
alert("Chargement du PDF impossible");
document.location = '/metadata';
Expand All @@ -286,7 +287,8 @@ async function pageMetadata(url) {

responsiveDisplay();
createEventsListener();
loadPDF(document.getElementById('input_pdf_upload').files[0]);
await loadPDF(document.getElementById('input_pdf_upload').files[0]);
modalLoading.hide();
};


Expand Down
2 changes: 1 addition & 1 deletion templates/metadata.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<div class="modal-dialog modal-lg modal-dialog-centered">
<div class="modal-content bg-transparent border-0">
<div class="modal-body text-center my-5 text-white fs-4">
<p class="monospace">Récupération du fichier en cours ...</p>
<p>Récupération du fichier</p>
<div class="spinner-border" role="status"></div>
</div>
</div>
Expand Down

0 comments on commit 186f795

Please sign in to comment.