diff options
author | Alexey Terentyev <axifnx@gmail.com> | 2021-09-29 05:59:37 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-09-29 22:30:54 +0200 |
commit | d4c35f3c3157bece8e50fd95f2ee1081be30d7ae (patch) | |
tree | 84394299e816a49413657a506a0b912d27192c04 /themes/sourcehut | |
parent | 1988b2a15860c21da7d2f57aa2e8fae2108b81c8 (diff) | |
download | alps-d4c35f3c3157bece8e50fd95f2ee1081be30d7ae.tar.gz alps-d4c35f3c3157bece8e50fd95f2ee1081be30d7ae.zip |
sourcehut theme: show only loaded plugin links and and mark current active plugin name
Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
Diffstat (limited to 'themes/sourcehut')
-rw-r--r-- | themes/sourcehut/nav.html | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/themes/sourcehut/nav.html b/themes/sourcehut/nav.html index 687dfd8..ce9fb2b 100644 --- a/themes/sourcehut/nav.html +++ b/themes/sourcehut/nav.html @@ -1,29 +1,44 @@ <nav class="container-fluid navbar navbar-light navbar-expand-sm"> - <!-- TODO: show active plugin name --> <a class="navbar-brand" href="/"> alps <span class="text-danger">mail</span> </a> - {{if .LoggedIn}} + {{ if .LoggedIn }} + {{ $page := (index .Path 0) }} <ul class="navbar-nav mr-auto d-none d-sm-flex"> - <li class="nav-item active"> + <li class="nav-item + {{ if or (eq $page "mailbox") (eq $page "message") (eq $page "compose") }} + active + {{ end }} + "> <a href="/" class="nav-link">mail</a> </li> - <!-- TODO: only show these links if plugins are loaded --> - <li class="nav-item"> + {{ if call .HavePlugin "carddav" }} + <li class="nav-item + {{ if eq $page "contacts" }} + active + {{ end }} + "> <a href="/contacts" class="nav-link">contacts</a> </li> - <li class="nav-item"> + {{ end }} + {{ if call .HavePlugin "caldav" }} + <li class="nav-item + {{ if eq $page "calendar" }} + active + {{ end }} + "> <a href="/calendar" class="nav-link">calendar</a> </li> + {{ end }} </ul> <div class="login"> <span class="navbar-text"> - Logged in as {{.Username}} — + Logged in as {{ .Username }} — <a href="/settings">Settings</a> — <a href="/logout">Log out</a> </span> </div> - {{end}} + {{ end }} </nav> |