Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bb89b434ed | |||
| ac4d125d73 | |||
| 3f6830e8c8 | |||
| 0ea5d2db26 |
+5
-2
@@ -3826,11 +3826,14 @@ def api_item_detail(item_id):
|
||||
{f'<p><strong>Ausgeliehen von:</strong> {html.escape(str(borrower_value))}</p>' if borrower_value and status_label == 'Ausgeliehen' else ''}
|
||||
{borrows_html}
|
||||
"""
|
||||
|
||||
ctx = get_tenant_context()
|
||||
current_tenant_id = ctx.tenant_id if ctx else None
|
||||
|
||||
client.close()
|
||||
return jsonify({
|
||||
'html': detail_html,
|
||||
'images': item.get('Images', item.get('Bilder', []))
|
||||
'images': item.get('Images', item.get('Bilder', [])),
|
||||
'tenant': str(current_tenant_id)
|
||||
}), 200
|
||||
except Exception as e:
|
||||
app.logger.error(f"Error fetching item detail: {e}")
|
||||
|
||||
@@ -1359,9 +1359,11 @@
|
||||
const detailContent = document.getElementById('detailContent');
|
||||
const detailModal = document.getElementById('detailModal');
|
||||
|
||||
// Lade-Status anzeigen und Modal öffnen
|
||||
detailContent.innerHTML = '<p>Lade Details...</p>';
|
||||
detailModal.style.display = 'flex';
|
||||
|
||||
// Daten vom Backend-API-Endpoint abrufen
|
||||
fetch(`/api/item_detail/${itemId}`)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
@@ -1373,18 +1375,40 @@
|
||||
detailContent.innerHTML = data.html;
|
||||
|
||||
const imageArray = data.images || [];
|
||||
const thumbnailInfoMap = data.thumbnailInfo || [];
|
||||
|
||||
if (Array.isArray(imageArray) && imageArray.length > 0) {
|
||||
const imagesHtml = imageArray.map(image => {
|
||||
const imageSrc = image.startsWith('/uploads/') || image.startsWith('http')
|
||||
? image
|
||||
: `/uploads/${image}`;
|
||||
const imagesHtml = imageArray.map((image, index) => {
|
||||
const isVideo = typeof isVideoFile === 'function' ? isVideoFile(image) : /\.(mp4|webm|ogg|mov)$/i.test(image);
|
||||
const thumbnailInfo = thumbnailInfoMap[index];
|
||||
|
||||
return `
|
||||
if (isVideo) {
|
||||
const videoSrc = image.startsWith('/uploads/') || image.startsWith('http')
|
||||
? image
|
||||
: `/uploads/${image}`;
|
||||
|
||||
return `
|
||||
<div class="item-image-wrapper" style="width: 100%; height: auto;">
|
||||
<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>`;
|
||||
} 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" loading="lazy">
|
||||
</div>
|
||||
`;
|
||||
<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('');
|
||||
|
||||
const mediaHtml = `<div class="detail-gallery-container">${imagesHtml}</div>`;
|
||||
|
||||
Reference in New Issue
Block a user