aboutsummaryrefslogtreecommitdiff
path: root/templates/nav.html
blob: 82f07140830eba821ac90e8c53eb4bfcbc79b7c7 (plain) (blame)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{{/*
   cgit's own header markup, rendered in place of the one noheader=1 turns off,
   so that both kinds of page carry the same header and it can name the account.
*/}}
{{define "header"}}
<table id="header">
<tr>
<td class="logo" rowspan="2"><a href="/"><img src="{{.Logo}}" alt="home"></a></td>
<td class="main">
{{if .Repo}}<a href="/">{{.Site}}</a> : <a href="/{{.Repo.Path}}/">{{.Repo.Path}}</a>
{{else}}<a href="/">{{.Site}}</a>{{end}}
</td>
<td class="form">
{{if .User}}
{{if or .Admin .MustEnrol}}<a href="/admin">admin</a>{{end}}
<a href="/settings">{{.User}}</a>
<form method="post" action="/logout">
<input type="hidden" name="csrf" value="{{.CSRF}}">
<button type="submit" class="link">sign out</button>
</form>
{{else}}
<a href="/login">sign in</a>
{{end}}
</td>
</tr>
<tr><td class="sub">{{if .Repo}}{{.Repo.Desc}}{{else}}{{.Desc}}{{end}}</td></tr>
</table>
{{end}}

{{/* The forge's sections, in cgit's tab markup. */}}
{{define "tabs"}}{{with .Repo}}{{if .Issues}}<a href="/{{.Path}}/issues"{{if eq $.Repo.Active "issues"}} class="active"{{end}}>issues</a>{{end}}{{if .Wiki}}<a href="/{{.Path}}/wiki"{{if eq $.Repo.Active "wiki"}} class="active"{{end}}>wiki</a>{{end}}{{if .Settings}}<a href="/{{.Path}}/settings"{{if eq $.Repo.Active "settings"}} class="active"{{end}}>settings</a>{{end}}{{end}}{{end}}

{{/*
   cgit's row copied, for the forge's own pages where cgit renders nothing: the
   same tabs in the same order, and the same search cell.
*/}}
{{define "tabrow"}}{{with .Repo}}
<table class="tabs"><tr><td>
<a href="/{{.Path}}/about/">about</a><a href="/{{.Path}}/">summary</a><a href="/{{.Path}}/refs/">refs</a><a href="/{{.Path}}/log/">log</a><a href="/{{.Path}}/tree/">tree</a><a href="/{{.Path}}/commit/">commit</a><a href="/{{.Path}}/diff/">diff</a>{{template "tabs" $}}</td>
<td class="form"><form class="right" method="get" action="/{{.Path}}/log/">
<select name="qt">
<option value="grep">log msg</option>
<option value="author">author</option>
<option value="committer">committer</option>
<option value="range">range</option>
</select>
<input class="txt" type="search" size="10" name="q" value="">
<input type="submit" value="search">
</form>
</td></tr></table>
{{end}}{{end}}

{{/*
   In the layout because every page is parsed as its own set, and a partial
   defined in one page is invisible to the next.
*/}}
{{define "who"}}{{if .}}<img class="avatar" src="/avatar/{{.}}" alt=""> {{.}}{{else}}<span class="dim">nobody</span>{{end}}{{end}}

{{/*
   One fragment for both the create form and the settings form, so that the two
   cannot drift apart on what members and users mean.
*/}}
{{define "knobs"}}
<fieldset>
<legend>Who may read it</legend>
<label class="choice" for="v-private">
<input id="v-private" type="radio" name="visibility" value="private" {{if eq .Visibility "private"}}checked{{end}}>
<strong>private</strong> <span class="dim">accounts holding a grant on it, and global admins</span>
</label>
<label class="choice" for="v-public">
<input id="v-public" type="radio" name="visibility" value="public" {{if eq .Visibility "public"}}checked{{end}}>
<strong>public</strong> <span class="dim">anybody, including visitors who are not signed in</span>
</label>
</fieldset>

<fieldset>
<legend>Who may file issues</legend>
<label class="choice" for="i-disabled">
<input id="i-disabled" type="radio" name="issues" value="disabled" {{if eq .Issues "disabled"}}checked{{end}}>
<strong>disabled</strong> <span class="dim">nobody, and the tab is hidden</span>
</label>
<label class="choice" for="i-members">
<input id="i-members" type="radio" name="issues" value="members" {{if eq .Issues "members"}}checked{{end}}>
<strong>members</strong> <span class="dim">anybody holding a grant here, even a read grant</span>
</label>
<label class="choice" for="i-users">
<input id="i-users" type="radio" name="issues" value="users" {{if eq .Issues "users"}}checked{{end}}>
<strong>users</strong> <span class="dim">any signed in account. Public repositories only</span>
</label>
</fieldset>

<fieldset>
<legend>Who may edit the wiki</legend>
<label class="choice" for="w-disabled">
<input id="w-disabled" type="radio" name="wiki" value="disabled" {{if eq .Wiki "disabled"}}checked{{end}}>
<strong>disabled</strong> <span class="dim">nobody, and the tab is hidden</span>
</label>
<label class="choice" for="w-members">
<input id="w-members" type="radio" name="wiki" value="members" {{if eq .Wiki "members"}}checked{{end}}>
<strong>members</strong> <span class="dim">anybody holding a grant here</span>
</label>
<label class="choice" for="w-users">
<input id="w-users" type="radio" name="wiki" value="users" {{if eq .Wiki "users"}}checked{{end}}>
<strong>users</strong> <span class="dim">any signed in account. Public repositories only</span>
</label>
</fieldset>
<p class="dim">
Reading is visibility's job alone. The other two say who may write, so a
repository can take bug reports and documentation fixes from people who will
never push code. users on a private repository is refused rather than coerced.
</p>
{{end}}