aboutsummaryrefslogtreecommitdiff
path: root/templates/navbar.qtpl
diff options
context:
space:
mode:
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>