From 7cc9d1ed175f8c226eb9507c9777863a332ae5ca Mon Sep 17 00:00:00 2001 From: Wally Hackenslacker Date: Fri, 27 Mar 2026 21:10:38 -0400 Subject: [PATCH] Add special-gallery back thumbnail and hide sort button for specials --- viewer/image.py | 14 +++++++-- viewer/templates/gallery_view.html | 4 +++ viewer/templates/image_view.html | 46 ++++++++++++++++-------------- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/viewer/image.py b/viewer/image.py index 50adef1..50439e2 100644 --- a/viewer/image.py +++ b/viewer/image.py @@ -141,10 +141,20 @@ def render_image(request, path_text, full_path, special=None): except Exception: dir_text = "" - # For special galleries hide the Back control but still present Home + # Back (directory) and Home (root) links and thumbnails + # For special galleries we still want to show a Back link that points + # to the special gallery root — populate `back_thumb` with the + # thumbnail of the first image in that special gallery so the UI can + # display a representative image. For non-special views keep the + # existing behavior (thumbnail for parent directory). if special is not None: back_url = None - back_thumb = None + # images_sorted is already the special list in the requested order + try: + first_image = images_sorted[0] if len(images_sorted) > 0 else None + back_thumb = thumb_for(first_image) + except Exception: + back_thumb = None else: back_url = gallery_url( Path(dir_text) if dir_text != "" else None, True, query_state diff --git a/viewer/templates/gallery_view.html b/viewer/templates/gallery_view.html index b03a473..054dfd0 100644 --- a/viewer/templates/gallery_view.html +++ b/viewer/templates/gallery_view.html @@ -206,6 +206,7 @@ {% endfor %} + {% if not is_special %} + {% endif %} + {% if not is_special %} + {% endif %}