FossilRepo

Add public nav for anonymous users: branded header, Explore link, Sign in button

lmata 2026-04-07 18:41 trunk
Commit 20d32590ff7f85d8275c435691bb9d05588d5e95379957e2fb5db98b7513dd07
--- templates/base.html
+++ templates/base.html
@@ -127,10 +127,12 @@
127127
</head>
128128
<body class="h-full bg-gray-950 text-gray-100" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
129129
<div class="min-h-full flex flex-col" x-data="{ mobileSidebar: false }">
130130
{% if user.is_authenticated %}
131131
{% include "includes/nav.html" %}
132
+ {% else %}
133
+ {% include "includes/nav_public.html" %}
132134
{% endif %}
133135
134136
<div class="flex flex-1 overflow-hidden">
135137
{% if user.is_authenticated %}
136138
<!-- Mobile sidebar overlay -->
@@ -143,11 +145,11 @@
143145
</div>
144146
<!-- Desktop sidebar -->
145147
{% include "includes/sidebar.html" %}
146148
{% endif %}
147149
148
- <main class="flex-1 overflow-y-auto {% if user.is_authenticated %}py-6{% endif %}">
150
+ <main class="flex-1 overflow-y-auto py-6">
149151
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
150152
{% if messages %}
151153
<div id="messages" class="mb-4 space-y-2">
152154
{% for message in messages %}
153155
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
154156
155157
ADDED templates/includes/nav_public.html
--- templates/base.html
+++ templates/base.html
@@ -127,10 +127,12 @@
127 </head>
128 <body class="h-full bg-gray-950 text-gray-100" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
129 <div class="min-h-full flex flex-col" x-data="{ mobileSidebar: false }">
130 {% if user.is_authenticated %}
131 {% include "includes/nav.html" %}
 
 
132 {% endif %}
133
134 <div class="flex flex-1 overflow-hidden">
135 {% if user.is_authenticated %}
136 <!-- Mobile sidebar overlay -->
@@ -143,11 +145,11 @@
143 </div>
144 <!-- Desktop sidebar -->
145 {% include "includes/sidebar.html" %}
146 {% endif %}
147
148 <main class="flex-1 overflow-y-auto {% if user.is_authenticated %}py-6{% endif %}">
149 <div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
150 {% if messages %}
151 <div id="messages" class="mb-4 space-y-2">
152 {% for message in messages %}
153 <div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
154
155 DDED templates/includes/nav_public.html
--- templates/base.html
+++ templates/base.html
@@ -127,10 +127,12 @@
127 </head>
128 <body class="h-full bg-gray-950 text-gray-100" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
129 <div class="min-h-full flex flex-col" x-data="{ mobileSidebar: false }">
130 {% if user.is_authenticated %}
131 {% include "includes/nav.html" %}
132 {% else %}
133 {% include "includes/nav_public.html" %}
134 {% endif %}
135
136 <div class="flex flex-1 overflow-hidden">
137 {% if user.is_authenticated %}
138 <!-- Mobile sidebar overlay -->
@@ -143,11 +145,11 @@
145 </div>
146 <!-- Desktop sidebar -->
147 {% include "includes/sidebar.html" %}
148 {% endif %}
149
150 <main class="flex-1 overflow-y-auto py-6">
151 <div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
152 {% if messages %}
153 <div id="messages" class="mb-4 space-y-2">
154 {% for message in messages %}
155 <div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
156
157 DDED templates/includes/nav_public.html
--- a/templates/includes/nav_public.html
+++ b/templates/includes/nav_public.html
@@ -0,0 +1,26 @@
1
+<nav class="bg-gray-900 border-b border-gray-700">
2
+ <div class="px-4 sm:px-6 lg:px-8">
3
+ <div class="flex h-14 items-center justify-between">
4
+ <div class="flex items-center gap-6">
5
+ <a href="/" class="flex items-center gap-2">
6
+ <svg class="h-6 w-6 text-brand" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
7
+ <circle cx="12" cy="12" r="10" stroke-opacity="0.6"/>
8
+ <circle cx="12" cy="12" r="4" fill="currentColor" fill-opacity="0.3"/>
9
+ <path d="M12 2v4M12 18v4M2 12h4M18 12h4" stroke-opacity="0.4"/>
10
+ </svg>
11
+ <span class="text-sm font-bold tracking-tight">
12
+ <span class="text-gray-100">fossil</span><span class="text-brand">repo</span>
13
+ </span>
14
+ </a>
15
+ <div class="hidden sm:flex items-center gap-4">
16
+ <a href="{% url 'explore' %}" class="text-sm text-gray-400 hover:text-white transition-colors {% if request.path == '/explore/' %}text-white{% endif %}">Explore</a>
17
+ </div>
18
+ </div>
19
+ <div class="flex items-center gap-3">
20
+ <a href="{% url 'accounts:login' %}" class="rounded-md bg-gray-800 px-3 py-1.5 text-sm font-medium text-gray-300 hover:bg-gray-700 hover:text-white ring-1 ring-gray-700 transition-colors">
21
+ Sign in
22
+ </a>
23
+ </div>
24
+ </div>
25
+ </div>
26
+</nav>
--- a/templates/includes/nav_public.html
+++ b/templates/includes/nav_public.html
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/templates/includes/nav_public.html
+++ b/templates/includes/nav_public.html
@@ -0,0 +1,26 @@
1 <nav class="bg-gray-900 border-b border-gray-700">
2 <div class="px-4 sm:px-6 lg:px-8">
3 <div class="flex h-14 items-center justify-between">
4 <div class="flex items-center gap-6">
5 <a href="/" class="flex items-center gap-2">
6 <svg class="h-6 w-6 text-brand" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
7 <circle cx="12" cy="12" r="10" stroke-opacity="0.6"/>
8 <circle cx="12" cy="12" r="4" fill="currentColor" fill-opacity="0.3"/>
9 <path d="M12 2v4M12 18v4M2 12h4M18 12h4" stroke-opacity="0.4"/>
10 </svg>
11 <span class="text-sm font-bold tracking-tight">
12 <span class="text-gray-100">fossil</span><span class="text-brand">repo</span>
13 </span>
14 </a>
15 <div class="hidden sm:flex items-center gap-4">
16 <a href="{% url 'explore' %}" class="text-sm text-gray-400 hover:text-white transition-colors {% if request.path == '/explore/' %}text-white{% endif %}">Explore</a>
17 </div>
18 </div>
19 <div class="flex items-center gap-3">
20 <a href="{% url 'accounts:login' %}" class="rounded-md bg-gray-800 px-3 py-1.5 text-sm font-medium text-gray-300 hover:bg-gray-700 hover:text-white ring-1 ring-gray-700 transition-colors">
21 Sign in
22 </a>
23 </div>
24 </div>
25 </div>
26 </nav>

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button