blob: 86141811781819433a83922bfa797b03958b9656 (
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
54
55
56
57
58
59
60
61
62
63
|
{% 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>
{% comment %}
Add this back once needed
<a class="nav-link{%= insertIfEqual(s, List) %}" href="/list/">list</a>
{% endcomment %}
{% comment %}
Add this back if needed
<a class="nav-link{%= insertIfEqual(s, About) %}" href="/about/">about</a>
{% endcomment %}
</div>
</nav>
{% endfunc %}
{% func GitItemNav (name, ref string, s GitSelection) %}
<div class="row">
<h3 id="name">{%s name %} {% if ref != "" && (s == Log || s == Tree) %}@ {%s ref %}{% endif %}</h3>
</div>
<div class="row">
<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, Summary) %}" aria-current="page" href="/{%s name %}/">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, Log) %}" aria-current="page" href="/{%s name %}/log/{%s ref %}/">log</a>
</li>
<li class="nav-item">
<a class="nav-link{%= insertIfEqual(s, Tree) %}" aria-current="page" href="/{%s name %}/tree/{%s ref %}/">tree</a>
</li>
</ul>
</div>
{% endfunc %}
|