Files
MiauInv/frontend/htmx/contents/dash/base.html

80 lines
2.6 KiB
HTML

{{ define "base.html" }}
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ .Title }} | MiauInv</title>
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
<link rel="stylesheet" href="/assets/css/theme.css">
<link rel="stylesheet" href="/assets/css/dashboard.css">
</head>
<body>
<header>
<div class="nav-container">
<div class="nav-left">
<div class="brand">Miau<span>Inv</span></div>
<button class="menu-trigger" id="menu-btn" aria-label="Menu">Menu</button>
<nav id="main-nav">
<a href="/dashboard">Dashboard</a>
<a href="/inventory">Inventory</a>
<a href="/projects">Projects</a>
<a href="/locations">Locations</a>
</nav>
</div>
<div class="profile-dropdown">
<button class="profile-trigger" id="profile-btn">
<div class="avatar">M</div>
</button>
<div class="dropdown-menu" id="dropdown-menu">
<a href="/profile/settings">Account Settings</a>
<a href="/profile/activity">Activity Log</a>
<hr class="dropdown-divider">
<button class="logout-btn"
hx-post="/api/logout"
hx-on::after-request="window.location.href='/login'">
Log Out
</button>
</div>
</div>
</div>
</header>
<main>
{{ template "content" . }}
</main>
<script>
const profileBtn = document.getElementById('profile-btn');
const dropdownMenu = document.getElementById('dropdown-menu');
const menuBtn = document.getElementById('menu-btn');
const mainNav = document.getElementById('main-nav');
// Profil-Menü Toggle
profileBtn.addEventListener('click', (e) => {
e.stopPropagation();
dropdownMenu.classList.toggle('show');
mainNav.classList.remove('show'); // Mobile Nav schließen
});
// Mobile Nav Toggle
menuBtn.addEventListener('click', (e) => {
console.log("Button wurde geklickt!"); // Wird das im Browser angezeigt?
e.stopPropagation();
e.preventDefault(); // Verhindert Standard-Browser-Aktionen
mainNav.classList.toggle('show');
dropdownMenu.classList.remove('show');
});
// Alles schließen bei Klick in den Body
window.addEventListener('click', () => {
dropdownMenu.classList.remove('show');
mainNav.classList.remove('show');
});
</script>
</body>
</html>
{{ end }}