Error fixing and debugging implementation.
Release Inventarsystem / release-docker (push) Successful in 2m15s
Release Inventarsystem / release-docker (push) Successful in 2m15s
This commit is contained in:
@@ -1359,9 +1359,11 @@
|
|||||||
const detailContent = document.getElementById('detailContent');
|
const detailContent = document.getElementById('detailContent');
|
||||||
const detailModal = document.getElementById('detailModal');
|
const detailModal = document.getElementById('detailModal');
|
||||||
|
|
||||||
|
// Lade-Status anzeigen und Modal öffnen
|
||||||
detailContent.innerHTML = '<p>Lade Details...</p>';
|
detailContent.innerHTML = '<p>Lade Details...</p>';
|
||||||
detailModal.style.display = 'flex';
|
detailModal.style.display = 'flex';
|
||||||
|
|
||||||
|
// Daten vom Backend-API-Endpoint abrufen
|
||||||
fetch(`/api/item_detail/${itemId}`)
|
fetch(`/api/item_detail/${itemId}`)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
@@ -1373,23 +1375,40 @@
|
|||||||
detailContent.innerHTML = data.html;
|
detailContent.innerHTML = data.html;
|
||||||
|
|
||||||
const imageArray = data.images || [];
|
const imageArray = data.images || [];
|
||||||
|
const thumbnailInfoMap = data.thumbnailInfo || [];
|
||||||
|
|
||||||
if (Array.isArray(imageArray) && imageArray.length > 0) {
|
if (Array.isArray(imageArray) && imageArray.length > 0) {
|
||||||
const imagesHtml = imageArray.map(image => {
|
const imagesHtml = imageArray.map((image, index) => {
|
||||||
const imageSrc = image.startsWith('/uploads/') || image.startsWith('http')
|
const isVideo = typeof isVideoFile === 'function' ? isVideoFile(image) : /\.(mp4|webm|ogg|mov)$/i.test(image);
|
||||||
? image
|
const thumbnailInfo = thumbnailInfoMap[index];
|
||||||
: `/uploads/${image}`;
|
|
||||||
|
|
||||||
return `
|
if (isVideo) {
|
||||||
<div class="item-image-wrapper">
|
const videoSrc = image.startsWith('/uploads/') || image.startsWith('http')
|
||||||
<img src="{{ url_for('uploaded_file', filename=image) }}"
|
? image
|
||||||
alt="Buchcover"
|
: `/uploads/${image}`;
|
||||||
class="item-image"
|
|
||||||
loading="lazy"
|
return `
|
||||||
onload="console.log('Bild geladen:', '${imageSrc}')"
|
<div class="item-image-wrapper" style="width: 100%; height: auto;">
|
||||||
onerror="console.error('FEHLER beim Laden des Bildes im DOM:', '${imageSrc}')">
|
<video src="${videoSrc}" class="item-image ${index === 0 ? 'active-image' : ''}" id="modal-image-${index}" controls preload="metadata" style="width: 100%; height: auto; max-height: 300px;"></video>
|
||||||
</div>
|
</div>`;
|
||||||
`;
|
} else {
|
||||||
|
const imageSrc = thumbnailInfo && thumbnailInfo.has_preview
|
||||||
|
? thumbnailInfo.preview_url
|
||||||
|
: (image.startsWith('/uploads/') || image.startsWith('http')
|
||||||
|
? image
|
||||||
|
: `/uploads/${image}`);
|
||||||
|
|
||||||
|
return `
|
||||||
|
<div class="item-image-wrapper">
|
||||||
|
<img src="${imageSrc}"
|
||||||
|
alt="Buchcover / Bild"
|
||||||
|
class="item-image ${index === 0 ? 'active-image' : ''}"
|
||||||
|
id="modal-image-${index}"
|
||||||
|
loading="lazy"
|
||||||
|
onload="console.log('Bild geladen:', '${imageSrc}')"
|
||||||
|
onerror="console.error('FEHLER beim Laden des Bildes im DOM:', '${imageSrc}')">
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
const mediaHtml = `<div class="detail-gallery-container">${imagesHtml}</div>`;
|
const mediaHtml = `<div class="detail-gallery-container">${imagesHtml}</div>`;
|
||||||
|
|||||||
Reference in New Issue
Block a user