guestbook/ui/html/partials/nav.tmpl.html

23 lines
631 B
HTML
Raw Permalink Normal View History

2024-10-16 04:34:57 +00:00
{{ define "nav" }}
<nav>
2024-11-11 19:55:01 +00:00
<div>
2024-10-16 04:34:57 +00:00
<a href="/">Home</a>
<a href="/users">Users</a>
2024-11-11 19:55:01 +00:00
</div>
<div>
{{ if .IsAuthenticated }}
{{ with .User }}
<a href="/users/{{ .User.ShortId }}">{{ .User.Username }}</a>
{{ end }}
<form action="/users/logout" method="post">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<button>Logout</button>
</form>
{{ else }}
<a href="/users/register">Register</a>
<a href="/users/login">Login</a>
{{ end }}
</div>
2024-10-16 04:34:57 +00:00
</nav>
{{ end }}