pcmt/templates/navbar.tmpl
surtur 81ca7d8ec1
All checks were successful
continuous-integration/drone/push Build is passing
go,tmpl: add a way to manage API keys [wip]
2023-08-05 22:13:43 +02:00

74 lines
5.1 KiB
Go HTML Template

<nav class="sticky top-0 md:pt-3 z-20 backdrop-blur-sm border-gray-200 dark:border-gray-700 mx-auto md:mx-6">
<div class="max-w-screen-3xl flex flex-wrap items-center justify-between mx-auto p-2">
<a href="/" class="flex items-center">
<img src="/static/img/logo-pcmt.svg" class="h-8 mr-3" alt="logo" />
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">pcmt</span>
</a>
<div class="group/navbar">
<button type="button" class="inline-flex items-center p-2 ml-2 text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" data-collapse-toggle="navbar">
<span class="sr-only">Main menu</span>
<svg aria-hidden="true" alt="main menu icon" viewBox="0 0 20 20" class="w-6 h-6 fill-current"><path fill-rule="evenodd" d="M3 5a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H4a1 1 0 0
1-1-1zm0 5a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1zm0 5a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H4a1 1 0 0
1-1-1z"/></svg>
</span>
</button>
<div class="hidden group-hover/navbar:block fixed md:static z-50 right-[3.2rem] top-2 overflow-y-auto max-w-10 md:block md:w-auto" id="navbar">
<ul class="flex flex-col items-center font-medium p-4 md:p-0 mt-2 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 md:mt-0 md:border-0 dark:bg-gray-800 md:bg-transparent dark:border-gray-700">
<li>
{{ if pageIs .Current "home" }}
<a href={{if and .User .User.IsLoggedIn }}"/home"{{else}}"/"{{end}} class="block py-2 pl-3 pr-4 text-white bg-blue-500 rounded md:bg-transparent md:text-blue-700 md:p-0 md:dark:text-blue-500 dark:bg-blue-500 md:dark:bg-transparent" aria-current="page">
{{ else }}
<a href={{if and .User .User.IsLoggedIn }}"/home"{{else}}"/"{{end}} class="block py-2 pl-3 pr-4 text-gray-900 rounded hover:bg-gray-300 md:hover:bg-transparent md:border-0 md:hover:text-blue-500 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">
{{ end }}
Home
</a>
</li>
{{ if and .User .User.IsLoggedIn }}
<li>
{{- if or (pageIs .Current "manage-users") (pageIs .Current "manage-users-new") (pageIs .Current "manage-users-user-details") (pageIs .Current "manage-users-edit-user") -}}
<a href="/manage/users" class="block py-2 pl-3 pr-4 text-white bg-blue-500 rounded md:bg-transparent md:text-blue-700 md:p-0 md:dark:text-blue-500 dark:bg-blue-500 md:dark:bg-transparent" aria-current="page">
{{else}}
<a href="/manage/users" class="block py-2 pl-3 pr-4 text-gray-900 rounded hover:bg-gray-300 md:hover:bg-transparent md:border-0 md:hover:text-blue-500 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">
{{end}}
User management
</a>
</li>
<li>
{{ if pageIs .Current "api-keys" }}
<a href="/manage/api-keys" class="block py-2 pl-3 pr-4 text-white bg-blue-500 rounded md:bg-transparent md:text-blue-700 md:p-0 md:dark:text-blue-500 dark:bg-blue-500 md:dark:bg-transparent" aria-current="page">
{{ else }}
<a href="/manage/api-keys" class="block py-2 pl-3 pr-4 text-gray-900 rounded hover:bg-gray-300 md:hover:bg-transparent md:border-0 md:hover:text-blue-500 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">
{{ end }}
API keys
</a>
</li>
{{end}}
<li>
<a href="#" class="block py-2 pl-3 pr-4 text-gray-900 rounded hover:bg-gray-300 md:hover:bg-transparent md:border-0 md:hover:text-blue-500 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">About</a>
</li>
{{ if or (not .User) (and .User (not .User.IsLoggedIn)) }}
<li>
{{ if pageIs .Current "signup" }}
<a href="/signup" class="block py-2 pl-3 pr-4 text-white bg-blue-500 rounded md:bg-transparent md:text-blue-700 md:p-0 md:dark:text-blue-500 dark:bg-blue-500 md:dark:bg-transparent" aria-current="page">
{{ else }}
<a href="/signup" class="block py-2 pl-3 pr-4 text-gray-900 rounded hover:bg-gray-200 md:hover:bg-transparent md:border-0 md:hover:text-blue-500 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">
{{ end }}
Register
</a>
</li>
<li>
{{ if pageIs .Current "signin" }}
<a href="/signin" class="block py-2 pl-3 pr-4 text-white bg-blue-500 rounded md:bg-transparent md:text-blue-700 md:p-0 md:dark:text-blue-500 dark:bg-blue-500 md:dark:bg-transparent" aria-current="page">
{{ else }}
<a href="/signin" class="block py-2 pl-3 pr-4 text-gray-900 rounded hover:bg-gray-200 md:hover:bg-transparent md:border-0 md:hover:text-blue-500 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">
{{ end }}
Sign in
</a>
</li>
{{end}}
</ul>
</div>
</div>
</div>
</nav>