From 16d4a18e4acbbd56078f2b59c1193b84ae3cc9f4 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 24 Nov 2024 08:54:41 +0100 Subject: [PATCH] add photoswipe to file list and album table views --- src/albums/templates/album_grid.html | 4 ++-- src/albums/templates/album_table.html | 9 +++++++++ src/bma/settings.py | 8 ++++++++ src/files/templates/file_list.html | 10 +++++++++- src/files/templates/includes/file_thumbnail.html | 2 +- src/static_src/js/photoswipe.js | 2 +- 6 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/albums/templates/album_grid.html b/src/albums/templates/album_grid.html index 5f96e1fb..8f1ce55e 100644 --- a/src/albums/templates/album_grid.html +++ b/src/albums/templates/album_grid.html @@ -9,11 +9,11 @@ {% for file in filter.qs %} {% if file.filetype == "image" %} -{% thumbnail file.thumbnail.source filetype=file.filetype width=200 ratio="1/1" %} +{% thumbnail file.thumbnail.source filetype=file.filetype width=200 ratio="1/1" %} {% elif file.filetype == "video" %} {# Set max video player size to 1280x1024 #} -{% thumbnail file.thumbnail.source filetype=file.filetype width=200 ratio="16/9" %} +{% thumbnail file.thumbnail.source filetype=file.filetype width=200 ratio="16/9" %} {% else %} diff --git a/src/albums/templates/album_table.html b/src/albums/templates/album_table.html index ccc74e3a..e384dc7a 100644 --- a/src/albums/templates/album_table.html +++ b/src/albums/templates/album_table.html @@ -1,4 +1,13 @@ {% extends "album_detail.html" %} +{% load static %} + +{% block extra_head %} + +{% endblock extra_head %} + {% block album_detail %} + + {% endblock album_detail %} diff --git a/src/bma/settings.py b/src/bma/settings.py index 304f7a9d..9eef1950 100644 --- a/src/bma/settings.py +++ b/src/bma/settings.py @@ -267,3 +267,11 @@ "USE_PLACEHOLDERS": False, "PROCESSOR": "images.picture_processor.dummy_processor", } + + +DJANGO_TABLES2_TABLE_ATTRS = { + "class": "table table-hover", + "thead": { + "class": "table-light", + }, +} diff --git a/src/files/templates/file_list.html b/src/files/templates/file_list.html index 007b87d5..4d754f4d 100644 --- a/src/files/templates/file_list.html +++ b/src/files/templates/file_list.html @@ -1,8 +1,13 @@ {% extends "base.html" %} +{% load humanize static %} {% load django_bootstrap5 %} {% block title %}File list{% endblock title %} +{% block extra_head %} + +{% endblock extra_head %} + {% block main_content %}
@@ -38,9 +43,12 @@
Filter Files
Files
- {% include "includes/file_table.html" %} +
+ {% endblock main_content %} diff --git a/src/files/templates/includes/file_thumbnail.html b/src/files/templates/includes/file_thumbnail.html index 7592fe26..489364db 100644 --- a/src/files/templates/includes/file_thumbnail.html +++ b/src/files/templates/includes/file_thumbnail.html @@ -1,5 +1,5 @@ {% if record.thumbnail %} -{% thumbnail record.thumbnail.source filetype=record.filetype width=width|default:50 ratio=ratio|default:"" %} +
{% thumbnail record.thumbnail.source filetype=record.filetype width=width|default:50 ratio=ratio|default:"" %} {% else %}
{% endif %} diff --git a/src/static_src/js/photoswipe.js b/src/static_src/js/photoswipe.js index 8a2405e0..de8fe0bb 100644 --- a/src/static_src/js/photoswipe.js +++ b/src/static_src/js/photoswipe.js @@ -3,7 +3,7 @@ import PhotoSwipeLightbox from "/static/js/vendor/photoswipe-lightbox-v5.4.4.esm import PhotoSwipeVideoPlugin from '/static/js/vendor/photoswipe-video-plugin-v1.0.2.esm.min.js'; const lightbox = new PhotoSwipeLightbox({ gallery: '#gallery', - children: 'a', + children: 'a.gallerya', pswpModule: () => import('/static/js/vendor/photoswipe-v5.4.4.esm.min.js') });