Add 'active' class to active nav item

This commit is contained in:
Denis Arh
2021-03-06 16:45:22 +01:00
parent 782ea71c87
commit 34a58d3410
5 changed files with 8 additions and 9 deletions
@@ -1,4 +1,4 @@
{{ template "inc_header.html.tpl" . }}
{{ template "inc_header.html.tpl" set . "activeNav" "clients" }}
<div class="card-body p-0">
{{ template "inc_alerts.html.tpl" .alerts }}
<h4 class="card-title p-3 border-bottom">Authorized clients</h4>
@@ -1,4 +1,4 @@
{{ template "inc_header.html.tpl" . }}
{{ template "inc_header.html.tpl" set . "activeNav" "security" }}
<div class="card-body p-0">
{{ template "inc_alerts.html.tpl" .alerts }}
<h4 class="card-title p-3 border-bottom">Change your password</h4>
+4 -5
View File
@@ -15,20 +15,19 @@
</div>
{{ else if .user }}
<ul class="nav ml-1 d-flex justify-content-around">
{{/* @TO-DO Denis -- apply active class to selected nav item */}}
<li class="nav-item active">
<li class="nav-item {{ if eq .activeNav "profile" }}active{{ end }}">
<a class="nav-link" href="{{ links.Profile }}">Your profile</a>
</li>
{{ if .settings.LocalEnabled }}
<li class="nav-item">
<li class="nav-item {{ if eq .activeNav "security" }}active{{ end }}">
<a class="nav-link" href="{{ links.ChangePassword }}">Security</a>
</li>
{{ end }}
<li class="nav-item">
<li class="nav-item {{ if eq .activeNav "sessions" }}active{{ end }}">
<a class="nav-link" href="{{ links.Sessions }}">Login sessions</a>
</li>
{{ if .settings.ExternalEnabled }}
<li class="nav-item">
<li class="nav-item {{ if eq .activeNav "clients" }}active{{ end }}">
<a class="nav-link" href="{{ links.AuthorizedClients }}">Authorized clients</a>
</li>
{{ end }}
+1 -1
View File
@@ -1,4 +1,4 @@
{{ template "inc_header.html.tpl" . }}
{{ template "inc_header.html.tpl" set . "activeNav" "profile" }}
<div class="card-body p-0">
{{ template "inc_alerts.html.tpl" .alerts }}
<h4 class="card-title p-3 border-bottom">Your profile</h4>
+1 -1
View File
@@ -1,4 +1,4 @@
{{ template "inc_header.html.tpl" . }}
{{ template "inc_header.html.tpl" set . "activeNav" "sessions" }}
<div class="card-body p-0">
{{ template "inc_alerts.html.tpl" .alerts }}
<div class="card-title p-3 border-bottom">