diff options
Diffstat (limited to 'templates/navbar.qtpl')
-rw-r--r-- | templates/navbar.qtpl | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/templates/navbar.qtpl b/templates/navbar.qtpl index 636c619..8b0799d 100644 --- a/templates/navbar.qtpl +++ b/templates/navbar.qtpl @@ -8,8 +8,18 @@ const ( ) %} -{% func insertIfEqual(s, d Selection) %}{% if s == d %} selected{% endif %}{% endfunc %} +{% code +type GitSelection int +const ( + Readme GitSelection = iota + Log + Summary + Refs + Tree +) +%} +{% func insertIfEqual(s, d any) %}{% if s == d %} selected{% endif %}{% endfunc %} {% func Navbar (s Selection) %} <nav class="container navbar navbar-expand"> @@ -21,3 +31,23 @@ const ( </div> </nav> {% endfunc %} + +{% func GitItemNav (name string, s GitSelection) %} + <ul class="nav"> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Readme) %}" aria-current="page" href="/{%s name %}/about">about</a> + </li> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Log) %}" aria-current="page" href="/{%s name %}/log">log</a> + </li> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Summary) %}" aria-current="page" href="/{%s name %}/summary">summary</a> + </li> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Refs) %}" aria-current="page" href="/{%s name %}/refs">refs</a> + </li> + <li class="nav-item"> + <a class="nav-link{%= insertIfEqual(s, Tree) %}" aria-current="page" href="/{%s name %}/tree">tree</a> + </li> + </ul> +{% endfunc %} |