diff options
Diffstat (limited to 'templates/nav.html')
| -rw-r--r-- | templates/nav.html | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/templates/nav.html b/templates/nav.html new file mode 100644 index 0000000..82f0714 --- /dev/null +++ b/templates/nav.html @@ -0,0 +1,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}} |