-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbase.html
95 lines (91 loc) · 4.46 KB
/
base.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% block head_content_tags %}
{% with title="Photo Gallery | Chris Mastris" description="A Django photo gallery website by Chris Mastris." %}
<title>{{ title }}</title>
<link rel="canonical" href="{{ absolute_root_url }}{{ request.path }}">
<meta name="description" content="{{ description }}">
<meta property="og:url" content="{{ absolute_root_url }}{{ request.path }}">
<meta property="og:type" content="website">
<meta property="og:title" content="{{ title }}">
<meta property="og:description" content="{{ description }}">
{% endwith %}
{% endblock %}
{% block robots %}{% endblock %}
<link rel="icon" href="{% static 'favicon.ico' %}">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg mb-5 bg-dark" data-bs-theme="dark">
<div class="container-fluid">
<a class="navbar-brand mb-0 me-lg-4 h1" href="{% url 'homepage' %}">Photo Gallery</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto mt-2 mt-lg-0">
{% for section in nav_sections %}
{# https://docs.djangoproject.com/en/4.2/topics/db/queries/#following-relationships-backward #}
{% if section.navlink_set.all|length > 1 %}
<li class="nav-item dropdown pb-1 pb-lg-0 px-lg-1">
<a class="nav-link dropdown-toggle" href="#" id="navbarSection{{ forloop.counter }}DropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ section.dropdown_label }}
</a>
<ul class="dropdown-menu" aria-labelledby="navbarSection{{ forloop.counter }}DropdownMenuLink">
{% for link in section.navlink_set.all|dictsort:"vertical_order" %}
{% if link.link_url == request.path %}
<li><a class="dropdown-item py-2 text-success" aria-current="page" href="{{ link.link_url }}">{{ link.link_text }}</a></li>
{% else %}
<li><a class="dropdown-item py-2" href="{{ link.link_url }}">{{ link.link_text }}</a></li>
{% endif %}
{% endfor %}
</ul>
</li>
{% else %}{# NavSection with a single NavLink (no dropdown) #}
{% with link=section.navlink_set.all.0 %}
<li class="nav-item pb-1 pb-lg-0 px-lg-1">
{% if link.link_url == request.path %}
<a class="nav-link active" aria-current="page" href="{{ link.link_url }}">{{ link.link_text }}</a>
{% else %}
<a class="nav-link" href="{{ link.link_url }}">{{ link.link_text }}</a>
{% endif %}
</li>
{% endwith %}
{% endif %}
{% endfor %}
</ul>
<form class="d-flex my-3 my-lg-0 me-lg-5" action="{% url 'search' %}" method="get" role="search" data-bs-theme="light">
<label class="visually-hidden" for="search-input">Search photos</label>
<input class="form-control rounded-0 border-secondary" id="search-input" type="search" name="query" placeholder="Search photos...">
<button class="btn btn-light rounded-0 border-secondary" type="submit">
<i class="bi bi-search"></i>
</button>
</form>
</div>
</div>
</nav>
</header>
<main>
{% block content %}{% endblock %}
</main>
<footer>
<div class="container-fluid mt-4 text-center text-secondary">
<hr>
<p class="py-2 fst-italic">View this project on
<a class="link-success"
href="https://github.com/Cmastris/django_photo_gallery"
target="_blank"
rel="noopener">GitHub</a>
</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>