pcmt/templates/navbar.tmpl

93 lines
6.1 KiB
Go HTML Template
Raw Normal View History

<nav class="sticky top-0 md:pt-3 z-20 backdrop-blur-sm border-gray-200 dark:border-gray-700 md:mx-6">
2023-04-19 03:25:42 +02:00
<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>
2023-05-08 23:42:27 +02:00
<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">
2023-05-22 03:49:42 +02:00
<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 }}
{{ if .User.IsAdmin }}
<li>
2023-08-07 21:29:30 +02:00
{{- if or (pageIs .Current "manage-users") (pageIs .Current "manage-users-new") (pageIs .Current "manage-users-user-details") (pageIs .Current "manage-users-edit-user") (pageIs .Current "manage-users-delete-user") -}}
2023-05-22 03:22:58 +02:00
<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">
2023-06-02 20:00:14 +02:00
{{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>
{{- else -}}
<li>
{{- if or (pageIs .Current "hibp-search") -}}
<a href="/user/hibp-search" 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="/user/hibp-search" 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}}
Search HIBP
</a>
</li>
{{- end -}}
{{- end -}}
<li>
<a href="https://git.dotya.ml/mirre-mt/masters-thesis/" target="_blank" rel="noopener"
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 and .Data .Data.RegistrationAllowed }}
{{ 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>
{{end}}
{{end}}
{{ if or (not .User) (and .User (not .User.IsLoggedIn)) }}
<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>