Add special-gallery back thumbnail and hide sort button for specials
This commit is contained in:
@@ -141,9 +141,19 @@ def render_image(request, path_text, full_path, special=None):
|
|||||||
except Exception:
|
except Exception:
|
||||||
dir_text = ""
|
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:
|
if special is not None:
|
||||||
back_url = None
|
back_url = 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
|
back_thumb = None
|
||||||
else:
|
else:
|
||||||
back_url = gallery_url(
|
back_url = gallery_url(
|
||||||
|
|||||||
@@ -206,6 +206,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if not is_special %}
|
||||||
<div class="dropdown ms-auto">
|
<div class="dropdown ms-auto">
|
||||||
<button class="btn btn-sm btn-plain" type="button" data-bs-toggle="dropdown" aria-expanded="false" title="{{ sort_label }}" aria-label="Sort options">
|
<button class="btn btn-sm btn-plain" type="button" data-bs-toggle="dropdown" aria-expanded="false" title="{{ sort_label }}" aria-label="Sort options">
|
||||||
<i class="fa-solid fa-arrow-down-short-wide"></i>
|
<i class="fa-solid fa-arrow-down-short-wide"></i>
|
||||||
@@ -218,8 +219,10 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if not is_special %}
|
||||||
<noscript>
|
<noscript>
|
||||||
<div class="pt-2">
|
<div class="pt-2">
|
||||||
{% for option in sort_options %}
|
{% for option in sort_options %}
|
||||||
@@ -227,6 +230,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</noscript>
|
</noscript>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<section class="gallery-scroll flex-grow-1">
|
<section class="gallery-scroll flex-grow-1">
|
||||||
<div class="gallery-grid">
|
<div class="gallery-grid">
|
||||||
|
|||||||
@@ -205,13 +205,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="offcanvas-body pt-0 d-flex flex-column">
|
<div class="offcanvas-body pt-0 d-flex flex-column">
|
||||||
<a href="#" class="sidebar-link">Favorites</a>
|
<a href="/gallery/favorites/" class="sidebar-link {% if is_special and breadcrumbs.0.label == 'Favorites' %}active-sort{% endif %}">Favorites</a>
|
||||||
<a href="#" class="sidebar-link">Most visited</a>
|
<a href="/gallery/most-visited/" class="sidebar-link {% if is_special and breadcrumbs.0.label == 'Most Visited' %}active-sort{% endif %}">Most visited</a>
|
||||||
<a href="#" class="sidebar-link">Recently visited</a>
|
<a href="/gallery/recent/" class="sidebar-link {% if is_special and breadcrumbs.0.label == 'Recent' %}active-sort{% endif %}">Recently visited</a>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="sidebar-scroll flex-grow-1">
|
<div class="sidebar-scroll flex-grow-1">
|
||||||
|
{% if not is_special or is_special and 'favorites' in breadcrumbs.0.path %}
|
||||||
{% if prev_url %}
|
{% if prev_url %}
|
||||||
<a href="{{ prev_url }}" class="subdir-item">
|
<a href="{{ prev_url }}" class="subdir-item">
|
||||||
{% if prev_thumb %}
|
{% if prev_thumb %}
|
||||||
@@ -233,6 +234,7 @@
|
|||||||
<span>Next</span>
|
<span>Next</span>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if is_special %}
|
{% if is_special %}
|
||||||
<a href="{{ breadcrumbs.0.path }}" class="subdir-item">
|
<a href="{{ breadcrumbs.0.path }}" class="subdir-item">
|
||||||
|
|||||||
Reference in New Issue
Block a user