blob: 8b0799d412ad6da105a309a921cfd8a14a51f99b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
{% code
type Selection int
const (
Git Selection = iota
List
About
Config
)
%}
{% 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">
<div class="navbar-nav">
<a class="nav-link{%= insertIfEqual(s, Git) %}" href="/">git</a>
<a class="nav-link{%= insertIfEqual(s, List) %}" href="/list">list</a>
<a class="nav-link{%= insertIfEqual(s, About) %}" href="/about">about</a>
<a class="nav-link{%= insertIfEqual(s, Config) %}" href="/config">config</a>
</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 %}
|