Redesigned gallery view layout and added sorting tests
This commit is contained in:
@@ -1,176 +1,591 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, height=device-height" />
|
||||
<title>
|
||||
Folder: {{request.path}}
|
||||
</title>
|
||||
<link href="{% static 'css/styles.css' %}" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Gallery</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.0/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer">
|
||||
<style>
|
||||
:root {
|
||||
--radius: 14px;
|
||||
--sidebar-width: 284px;
|
||||
}
|
||||
|
||||
body.theme-dark {
|
||||
--bg: #24282d;
|
||||
--panel: #2e333a;
|
||||
--panel-strong: #3a4048;
|
||||
--text: #ecf0f4;
|
||||
--muted: #c6ced8;
|
||||
--line: #606973;
|
||||
--accent: #91adc4;
|
||||
--input-bg: #252a30;
|
||||
}
|
||||
|
||||
body.theme-light {
|
||||
--bg: #d8dadc;
|
||||
--panel: #f2f2f2;
|
||||
--panel-strong: #ffffff;
|
||||
--text: #1e2f40;
|
||||
--muted: #3b4a57;
|
||||
--line: #7c8894;
|
||||
--accent: #32506a;
|
||||
--input-bg: #f8fafb;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
.app-shell {
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
gap: 24px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: var(--sidebar-width);
|
||||
flex: 0 0 var(--sidebar-width);
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
padding: 10px;
|
||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.28);
|
||||
}
|
||||
|
||||
.sidebar hr {
|
||||
border-color: var(--line);
|
||||
opacity: 0.85;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.user-row {
|
||||
background: var(--panel-strong);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
min-height: 42px;
|
||||
padding: 0 8px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
color: var(--text);
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.sidebar-link {
|
||||
color: var(--text);
|
||||
display: block;
|
||||
padding: 2px 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.sidebar-link:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.sidebar-scroll {
|
||||
overflow-y: auto;
|
||||
min-height: 120px;
|
||||
}
|
||||
|
||||
.subdir-item {
|
||||
color: var(--text);
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
padding: 6px 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.subdir-item:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.subdir-thumb {
|
||||
width: 70px;
|
||||
height: 45px;
|
||||
object-fit: cover;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 6px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.subdir-fallback {
|
||||
width: 70px;
|
||||
height: 45px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--accent);
|
||||
font-size: 34px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.main-area {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.top-bar {
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
min-height: 44px;
|
||||
padding: 4px 10px;
|
||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.22);
|
||||
}
|
||||
|
||||
.breadcrumb-wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.crumb-link {
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
font-size: 15px;
|
||||
max-width: 240px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.crumb-link:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.crumb-sep {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.gallery-scroll {
|
||||
overflow-y: auto;
|
||||
min-height: 0;
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
.gallery-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(128px, 128px));
|
||||
justify-content: space-between;
|
||||
column-gap: 24px;
|
||||
row-gap: 24px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.thumb-card {
|
||||
width: 128px;
|
||||
display: block;
|
||||
border-radius: 14px;
|
||||
overflow: hidden;
|
||||
text-decoration: none;
|
||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
.thumb-card img,
|
||||
.thumb-fallback {
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
object-fit: cover;
|
||||
border-radius: 14px;
|
||||
display: block;
|
||||
border: 2px solid rgba(0, 0, 0, 0.18);
|
||||
filter: brightness(1);
|
||||
transition: filter 0.25s ease;
|
||||
}
|
||||
|
||||
.thumb-fallback {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--accent);
|
||||
font-size: 44px;
|
||||
background: var(--panel-strong);
|
||||
}
|
||||
|
||||
.thumb-card:hover img,
|
||||
.thumb-card:hover .thumb-fallback {
|
||||
filter: brightness(1.25);
|
||||
}
|
||||
|
||||
.search-input,
|
||||
.search-input:focus {
|
||||
background: var(--input-bg);
|
||||
color: var(--text);
|
||||
border-color: var(--line);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.search-input::placeholder {
|
||||
color: var(--muted);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.search-input::-webkit-input-placeholder {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.search-input::-moz-placeholder {
|
||||
color: var(--muted);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.search-addon {
|
||||
background: var(--input-bg);
|
||||
color: var(--muted);
|
||||
border-color: var(--line);
|
||||
}
|
||||
|
||||
.btn-plain {
|
||||
color: var(--text);
|
||||
border: 1px solid var(--line);
|
||||
background: var(--panel-strong);
|
||||
}
|
||||
|
||||
.btn-plain:hover {
|
||||
color: var(--accent);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.offcanvas {
|
||||
background: var(--panel);
|
||||
color: var(--text);
|
||||
width: var(--sidebar-width) !important;
|
||||
}
|
||||
|
||||
.offcanvas .sidebar {
|
||||
width: 100%;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.sort-menu {
|
||||
max-height: 220px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.sort-menu .dropdown-item {
|
||||
color: #1e2f40;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.sort-menu .dropdown-item.active-sort {
|
||||
text-decoration: underline;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
@media (max-width: 991.98px) {
|
||||
.app-shell {
|
||||
padding: 12px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.offcanvas {
|
||||
width: 100vw !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 575.98px) {
|
||||
.gallery-grid {
|
||||
grid-template-columns: 1fr;
|
||||
justify-content: stretch;
|
||||
}
|
||||
|
||||
.thumb-card {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.crumb-link {
|
||||
max-width: 130px;
|
||||
}
|
||||
}
|
||||
|
||||
@supports not (display: grid) {
|
||||
.gallery-grid {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.thumb-card {
|
||||
display: inline-block;
|
||||
margin: 0 24px 24px 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<noscript>
|
||||
<style>
|
||||
.offcanvas,
|
||||
.sidebar-toggle,
|
||||
.sidebar-close {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.noscript-sidebar {
|
||||
display: block !important;
|
||||
margin-bottom: 12px;
|
||||
width: 100% !important;
|
||||
flex: 0 0 auto !important;
|
||||
}
|
||||
</style>
|
||||
</noscript>
|
||||
</head>
|
||||
|
||||
<body class="background">
|
||||
<!-- Navigation bar. -->
|
||||
<table class="fc mauto">
|
||||
<tr>
|
||||
<!-- Home button. -->
|
||||
<td>
|
||||
<a href="/gallery/" class="mr-2">
|
||||
<img src="{% static 'imgs/gohome.png' %}" class="small-nav-icon">
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<!-- Back button. -->
|
||||
{% if not search %}
|
||||
<td>
|
||||
<a href=".." class="mr-2">
|
||||
<img src="{% static 'imgs/back.png' %}" class="small-nav-icon">
|
||||
</a>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
<!-- Directory path. -->
|
||||
<td>
|
||||
<h1 class="mr-2">
|
||||
{% if not search %}
|
||||
{{request.path}} - Files: {{num_files}}
|
||||
<body class="theme-{{ theme }}">
|
||||
<div class="app-shell d-flex">
|
||||
<aside class="sidebar d-none d-lg-flex flex-column">
|
||||
<div class="d-flex align-items-center user-row">
|
||||
<span><i class="fa-solid fa-circle-user fa-lg"></i></span>
|
||||
<span class="user-name text-truncate">{{ request.user.username }}</span>
|
||||
<a class="btn btn-sm btn-plain ms-auto" href="{{ theme_toggle_url }}" aria-label="Toggle theme">
|
||||
{% if theme == 'dark' %}
|
||||
<i class="fa-solid fa-sun"></i>
|
||||
{% else %}
|
||||
Search: {{search_text}} - Files: {{num_files}}
|
||||
<i class="fa-solid fa-moon"></i>
|
||||
{% endif %}
|
||||
</h1>
|
||||
</td>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Page links. -->
|
||||
{% if num_pages > 1 %}
|
||||
<td>
|
||||
<div class="mauto mr-2">
|
||||
{% for page in pages %}<a href="./?page={{page}}{%if search %}&{{search}}{% endif %}">{{page}}</a>{% if not forloop.last %}<span> </span>{% endif %}{% endfor %}
|
||||
<hr>
|
||||
|
||||
<form action="{{ search_action_url }}" method="get">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="search" name="search" class="form-control search-input" placeholder="Search..." value="{{ search_text }}">
|
||||
<span class="input-group-text search-addon"><i class="fa-solid fa-magnifying-glass"></i></span>
|
||||
</div>
|
||||
</td>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<a href="#" class="sidebar-link">Favorites</a>
|
||||
<a href="#" class="sidebar-link">Most visited</a>
|
||||
<a href="#" class="sidebar-link">Recently visited</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="sidebar-scroll flex-grow-1">
|
||||
{% for subdir in subdirs %}
|
||||
<a href="{{ subdir.path }}" class="subdir-item">
|
||||
{% if subdir.thumbnail %}
|
||||
<img src="{{ subdir.thumbnail }}" alt="{{ subdir.name }}" class="subdir-thumb">
|
||||
{% else %}
|
||||
<span class="subdir-fallback"><i class="fa-solid fa-image"></i></span>
|
||||
{% endif %}
|
||||
<span>{{ subdir.name|truncatechars:30 }}</span>
|
||||
</a>
|
||||
{% empty %}
|
||||
<small class="text-secondary">No subdirectories</small>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form method="post" action="{% url 'logout' %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-sm btn-plain w-100">
|
||||
<i class="fa-solid fa-arrow-up-from-bracket"></i>
|
||||
<span class="ms-1">Logout</span>
|
||||
</button>
|
||||
</form>
|
||||
</aside>
|
||||
|
||||
<div class="noscript-sidebar sidebar d-lg-none" style="display:none;">
|
||||
<div class="d-flex align-items-center user-row">
|
||||
<span><i class="fa-solid fa-circle-user fa-lg"></i></span>
|
||||
<span class="user-name text-truncate">{{ request.user.username }}</span>
|
||||
<a class="btn btn-sm btn-plain ms-auto" href="{{ theme_toggle_url }}" aria-label="Toggle theme">
|
||||
{% if theme == 'dark' %}
|
||||
<i class="fa-solid fa-sun"></i>
|
||||
{% else %}
|
||||
<i class="fa-solid fa-moon"></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form action="{{ search_action_url }}" method="get">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="search" name="search" class="form-control search-input" placeholder="Search..." value="{{ search_text }}">
|
||||
<span class="input-group-text search-addon"><i class="fa-solid fa-magnifying-glass"></i></span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<a href="#" class="sidebar-link">Favorites</a>
|
||||
<a href="#" class="sidebar-link">Most visited</a>
|
||||
<a href="#" class="sidebar-link">Recently visited</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="sidebar-scroll" style="max-height: 200px;">
|
||||
{% for subdir in subdirs %}
|
||||
<a href="{{ subdir.path }}" class="subdir-item">
|
||||
{% if subdir.thumbnail %}
|
||||
<img src="{{ subdir.thumbnail }}" alt="{{ subdir.name }}" class="subdir-thumb">
|
||||
{% else %}
|
||||
<span class="subdir-fallback"><i class="fa-solid fa-image"></i></span>
|
||||
{% endif %}
|
||||
<span>{{ subdir.name|truncatechars:30 }}</span>
|
||||
</a>
|
||||
{% empty %}
|
||||
<small class="text-secondary">No subdirectories</small>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form method="post" action="{% url 'logout' %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-sm btn-plain w-100">
|
||||
<i class="fa-solid fa-arrow-up-from-bracket"></i>
|
||||
<span class="ms-1">Logout</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<main class="main-area d-flex flex-column flex-grow-1">
|
||||
<div class="top-bar d-flex align-items-center gap-2">
|
||||
<button class="btn btn-sm btn-plain sidebar-toggle d-lg-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebarOffcanvas" aria-controls="sidebarOffcanvas" aria-label="Open menu">
|
||||
<i class="fa-solid fa-bars"></i>
|
||||
</button>
|
||||
|
||||
<div class="breadcrumb-wrap flex-grow-1">
|
||||
{% for crumb in breadcrumbs %}
|
||||
{% if not forloop.first %}
|
||||
<span class="crumb-sep">/</span>
|
||||
{% endif %}
|
||||
<a href="{{ crumb.path }}" class="crumb-link">{{ crumb.label|truncatechars:45 }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<i class="fa-solid fa-arrow-down-short-wide"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end sort-menu">
|
||||
{% for option in sort_options %}
|
||||
<li>
|
||||
<a class="dropdown-item {% if option.is_active %}active-sort{% endif %}" href="{{ option.url }}">{{ option.label }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<noscript>
|
||||
<div class="pt-2">
|
||||
{% for option in sort_options %}
|
||||
<a href="{{ option.url }}" class="me-3 {% if option.is_active %}text-decoration-underline{% endif %}">{{ option.label }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<section class="gallery-scroll flex-grow-1">
|
||||
<div class="gallery-grid">
|
||||
{% for image in images %}
|
||||
<a href="{{ image.path }}" class="thumb-card">
|
||||
{% if image.thumbnail %}
|
||||
<img src="{{ image.thumbnail }}" alt="{{ image.name }}">
|
||||
{% else %}
|
||||
<div class="thumb-fallback"><i class="fa-solid fa-image"></i></div>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% empty %}
|
||||
<p class="mb-0">No images found.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div class="offcanvas offcanvas-start" tabindex="-1" id="sidebarOffcanvas" aria-labelledby="sidebarOffcanvasLabel">
|
||||
<div class="offcanvas-header pb-2">
|
||||
<h2 class="h6 mb-0" id="sidebarOffcanvasLabel">Gallery</h2>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<a class="btn btn-sm btn-plain" href="{{ theme_toggle_url }}" aria-label="Toggle theme">
|
||||
{% if theme == 'dark' %}
|
||||
<i class="fa-solid fa-sun"></i>
|
||||
{% else %}
|
||||
<i class="fa-solid fa-moon"></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
<button type="button" class="btn btn-sm btn-plain sidebar-close" data-bs-dismiss="offcanvas" aria-label="Close menu">
|
||||
<i class="fa-solid fa-xmark"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="offcanvas-body pt-0 d-flex flex-column">
|
||||
<aside class="sidebar d-flex flex-column">
|
||||
<div class="d-flex align-items-center user-row">
|
||||
<span><i class="fa-solid fa-circle-user fa-lg"></i></span>
|
||||
<span class="user-name text-truncate">{{ request.user.username }}</span>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form action="{{ search_action_url }}" method="get">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="search" name="search" class="form-control search-input" placeholder="Search..." value="{{ search_text }}">
|
||||
<span class="input-group-text search-addon"><i class="fa-solid fa-magnifying-glass"></i></span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<a href="#" class="sidebar-link">Favorites</a>
|
||||
<a href="#" class="sidebar-link">Most visited</a>
|
||||
<a href="#" class="sidebar-link">Recently visited</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="sidebar-scroll flex-grow-1">
|
||||
{% for subdir in subdirs %}
|
||||
<a href="{{ subdir.path }}" class="subdir-item">
|
||||
{% if subdir.thumbnail %}
|
||||
<img src="{{ subdir.thumbnail }}" alt="{{ subdir.name }}" class="subdir-thumb">
|
||||
{% else %}
|
||||
<span class="subdir-fallback"><i class="fa-solid fa-image"></i></span>
|
||||
{% endif %}
|
||||
<span>{{ subdir.name|truncatechars:30 }}</span>
|
||||
</a>
|
||||
{% empty %}
|
||||
<small class="text-secondary">No subdirectories</small>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- Logout button. -->
|
||||
<td>
|
||||
<form method="post" action="{% url 'logout' %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="clear-btn">
|
||||
<img src="{% static 'imgs/boot.png' %}" class="small-nav-icon">
|
||||
<button type="submit" class="btn btn-sm btn-plain w-100">
|
||||
<i class="fa-solid fa-arrow-up-from-bracket"></i>
|
||||
<span class="ms-1">Logout</span>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Search form. -->
|
||||
{% if not search %}
|
||||
<form action="{% url 'gallery_view_root' %}" method="GET">
|
||||
<table class="fc mauto">
|
||||
<tr>
|
||||
<!-- Search title. -->
|
||||
<td>
|
||||
<h3>
|
||||
Search:
|
||||
</h3>
|
||||
</td>
|
||||
|
||||
<!-- Search bar. -->
|
||||
<td>
|
||||
<input type="search" name="search" class="search-box">
|
||||
</td>
|
||||
|
||||
<!-- Search submit. -->
|
||||
<td>
|
||||
<button type="submit" class="clear-btn">
|
||||
<img src="{% static 'imgs/find.png' %}" class="small-nav-icon">
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<!-- Images in current directory. -->
|
||||
{% if images|length > 0 %}
|
||||
<table class="fc mauto">
|
||||
<tr>
|
||||
<!-- Previous page button. -->
|
||||
{% if page != 1 %}
|
||||
<td class="fc">
|
||||
<a href="./?page={{prev_page}}{%if search %}&{{search}}{% endif %}">
|
||||
<img src="{% static 'imgs/back.png' %}" class="navigation-icon">
|
||||
</a>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
<!-- Image rows. -->
|
||||
<td class="fc">
|
||||
<table class="mauto">
|
||||
<tbody>
|
||||
{% for row in images %}
|
||||
<tr>
|
||||
{% for image in row %}
|
||||
<td class="column">
|
||||
<a href="{{image.path}}">
|
||||
<!-- Thumbnail. -->
|
||||
<img src="{{image.thumbnail}}">
|
||||
|
||||
<br>
|
||||
|
||||
<!-- Image name. -->
|
||||
<span>
|
||||
{{image.name|truncatechars:15}}
|
||||
</span>
|
||||
</a>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<!-- Next page button. -->
|
||||
{% if page != num_pages %}
|
||||
<td class="fc">
|
||||
<a href="./?page={{next_page}}{%if search %}&{{search}}{% endif %}">
|
||||
<img src="{% static 'imgs/forward.png' %}" class="navigation-icon">
|
||||
</a>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if subdirs|length > 0 %}
|
||||
<!-- Sub-directories title. -->
|
||||
<div class="centered-container">
|
||||
<h1>
|
||||
Sub-directories
|
||||
</h1>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sub-directory rows. -->
|
||||
<div class="centered-container">
|
||||
<table class="mauto">
|
||||
<tbody>
|
||||
{% for row in subdirs %}
|
||||
<tr>
|
||||
{% for subdir in row %}
|
||||
<td class="column">
|
||||
<a href="{{subdir.path}}">
|
||||
<img src="{% static 'imgs/folder-pictures.png' %}">
|
||||
<br>
|
||||
<span>
|
||||
{{subdir.name}}
|
||||
</span>
|
||||
</a>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user