Skip to content

Commit

Permalink
fixed #2
Browse files Browse the repository at this point in the history
  • Loading branch information
tech-kev committed Feb 13, 2024
1 parent f467fa4 commit 9ec0103
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 33 deletions.
2 changes: 1 addition & 1 deletion backend/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
locale = json.load(file)

# Set Version Number
os.environ['VERSION'] = '1.3.0'
os.environ['VERSION'] = '1.3.1'

# Import logger
utils_dir = os.path.join(current_dir, '..', 'utils')
Expand Down
81 changes: 49 additions & 32 deletions frontend/sites/gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,43 +65,60 @@ <h6 id="mainTitle" class="brand-logo center truncate"></h6>

if (data.status === "success") {

const galleryTitle = document.getElementById('galleryTitle');
const galleryDesc = document.getElementById('galleryDesc');
const nanogallery2 = document.getElementById('nanogallery2');

// Titel aktualisieren
galleryTitle.innerText = LCgalleryTitle + ': ' + data.data[0].title;
galleryDesc.innerText = data.data[0].content;


// Dateien hinzufügen
const fileURLs = data.data[0].contentURL.split(';');
const items = fileURLs.map(url => {
const fileName = getFileNameFromURL(url);
return {
src: fileName,
srct: fileName,
title: ''
};
});

// Galerie erstellen
jQuery(nanogallery2).nanogallery2({
thumbnailHeight: 150,
thumbnailWidth: 150,
itemsBaseURL: '/upload/feed_items/',
items: items
});
} else {
const message = data.message;
callToast('error', message);
const galleryTitle = document.getElementById('galleryTitle');
const galleryDesc = document.getElementById('galleryDesc');
const nanogallery2 = document.getElementById('nanogallery2');

// Bugfix for #2
if (typeof LCgalleryTitle === 'undefined'){
fetch(API_ENDPOINTS.locales, {
method: 'GET'
})
.then(response => response.json())
.then(data => {
LCgalleryTitle = data.gallery;
})
.catch(error => {
const errmessage = error + '! Please check the console!';
callToast('error', errmessage);
console.error(error);
});
}

// Titel aktualisieren
galleryTitle.innerText = LCgalleryTitle + ': ' + data.data[0].title;
galleryDesc.innerText = data.data[0].content;


// Dateien hinzufügen
const fileURLs = data.data[0].contentURL.split(';');
const items = fileURLs.map(url => {
const fileName = getFileNameFromURL(url);
return {
src: fileName,
srct: fileName,
title: ''
};
});

// Galerie erstellen
jQuery(nanogallery2).nanogallery2({
thumbnailHeight: 150,
thumbnailWidth: 150,
itemsBaseURL: '/upload/feed_items/',
items: items,
galleryRenderDelay: 500 // Bugfix for #2
});
} else {
const message = data.message;
callToast('error', message);
}
})
.catch(error => {
.catch(error => {
const errmessage = error + '! ' + LCcheckConsole;
callToast('error', errmessage);
console.error(error);
});
});
});
</script>
</div>
Expand Down

0 comments on commit 9ec0103

Please sign in to comment.