This commit is contained in:
2024-06-01 16:00:14 -07:00
parent 8b2d298488
commit 635f2650e9
17 changed files with 283 additions and 40 deletions

View File

@@ -0,0 +1,12 @@
{{ block flashes() }}
{{ if len(Flashes) > 0 }}
<div class="space-y-4 my-8 mx-auto max-w-2xl">
{{ range Flashes }}
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded shadow-lg relative" role="alert">
<span class="block sm:inline">{{ . }}</span>
</div>
{{ end }}
</div>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,8 @@
{{ block footer() }}
<footer>
<p>Directory <a
href="https://git.eeqj.de/sneak/directory/commit/{{version}}"><code>{{
version }}</code></a></p>
</footer>
{{ end }}

12
assets/templates/html.jet Normal file
View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ block title() }}Default Title{{ end }}</title>
<link rel="stylesheet" href="/static/tailwind.v2.2.19.min.css">
</head>
<body>
{{ block body() . }}{{ end }}
</body>
</html>

View File

@@ -0,0 +1,13 @@
{{ extends "pagelayout.jet" }}
{{ block title() }}The Directory{{ end }}
{{ block pageContent() }}
<h2>Directory</h2>
<h3>Tags</h3>
<ul>
<li><a href="/tags/tag1">Tag1</a></li>
</ul>
{{ end }}

View File

@@ -0,0 +1,29 @@
{{ extends "pagelayout.jet" }}
{{ block pageContent() }}
<div class="flex items-center justify-center min-h-screen bg-gray-100">
<div class="bg-white p-8 rounded-lg shadow-lg w-full max-w-md mx-4">
<h2 class="text-2xl font-bold mb-6 text-center">Login</h2>
<form action="/login" method="post">
<div class="mb-4">
<label for="username" class="block text-gray-700">Username:</label>
<input type="text" id="username" name="username" required class="mt-1 w-full p-2 border border-gray-300 rounded">
</div>
<div class="mb-4">
<label for="password" class="block text-gray-700">Password:</label>
<input type="password" id="password" name="password" required class="mt-1 w-full p-2 border border-gray-300 rounded">
</div>
<div class="flex items-center justify-center">
<input type="submit" value="Login" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded cursor-pointer">
</div>
</form>
</div>
</div>
<style>
.min-h-screen {
min-height: calc(100vh - 4rem); /* Adjust based on navbar height */
}
</style>
{{ end }}

View File

@@ -0,0 +1,39 @@
{{ block navbar() }}
<nav class="bg-gray-100 border-b border-gray-300 fixed top-0 left-0 right-0 w-full z-50">
<div class="container mx-auto px-4 flex justify-between items-center h-16">
<ul class="flex space-x-4">
<li><a href="/" class="text-black hover:text-blue-500">Home</a></li>
<li><a href="/status" class="text-black hover:text-blue-500">Status</a></li>
</ul>
<div class="relative">
<input type="checkbox" id="dropdown-toggle" class="hidden">
<label for="dropdown-toggle" class="cursor-pointer p-2 border border-gray-300 rounded bg-white">&#9776;</label>
<ul class="absolute right-0 mt-2 w-48 bg-white border border-gray-300 rounded shadow-lg hidden">
{{ if isset("LoggedInUser") && LoggedInUser != nil }}
<li><a href="/users/{{LoggedInUser.ID}}" class="block px-4 py-2 text-black hover:bg-gray-100">Profile</a></li>
<li><a href="/logout" class="block px-4 py-2 text-black hover:bg-gray-100">Logout</a></li>
{{ if LoggedInUser.IsSuperAdmin() }}
<li><a href="/users/new" class="block px-4 py-2 text-black hover:bg-gray-100">Create User</a></li>
{{ end }}
<li class="block px-4 py-2 bg-gray-100 border-t border-gray-300">Welcome,
<a href="/users/{{LoggedInUser.ID}}"><code>{{ LoggedInUser.Username }}</code></a>
</li>
{{ else }}
<li><a href="/login" class="block px-4 py-2 text-black hover:bg-gray-100">Login</a></li>
{{ end }}
</ul>
</div>
</div>
</nav>
<style>
body, html {
margin: 0;
padding: 0;
}
#dropdown-toggle:checked + label + ul {
display: block;
}
</style>
{{ end }}

View File

@@ -0,0 +1,25 @@
{{ extends "html.jet" }}
{{ block body() . }}
<!-- pagelayout.jet -->
{{ include "navbar.jet" . }}
<div class="content">
{{ include "flashes.jet" . }}
{{ block pageContent() . }}default page content{{ end }}
</div>
{{ include "footer.jet" . }}
<style>
body, html {
margin: 0;
padding: 0;
}
.content {
margin-top: 4rem; /* Adjust this value based on your navbar height */
padding: 1em 0; /* Only top and bottom padding */
background-color: #f8f9fa; /* Ensure background color spans full width */
width: 100%; /* Ensure the content spans full width */
box-sizing: border-box; /* Include padding in the element's total width and height */
}
</style>
{{ end }}