aboutsummaryrefslogtreecommitdiff
path: root/templates/navbar.qtpl
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-12-11 17:05:12 +0100
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-12-11 17:05:12 +0100
commit1e45ae2ea3497958b2ea6a20137955cfc3bbc964 (patch)
tree00af0e28864d79d7a9cbb8b693aff1b397b1a949 /templates/navbar.qtpl
parente6ded0d01117c592ec124f3e02d6c89eeafec382 (diff)
downloadcerrado-1e45ae2ea3497958b2ea6a20137955cfc3bbc964.tar.gz
cerrado-1e45ae2ea3497958b2ea6a20137955cfc3bbc964.tar.bz2
cerrado-1e45ae2ea3497958b2ea6a20137955cfc3bbc964.zip
feat: Add UI/Handler login process
It adds the whole workflow to store and handle login on both UI and handler level. With that the login information should be available at any point given the context.
Diffstat (limited to 'templates/navbar.qtpl')
-rw-r--r--templates/navbar.qtpl8
1 files changed, 7 insertions, 1 deletions
diff --git a/templates/navbar.qtpl b/templates/navbar.qtpl
index 18400b1..3cd1b39 100644
--- a/templates/navbar.qtpl
+++ b/templates/navbar.qtpl
@@ -1,3 +1,5 @@
+{% import "context" %}
+
{% code
type Selection int
const (
@@ -22,13 +24,17 @@ const (
{% func insertIfEqual(s, d any) %}{% if s == d %} selected{% endif %}{% endfunc %}
-{% func Navbar (s Selection) %}
+{% func Navbar (ctx context.Context, s Selection) %}
<nav class="container navbar navbar-expand">
<div class="navbar-nav">
<a class="nav-link{%= insertIfEqual(s, Git) %}" href="/">git</a>
</div>
<div class="navbar-nav ms-auto">
+ {% if IsLoggedIn(ctx) %}
+ <a class="nav-link{%= insertIfEqual(s, Login) %}" href="/logout">logout</a>
+ {% else %}
<a class="nav-link{%= insertIfEqual(s, Login) %}" href="/login">login</a>
+ {% endif %}
{% comment %}
Add this back once needed
<a class="nav-link{%= insertIfEqual(s, List) %}" href="/list/">list</a>