Added uploads section to single event page
This commit is contained in:
@@ -58,8 +58,33 @@ async function main() {
|
||||
|
||||
if (event.location)
|
||||
$event.querySelector('.event-location').appendChild(getDirectionLink(event.location));
|
||||
else
|
||||
$event.querySelector('.event-location').innerText = 'There is no location specified for this event';
|
||||
|
||||
$event.querySelector('.event-notes').innerText = event.notes ?? '';
|
||||
$event.querySelector('.event-notes').innerText = event.notes ?? 'There are no notes for this event';
|
||||
|
||||
const uploads = $event.querySelector('.event-uploads');
|
||||
|
||||
if (event.uploads && event.uploads.length > 0) {
|
||||
for (const { upload } of event.uploads) {
|
||||
if (typeof upload === 'string') {
|
||||
uploads.classList.add('text-red-600');
|
||||
uploads.innerText = 'Please log in to view uploads';
|
||||
break;
|
||||
}
|
||||
|
||||
const $elem = document.createElement('a');
|
||||
|
||||
$elem.setAttribute('href', upload.url);
|
||||
$elem.innerText = upload.filename;
|
||||
|
||||
$elem.classList.add('underline');
|
||||
|
||||
uploads.appendChild($elem);
|
||||
}
|
||||
} else {
|
||||
uploads.innerText = 'There are no uploads for this event';
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user