internal/web/templates/layout.html

6521399c1c78577eb00f1bcf8947c0900b9cb62e
gitbay/internal/web/templates/layout.html

365 lines · 33509 bytes

  1{{define "layout"}}<!DOCTYPE html>
  2<html lang="en"{{with field . "Theme"}} data-theme="{{.}}"{{end}}>
  3<head>
  4<meta charset="utf-8">
  5<meta name="viewport" content="width=device-width, initial-scale=1">
  6<title>{{template "title" .}}</title>
  7<link rel="stylesheet" href="/static/style.css?v={{styleVersion}}">
  8<script src="/static/app.js?v={{scriptVersion}}" defer></script>
  9<link rel="icon" href="/favicon.svg" type="image/svg+xml">
 10<meta name="theme-color" content="#000000">
 11{{with field . "Feed"}}<link rel="alternate" type="application/atom+xml" href="{{.}}">
 12{{end}}</head>
 13<body>
 14<a class="skip" href="#content">Skip to content</a>
 15<div class="shell">
 16
 17<nav class="rail" aria-label="Site">
 18  <a class="brand" href="/" aria-label="{{.Site}} home"{{if eq (str . "Tab") "dashboard"}} aria-current="page"{{end}}>{{template "mark"}}<span class="brandname" aria-hidden="true">{{.Site}}</span><span class="vh">{{.Site}}</span></a>
 19  {{$items := railOptItems .}}
 20  <ul class="raillist">
 21    <li>{{template "raillink" dict "Href" "/explore" "Icon" "compass" "Name" "Explore" "Label" "Explore" "Current" (eq (str . "Tab") "explore")}}</li>
 22    {{if .Viewer}}<li class="railpins-item"><details class="railpins">
 23      <summary class="railicon raildrop-trigger" aria-label="Pinned repositories" title="Pinned repositories">{{template "icon" "bookmark"}}<span class="raillabel" aria-hidden="true">Pinned</span><span class="railcaret" aria-hidden="true">▾</span><span class="vh">Pinned repositories</span></summary>
 24      <div class="raildrop">
 25        {{range .Rail.Pins}}<a href="/{{.Owner}}/{{.Name}}">{{.Owner}}/{{.Name}}</a>{{else}}<span class="none">No pinned repos</span>{{end}}
 26        <hr class="railsep">
 27        <a href="/{{.Viewer}}/-/repositories">All repositories →</a>
 28      </div>
 29    </details></li>{{end}}
 30    <li class="railsearch-mob">{{template "raillink" dict "Href" "/search" "Icon" "search" "Name" "Search" "Current" (eq (str . "Tab") "sitesearch")}}</li>
 31  </ul>
 32  <form method="get" action="/search" class="railsearch" role="search">
 33    <input type="search" name="q" aria-label="Search repositories, issues, and merge requests" placeholder="Search repositories, issues, MRs…">
 34    <button type="button" class="cmdk-trigger" aria-label="Open command palette" title="Jump to… (⌘K)"><kbd>⌘K</kbd></button>
 35  </form>
 36  <span class="railgap"></span>
 37  <div class="railfoot">
 38    <button type="button" class="railicon kbhelp-trigger" aria-label="Keyboard shortcuts" title="Keyboard shortcuts (?)">{{template "icon" "kbd"}}<span class="vh">Keyboard shortcuts</span></button>
 39    {{if .Viewer}}
 40    <details class="railcreate">
 41      <summary class="railicon raildrop-trigger" aria-label="Create new" title="Create new">{{template "icon" "plus"}}<span class="railcaret" aria-hidden="true">▾</span><span class="vh">Create new</span></summary>
 42      <div class="raildrop">
 43        <a href="/new#create">{{template "icon" "plus"}} New repository</a>
 44        <a href="/new#import">{{template "icon" "file"}} Import repository</a>
 45        <a href="/new#org">{{template "icon" "person"}} New organization</a>
 46        <a href="/{{.Viewer}}/-/snippets/new">{{template "icon" "snippet"}} New snippet</a>
 47      </div>
 48    </details>
 49    {{template "raillink" dict "Href" "/notifications" "Icon" "bell" "Name" "Notifications" "Current" (eq (str . "Tab") "notifications") "Count" .Rail.Unread}}
 50    <details class="railusermenu">
 51      <summary class="railavatar" aria-label="Account menu" title="{{.Viewer}}"><span class="avatar">{{initial .Viewer}}</span><span class="railcaret" aria-hidden="true">▾</span></summary>
 52      <div class="raildrop">
 53        <a class="railuser" href="/{{.Viewer}}">{{template "icon" "person"}} <span><strong>{{.Viewer}}</strong></span></a>
 54        <a href="/{{.Viewer}}/-/repositories">{{template "icon" "folder"}} Your repositories</a>
 55        <a href="/{{.Viewer}}/-/snippets">{{template "icon" "snippet"}} Your snippets</a>
 56        <a href="/{{.Viewer}}/-/queries">{{template "icon" "query"}} Saved queries</a>
 57        <a href="/{{.Viewer}}/-/bookmarks">{{template "icon" "star"}} Bookmarks</a>
 58        {{if .Rail.Pins}}<div class="railpins-mob"><hr class="railsep">{{range .Rail.Pins}}<a href="/{{.Owner}}/{{.Name}}">{{template "icon" "pin"}} {{.Owner}}/{{.Name}}</a>{{end}}</div>{{end}}
 59        <hr class="railsep">
 60        {{$settings := index $items 1}}<a{{if $settings.Current}} aria-current="page"{{end}} href="{{$settings.Href}}">{{template "icon" $settings.Icon}} {{$settings.Name}}</a>
 61        {{$admin := index $items 2}}{{if $admin.Show}}<a{{if $admin.Current}} aria-current="page"{{end}} href="{{$admin.Href}}">{{template "icon" $admin.Icon}} {{$admin.Name}}</a>{{end}}
 62        <hr class="railsep">
 63        {{$logout := index $items 3}}<a href="{{$logout.Href}}">{{template "icon" $logout.Icon}} {{$logout.Name}}</a>
 64      </div>
 65    </details>
 66    {{else}}<a class="railicon" href="/login" aria-label="Sign in" title="Sign in">{{template "icon" "person"}}<span class="raillabel" aria-hidden="true">Sign in</span><span class="vh">Sign in</span></a>{{end}}
 67  </div>
 68</nav>
 69
 70<div class="pane">
 71{{with field . "Repo"}}
 72<header class="repohead">
 73<div class="wrap">
 74  {{$top := topTab (str $ "Tab")}}
 75  <div class="identity" data-repo="{{.OwnerName}}/{{.Name}}" data-ref="{{or (str $ "Ref") .DefaultBranch}}">
 76    {{if field $ "RepoHome"}}<h1 class="repotitle"><a class="owner" href="/{{.OwnerName}}">{{.OwnerName}}</a><span class="sep">/</span>{{.Name}}</h1>
 77    {{else}}<p class="repotitle"><a class="owner" href="/{{.OwnerName}}">{{.OwnerName}}</a><span class="sep">/</span><a href="/{{.OwnerName}}/{{.Name}}">{{.Name}}</a></p>{{end}}
 78    {{if eq .Visibility "private"}}<span class="chip">Private</span>{{end}}
 79    {{if .Settings.Archived}}<span class="chip">Archived</span>{{end}}
 80    {{/* Description, topics and website belong to the code tab, inline
 81         with the name so the header is two rows on every page. */}}
 82    {{if eq $top "code"}}{{if or (field $ "Desc") (field $ "Topics") $.Repo.Settings.Website}}<p class="repodesc">{{with field $ "Desc"}}{{.}}{{end}} {{with field $ "Topics"}}{{range .}}<a class="chip topic" href="/explore?q={{.}}">{{.}}</a> {{end}}{{end}}{{with $.Repo.Settings.Website}}<a class="site" href="{{.}}" rel="nofollow">{{.}}</a>{{end}}</p>{{end}}{{end}}
 83    <span class="grow"></span>
 84    {{if $.Viewer}}<form method="post" action="/{{.OwnerName}}/{{.Name}}/pin" class="inline"><button type="submit" class="btn" aria-pressed="{{if field $ "Pinned"}}true{{else}}false{{end}}" title="Pinned repositories show on your dashboard"><span aria-hidden="true">{{template "icon" "pin"}}</span> {{if field $ "Pinned"}}Pinned{{else}}Pin{{end}}</button></form>
 85    <div class="splitbtn"><form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><button type="submit" class="btn" aria-pressed="{{if ne (str $ "Watch") ""}}true{{else}}false{{end}}" title="{{if eq (str $ "Watch") "watching"}}Watching: every issue, request and build. Click to mute.{{else if eq (str $ "Watch") "muted"}}Muted: nothing from this repository. Click to stop muting.{{else}}Only what involves you. Click to watch everything.{{end}}"><span class="btnicon" aria-hidden="true">{{template "icon" "eye"}}</span>{{if eq (str $ "Watch") "watching"}}Watching{{else if eq (str $ "Watch") "muted"}}Muted{{else}}Watch{{end}}</button></form><details class="popover watchpop"><summary class="button btn splitcaret" aria-label="Choose notification level">▾</summary><div class="popmenu">
 86      <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><input type="hidden" name="mode" value="default"><button type="submit" class="watchopt" aria-pressed="{{if eq (str $ "Watch") ""}}true{{else}}false{{end}}"><b>Participating</b><span>Only threads and mentions that involve you.</span></button></form>
 87      <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><input type="hidden" name="mode" value="watching"><button type="submit" class="watchopt" aria-pressed="{{if eq (str $ "Watch") "watching"}}true{{else}}false{{end}}"><b>Watching</b><span>Every issue, merge request, and build.</span></button></form>
 88      <form method="post" action="/{{.OwnerName}}/{{.Name}}/watch" class="inline"><input type="hidden" name="mode" value="muted"><button type="submit" class="watchopt" aria-pressed="{{if eq (str $ "Watch") "muted"}}true{{else}}false{{end}}"><b>Muted</b><span>Silence all alerts from this repository.</span></button></form>
 89    </div></details></div>
 90    <form method="post" action="/{{.OwnerName}}/{{.Name}}/bookmark" class="inline"><button type="submit" class="btn" aria-pressed="{{if field $ "Marked"}}true{{else}}false{{end}}" title="Bookmarked lists it under Bookmarks">{{template "icon" "star"}} {{if field $ "Marked"}}Bookmarked{{else}}Bookmark{{end}}{{with field $ "Bookmarks"}}{{if .}} <i class="btncount">{{.}}</i>{{end}}{{end}}</button></form>
 91    <a class="button btn" href="/{{.OwnerName}}/{{.Name}}/fork">{{template "icon" "fork"}} Fork{{with field $ "Forks"}}{{if .}} <i class="btncount">{{.}}</i>{{end}}{{end}}</a>{{end}}
 92  </div>
 93  {{if eq $top "code"}}{{if field $ "Mirrors"}}<p class="repometa">{{range $i, $m := field $ "Mirrors"}}{{if $i}} · {{end}}{{if eq $m.Direction "push"}}mirrors to{{else}}mirrors from{{end}} <a href="{{$m.URL}}" rel="nofollow">{{$m.Target}}</a>{{if $m.Error}}, <span class="bad">sync error: {{$m.Error}}</span>{{else if $m.Synced}}, synced {{$m.Synced}}{{end}}{{end}}</p>{{end}}{{end}}
 94  {{/* A tab's own count badge is omitted at zero (an empty <i> reads as
 95       stray punctuation next to the tab word); the dashboard pin row's
 96       count chip always shows its number, zero included, the same as
 97       every other count chip in the app. Two elements, two rules,
 98       decided once here (#270). */}}
 99  <nav class="tabs" aria-label="Repository">
100    <a {{if eq $top "code"}}aria-current="page" {{end}}href="/{{.OwnerName}}/{{.Name}}">Code</a>
101    <a {{if eq $top "issues"}}aria-current="page" {{end}}href="/{{.OwnerName}}/{{.Name}}/issues">Issues{{with field $ "OpenIssues"}}{{if .}} <i>{{.}}</i>{{end}}{{end}}</a>
102    <a {{if eq $top "mrs"}}aria-current="page" {{end}}href="/{{.OwnerName}}/{{.Name}}/mrs">Merge requests{{with field $ "OpenMRs"}}{{if .}} <i>{{.}}</i>{{end}}{{end}}</a>
103    <a {{if eq $top "builds"}}aria-current="page" {{end}}href="/{{.OwnerName}}/{{.Name}}/builds">Builds</a>
104    <a {{if eq $top "releases"}}aria-current="page" {{end}}href="/{{.OwnerName}}/{{.Name}}/releases">Releases</a>
105    {{if field $ "HasWiki"}}<a {{if eq $top "wiki"}}aria-current="page" {{end}}href="/{{.OwnerName}}/{{.Name}}/wiki">Wiki</a>{{end}}
106    {{if field $ "CanAdmin"}}<a {{if eq $top "settings"}}aria-current="page" {{end}}href="/{{.OwnerName}}/{{.Name}}/settings">Settings</a>{{end}}
107  </nav>
108</div>
109</header>
110{{end}}
111
112<main id="content" class="content {{template "width" .}}">
113{{template "content" .}}
114</main>
115
116<footer>
117  <p>Powered by <a href="https://gitbay.org/krz/gitbay">gitbay</a> · <a href="https://apps.apple.com/us/app/gitbay/id6806399095">iOS app</a> · <a href="/privacy">Privacy</a>{{with field . "TermsURL"}} · <a href="{{.}}">Terms</a>{{end}}{{with field . "AbuseURL"}} · <a href="{{.}}">Report abuse</a>{{end}}</p>
118</footer>
119</div>
120</div>
121<dialog id="cmdk" class="cmdk" aria-label="Jump to">
122  <div class="cmdk-box">
123    <input type="search" aria-label="Filter destinations" placeholder="Jump to repository, file, issue, MR, or page…">
124    <ul class="cmdk-list"></ul>
125  </div>
126</dialog>
127<dialog id="kbhelp" class="cmdk kbhelp" aria-label="Keyboard shortcuts">
128  <div class="kbhelp-head">
129    <strong>Keyboard shortcuts</strong>
130    <button type="button" class="linklike kbhelp-close">Close</button>
131  </div>
132  <div class="kbhelp-grid">
133    <div>
134      <h2 class="colhead">Global</h2>
135      <dl class="kblist">
136        <div><dt><kbd>⌘K</kbd></dt><dd>Command palette &amp; jump</dd></div>
137        <div><dt><kbd>/</kbd></dt><dd>Focus search</dd></div>
138        <div><dt><kbd>?</kbd></dt><dd>Show this help</dd></div>
139        <div><dt><kbd>g</kbd> <kbd>d</kbd></dt><dd>Dashboard</dd></div>
140        <div><dt><kbd>g</kbd> <kbd>e</kbd></dt><dd>Explore repositories</dd></div>
141        <div><dt><kbd>g</kbd> <kbd>n</kbd></dt><dd>Notifications</dd></div>
142      </dl>
143    </div>
144    <div>
145      <h2 class="colhead">Repository &amp; editor</h2>
146      <dl class="kblist">
147        <div><dt><kbd>t</kbd></dt><dd>Find file in repository</dd></div>
148        <div><dt><kbd>y</kbd></dt><dd>Copy immutable SHA permalink</dd></div>
149        <div><dt><kbd>g</kbd> <kbd>c</kbd></dt><dd>Code tab</dd></div>
150        <div><dt><kbd>g</kbd> <kbd>i</kbd></dt><dd>Issues tab</dd></div>
151        <div><dt><kbd>g</kbd> <kbd>m</kbd></dt><dd>Merge requests tab</dd></div>
152        <div><dt><kbd>g</kbd> <kbd>b</kbd></dt><dd>Builds tab</dd></div>
153        <div><dt><kbd>⌘↵</kbd></dt><dd>Submit active form</dd></div>
154      </dl>
155    </div>
156  </div>
157</dialog>
158</body>
159</html>{{end}}
160
161{{/* icon draws one 16px glyph for the rail. The argument names it. The
162     paths are stroked with currentColor, so a link's own colour and the
163     current marker carry through, and every one is hidden from the
164     accessibility tree — the link around it carries the name. */}}
165{{define "icon"}}<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
166{{- if eq . "home"}}<path d="M2.25 7 8 2.5 13.75 7v6.25a.5.5 0 0 1-.5.5H2.75a.5.5 0 0 1-.5-.5Z"/><path d="M6.25 13.75V9.25h3.5v4.5"/>
167{{- else if eq . "search"}}<circle cx="6.75" cy="6.75" r="4.25"/><path d="m9.9 9.9 3.6 3.6"/>
168{{- else if eq . "bell"}}<path d="M4.25 7a3.75 3.75 0 0 1 7.5 0v2.25l1.25 2.25H3l1.25-2.25Z"/><path d="M6.5 11.5a1.5 1.5 0 0 0 3 0"/>
169{{- else if eq . "bookmark"}}<path d="M4 2.75h8v11L8 10.5l-4 3.25Z"/>
170{{- else if eq . "compass"}}<circle cx="8" cy="8" r="6"/><path d="m10.5 5.5-1.25 3.75-3.75 1.25 1.25-3.75Z"/>
171{{- else if eq . "plus"}}<path d="M8 3.25v9.5M3.25 8h9.5"/>
172{{- else if eq . "gear"}}<path d="M6.63 1.13L9.37 1.13L9.51 3.02L10.45 3.41L11.89 2.18L13.82 4.11L12.59 5.55L12.98 6.49L14.87 6.63L14.87 9.37L12.98 9.51L12.59 10.45L13.82 11.89L11.89 13.82L10.45 12.59L9.51 12.98L9.37 14.87L6.63 14.87L6.49 12.98L5.55 12.59L4.11 13.82L2.18 11.89L3.41 10.45L3.02 9.51L1.13 9.37L1.13 6.63L3.02 6.49L3.41 5.55L2.18 4.11L4.11 2.18L5.55 3.41L6.49 3.02Z"/><circle cx="8" cy="8" r="2.2"/>
173{{- else if eq . "shield"}}<path d="M8 1.75 13 3.5v4.25c0 3.1-2 5.4-5 6.5-3-1.1-5-3.4-5-6.5V3.5Z"/><path d="m5.9 7.75 1.6 1.6 2.85-3.1"/>
174{{- else if eq . "signout"}}<path d="M6.5 2.25H3.25a1 1 0 0 0-1 1v9.5a1 1 0 0 0 1 1H6.5"/><path d="M7.75 8h6M11.25 5.5 13.75 8l-2.5 2.5"/>
175{{- else if eq . "ellipsis"}}<circle cx="3.25" cy="8" r="1.1" fill="currentColor" stroke="none"/><circle cx="8" cy="8" r="1.1" fill="currentColor" stroke="none"/><circle cx="12.75" cy="8" r="1.1" fill="currentColor" stroke="none"/>
176{{- else if eq . "snippet"}}<path d="M3.25 2.75h6L12.75 6v7.25a.5.5 0 0 1-.5.5H3.75a.5.5 0 0 1-.5-.5Z"/><path d="M9 2.75V6h3.75"/><path d="m6.75 8.75-1.5 1.5 1.5 1.5M9.75 8.75l1.5 1.5-1.5 1.5"/>
177{{- else if eq . "person"}}<circle cx="8" cy="5.5" r="2.75"/><path d="M2.75 14a5.25 5.25 0 0 1 10.5 0"/>
178{{- else if eq . "folder"}}<path d="M1.75 3.25h4l1.5 1.75h6.5v7.5a.5.5 0 0 1-.5.5H2.25a.5.5 0 0 1-.5-.5Z"/>
179{{- else if eq . "file"}}<path d="M3.25 2.75h6L12.75 6v7.25a.5.5 0 0 1-.5.5H3.75a.5.5 0 0 1-.5-.5Z"/><path d="M9 2.75V6h3.75"/>
180{{- else if eq . "pin"}}<path d="m9.5 2.25 4.25 4.25-1.75 1.25-.75 3-4.5-4.5 3-.75Z"/><path d="M6.75 9.25 2.5 13.5"/>
181{{- else if eq . "star"}}<path d="m8 2 1.85 3.75 4.15.6-3 2.92.71 4.13L8 11.45 4.29 13.4 5 9.27 2 6.35l4.15-.6Z"/>
182{{- else if eq . "fork"}}<circle cx="5" cy="3.5" r="1.5"/><circle cx="11" cy="3.5" r="1.5"/><circle cx="8" cy="12.5" r="1.5"/><path d="M5 5v2a3 3 0 0 0 3 3m3-5v2a3 3 0 0 1-3 3m0 0v1"/>
183{{- else if eq . "eye"}}<path d="M1.5 8s2.5-4.5 6.5-4.5S14.5 8 14.5 8s-2.5 4.5-6.5 4.5S1.5 8 1.5 8Z"/><circle cx="8" cy="8" r="2"/>
184{{- else if eq . "query"}}<path d="M2.5 4.25h11M4.5 8h7M6.5 11.75h3"/>
185{{- else if eq . "kbd"}}<rect x="1.75" y="3.75" width="12.5" height="8.5" rx="1.5"/><path d="M4.5 6.75h.01M8 6.75h.01M11.5 6.75h.01M5 9.75h6"/>
186{{- end}}</svg>{{end}}
187
188{{/* raillink draws one square in the rail: the icon, the name for a
189     screen reader and in the tooltip, and the bell's unread badge. */}}
190{{define "raillink"}}<a class="railicon" {{if .Current}}aria-current="page" {{end}}href="{{.Href}}" aria-label="{{.Name}}" title="{{.Name}}">{{template "icon" .Icon}}{{with .Label}}<span class="raillabel" aria-hidden="true">{{.}}</span>{{end}}<span class="vh">{{.Name}}</span>{{with .Count}}<b class="count">{{.}}</b>{{end}}</a>{{end}}
191
192{{define "mark"}}<svg class="mark" width="19" height="19" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2.25 18.75 12H5.25z" fill="#ff6b3d"/><rect x="3" y="13.5" width="18" height="3" fill="currentColor"/><rect x="7.5" y="18" width="9" height="3" fill="currentColor"/></svg>{{end}}
193{{define "width"}}reading{{end}}
194
195{{define "reporow"}}<li>
196  <p class="reponame"><a class="name" href="/{{.OwnerName}}/{{.Name}}">{{.OwnerName}}<span class="sep">/</span><strong>{{.Name}}</strong></a>{{if or (eq .Visibility "private") .Archived}} <span class="labels">{{if eq .Visibility "private"}}<span class="chip">Private</span>{{end}}{{if .Archived}} <span class="chip">Archived</span>{{end}}</span>{{end}}</p>
197  {{if .Desc}}<p class="desc">{{.Desc}}</p>{{end}}
198  {{if .Topics}}<p class="topics">{{range .Topics}}<a class="chip topic" href="/explore?q={{.}}">{{.}}</a> {{end}}</p>{{end}}
199  <p class="meta"><span class="branch">{{template "branchicon"}} {{.DefaultBranch}}</span>{{if .License}}<span class="license">{{.License}}</span>{{end}}{{if .Updated}}<span class="updated">updated {{.Updated}}</span>{{end}}</p>
200</li>{{end}}
201
202{{define "refmenu"}}{{if .Branches}}<details class="refmenu">
203  <summary class="refchip">{{template "branchicon"}} {{.Ref}}</summary>
204  <div class="refdrop">
205  {{if gt (len .Branches) 5}}<input type="search" class="reffilter" placeholder="Filter branches…" aria-label="Filter branches" data-filter-links="refdrop">{{end}}
206  {{range .Branches}}<a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/{{$.RefKind}}/{{.Name}}/{{$.DirPath}}">{{.Name}}</a>
207  {{end}}<a class="allrefs" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/refs">All refs →</a>
208  </div>
209</details>{{else}}<span class="refchip">{{template "branchicon"}} {{.Ref}}</span>{{end}}{{end}}
210
211{{define "filenav"}}<nav class="filenav" aria-label="Files">
212  <h2 class="colhead">{{.Title}}</h2>
213  <ul>
214  {{with .Parent}}<li><a class="up" href="{{.}}">..</a></li>{{end}}
215  {{range .Entries}}<li><a{{if .Dir}} class="dir"{{end}}{{if .Current}} aria-current="page"{{end}} href="{{.URL}}">{{.Name}}</a></li>
216  {{end}}</ul>
217</nav>{{end}}
218
219{{/* Every side column's groups sit in a details.sidedrop. Below 62rem
220     that disclosure is what the reader sees of the column: one closed
221     line they open. Above it style.css hides the summary and shows the
222     content whatever the open state, so the column reads as it always
223     has (#237). The facet columns name the filters in force in the
224     summary; the section navs head with the word alone. */}}
225{{define "sidecol"}}<nav class="sidecol" aria-label="Filters">
226<details class="sidedrop">
227<summary><span class="sideword">Filters</span>{{range .}}{{range .Items}}{{if .Active}} <span class="sideon">{{.Label}}</span>{{end}}{{end}}{{end}}</summary>
228  {{range .}}{{if .Items}}<div class="grp{{if eq .Title "State"}} grp-state{{end}}">
229  <h2 class="colhead">{{.Title}}</h2>
230  <ul>{{range .Items}}<li><a{{if .Active}} aria-current="page"{{end}} href="{{.Href}}">{{.Label}}{{if .Count}} <i>{{.Count}}</i>{{end}}</a></li>{{end}}</ul>
231  </div>{{end}}{{end}}
232</details>
233</nav>{{end}}
234
235{{define "branchicon"}}<svg class="icon" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" fill="currentColor"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628a2.25 2.25 0 0 1-1.5-2.122ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM3.5 3.25a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"/></svg>{{end}}
236
237{{define "sigbadge"}}<span class="badge badge-{{.State}}" title="{{.Fingerprint}}">{{sigLabel .State}}{{if .Signer}} · {{.Signer}}{{end}}</span>{{end}}
238
239{{define "authorname"}}{{if .User}}<a class="authorlink" href="/{{.User}}" title="{{.Email}}">{{.Name}}</a>{{else}}<span title="{{.Email}}">{{.Name}}</span>{{end}}{{end}}
240
241{{/* formatpicker is the md/org choice on a body: issue and MR create.
242     The argument is the currently selected format; empty selects
243     Markdown, today's default. */}}
244{{define "formatpicker"}}<p class="branchpick">
245  <label for="format">Body markup</label>
246  <select id="format" name="format">
247    <option value="md"{{if ne . "org"}} selected{{end}}>Markdown</option>
248    <option value="org"{{if eq . "org"}} selected{{end}}>Org</option>
249  </select>
250</p>{{end}}
251
252{{/* previewbtn is the Preview submit beside a markup form's own submit.
253     It posts the form to its usual action, which renders the body and
254     hands the page back instead of writing (#235). */}}
255{{/* reactions is one item's reaction bar (reactionBar in httpd). A
256     signed-in viewer gets a button per reaction; anyone else the counts. */}}
257{{define "reactions"}}{{if .Items}}{{if .Signed}}<form method="post" action="{{.Action}}" class="reactions" data-react-slot="{{.Comment}}">{{if .Comment}}<input type="hidden" name="comment" value="{{.Comment}}">{{end}}
258{{range .Items}}<button type="submit" name="{{if .Me}}remove{{else}}add{{end}}" value="{{.Name}}" class="react{{if .Me}} mine{{end}}" aria-pressed="{{.Me}}" aria-label="{{.Label}}">{{.Emoji}}{{if .Count}} <span>{{.Count}}</span>{{end}}</button>
259{{end}}</form>{{else}}<p class="reactions">{{range .Items}}<span class="react" aria-label="{{.Label}}">{{.Emoji}} {{.Count}}</span> {{end}}</p>{{end}}{{end}}{{end}}
260
261{{define "previewbtn"}}<button type="submit" name="preview" value="1" class="btn">Preview</button>{{end}}
262
263{{/* previewblock shows a draft as it will read. The argument is the
264     rendered HTML; it sits above the textarea it came from. */}}
265{{define "previewblock"}}<div class="preview">
266  <p class="previewmark">Preview</p>
267  <div class="rendered">{{.}}</div>
268</div>{{end}}
269
270{{/* confirmfield is the typed-name check beside a destructive control.
271     The argument is the text the person must type. */}}
272{{define "confirmfield"}}<input type="text" name="confirm" aria-label="Type {{.}} to confirm" placeholder="type {{.}} to confirm" size="{{len .}}" autocomplete="off">{{end}}
273
274{{/* difffiles renders a parsed diff: one foldable section per file, with
275     line-number gutters and review threads inline. Base is the MR's
276     endpoint and Viewer the signed-in account; the commit page passes
277     neither and gets the same diff without review controls. */}}
278{{define "difffiles"}}{{$base := .Base}}{{$viewer := .Viewer}}{{$L := .L}}{{$repoPath := or .RepoPath ""}}{{$headSHA := or .HeadSHA ""}}{{$split := false}}{{with $L}}{{$split = .Split}}{{end}}
279{{with $L}}{{if .UnifiedURL}}<div class="diffbar"><p class="layoutpick">Layout: {{if .Split}}<a href="{{.UnifiedURL}}">unified</a> · <strong aria-current="true">split</strong>{{else}}<strong aria-current="true">unified</strong> · <a href="{{.SplitURL}}">split</a>{{end}}</p></div>{{end}}{{end}}
280<div class="diffwrap{{if gt (len .Files) 1}} diffgrid{{end}}"{{if $repoPath}} data-repo="{{$repoPath}}"{{end}}{{if $headSHA}} data-head="{{$headSHA}}"{{end}}>
281{{if gt (len .Files) 1}}<details class="difftoc" open>
282  <summary>Changed files ({{len .Files}})</summary>
283  {{if gt (len .Files) 5}}<input type="search" class="reffilter" placeholder="Filter changed files…" aria-label="Filter changed files" data-filter-links="difftoc">{{end}}
284  <ul class="difftoc-list">{{range $fi, $f := .Files}}<li data-toc-path="{{.Path}}"><a href="#f{{$fi}}">{{.Path}}</a>{{if ne .Status "modified"}} <span class="chip">{{.Status}}</span>{{end}}{{if .Threads}} <span class="chip chip-neutral" title="{{.Threads}} thread{{if ne .Threads 1}}s{{end}}">💬 {{.Threads}}</span>{{end}} <span class="fstat">{{if .Adds}}<span class="add">+{{.Adds}}</span>{{end}}{{if .Dels}} <span class="del">−{{.Dels}}</span>{{end}}</span></li>{{end}}</ul>
285</details>{{end}}
286<div class="difflist">
287{{range $fi, $f := .Files}}<details class="difffold" id="f{{$fi}}" data-file-path="{{.Path}}"{{if .Open}} open{{end}}>
288  <summary>
289    <span class="fpath">{{if eq .Status "renamed"}}<span class="was">{{.OldPath}} →</span> {{end}}{{.Path}}</span>
290    {{if ne .Status "modified"}}<span class="chip">{{.Status}}</span>{{end}}
291    {{if .Threads}}<span class="chip chip-neutral">{{.Threads}} thread{{if ne .Threads 1}}s{{end}}</span>{{end}}
292    <span class="fstat">{{if .Adds}}<span class="add">+{{.Adds}}</span>{{end}}{{if .Dels}} <span class="del">−{{.Dels}}</span>{{end}}{{if and $repoPath $headSHA (ne .Status "deleted")}} · <a class="diffviewlink" href="/{{$repoPath}}/blob/{{$headSHA}}/{{.Path}}">view</a>{{end}}</span>
293  </summary>
294  {{if .Binary}}<p class="none">Binary file not shown.</p>
295  {{else if $split}}<div class="tablewrap"><table class="difftable split"><colgroup><col class="cln"><col><col class="cln"><col></colgroup>
296  {{range .Rows}}{{if eq .Kind "hunk"}}<tr class="hunk" data-hunk="{{.Text}}" data-file="{{$f.Path}}"><td class="ln"></td><td class="src" colspan="3">{{.Text}}</td></tr>
297  {{else if eq .Kind "meta"}}<tr class="dmeta"><td class="ln"></td><td class="src" colspan="3">{{.Text}}</td></tr>
298  {{else}}{{$r := .}}<tr class="pair">
299    {{with .Old}}{{if eq .Class "del"}}<td class="ln del" id="f{{$fi}}-o{{.OldLine}}">{{template "cmtln" dict "N" .OldLine "Path" .Path "Side" "old" "Base" $base "Viewer" $viewer "Carry" $L.Carry}}</td><td class="src del chroma">{{if .Code}}{{.Code}}{{else}}{{.Content}}{{end}}{{with $r.OldNote}}<span class="nonl">{{.}}</span>{{end}}</td>{{else}}<td class="ln ctx old">{{.OldLine}}</td><td class="src ctx old chroma">{{if .Code}}{{.Code}}{{else}}{{.Content}}{{end}}{{with $r.OldNote}}<span class="nonl">{{.}}</span>{{end}}</td>{{end}}{{else}}<td class="ln none" aria-hidden="true"></td><td class="src none" aria-hidden="true"></td>{{end}}
300    {{with .New}}<td class="ln {{.Class}}" id="f{{$fi}}-n{{.NewLine}}">{{template "cmtln" dict "N" .NewLine "Path" .Path "Side" "new" "Base" $base "Viewer" $viewer "Carry" $L.Carry}}</td><td class="src {{.Class}} chroma">{{if .Code}}{{.Code}}{{else}}{{.Content}}{{end}}{{with $r.NewNote}}<span class="nonl">{{.}}</span>{{end}}</td>{{else}}<td class="ln none" aria-hidden="true"></td><td class="src none" aria-hidden="true"></td>{{end}}
301  </tr>
302  {{with .Compose}}<tr class="threadrow"><td colspan="4"><form id="compose" method="post" action="{{$base}}/diff-comment" class="thread composing">
303    <input type="hidden" name="path" value="{{.Path}}">
304    <input type="hidden" name="line" value="{{if eq .Class "del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
305    <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
306    {{if ne .Class "del"}}<p><label>From line <input type="number" name="start_line" min="1" max="{{.NewLine}}" placeholder="{{.NewLine}}"></label> to {{.NewLine}}; a <code>```suggestion</code> block proposes replacement lines</p>{{end}}
307    <p><textarea name="body" aria-label="Comment on {{.Path}}" rows="3" placeholder="Comment on this line" autofocus></textarea></p>
308    <p><button type="submit" class="btn">Comment</button>
309       <button type="submit" name="pending" value="on" class="btn">Add to review</button>
310       <a href="{{$base}}?view=diff{{if $L.Carry}}&amp;layout={{$L.Carry}}{{end}}">Cancel</a></p>
311  </form></td></tr>
312  {{end}}{{range .Threads}}<tr class="threadrow"><td colspan="4">{{template "thread" dict "T" . "Base" $base "Viewer" $viewer "Class" ""}}</td></tr>
313  {{end}}{{end}}{{end}}
314  </table></div>
315  {{else}}<div class="tablewrap"><table class="difftable">
316  {{range .Lines}}{{if eq .Class "hunk"}}<tr class="hunk" data-hunk="{{.Text}}" data-file="{{$f.Path}}"><td class="ln" colspan="2"></td><td class="src">{{.Text}}</td></tr>
317  {{else if eq .Class "meta"}}<tr class="dmeta"><td class="ln" colspan="2"></td><td class="src">{{.Text}}</td></tr>
318  {{else}}<tr class="{{.Class}}" id="f{{$fi}}-{{if eq .Class "del"}}o{{.OldLine}}{{else}}n{{.NewLine}}{{end}}"><td class="ln">{{if .OldLine}}{{if eq .Class "del"}}{{template "cmtln" dict "N" .OldLine "Path" .Path "Side" "old" "Base" $base "Viewer" $viewer "Carry" $L.Carry}}{{else}}{{.OldLine}}{{end}}{{end}}</td><td class="ln">{{if .NewLine}}{{template "cmtln" dict "N" .NewLine "Path" .Path "Side" "new" "Base" $base "Viewer" $viewer "Carry" $L.Carry}}{{end}}</td><td class="src chroma">{{if .Code}}{{.Code}}{{else}}{{.Content}}{{end}}</td></tr>
319  {{if .Compose}}<tr class="threadrow"><td colspan="3"><form id="compose" method="post" action="{{$base}}/diff-comment" class="thread composing">
320    <input type="hidden" name="path" value="{{.Path}}">
321    <input type="hidden" name="line" value="{{if eq .Class "del"}}{{.OldLine}}{{else}}{{.NewLine}}{{end}}">
322    <input type="hidden" name="side" value="{{if eq .Class "del"}}old{{else}}new{{end}}">
323    {{if ne .Class "del"}}<p><label>From line <input type="number" name="start_line" min="1" max="{{.NewLine}}" placeholder="{{.NewLine}}"></label> to {{.NewLine}}; a <code>```suggestion</code> block proposes replacement lines</p>{{end}}
324    <p><textarea name="body" aria-label="Comment on {{.Path}}" rows="3" placeholder="Comment on this line" autofocus></textarea></p>
325    <p><button type="submit" class="btn">Comment</button>
326       <button type="submit" name="pending" value="on" class="btn">Add to review</button>
327       <a href="{{$base}}?view=diff{{if $L.Carry}}&amp;layout={{$L.Carry}}{{end}}">Cancel</a></p>
328  </form></td></tr>
329  {{end}}{{end}}{{range .Threads}}<tr class="threadrow"><td colspan="3">{{template "thread" dict "T" . "Base" $base "Viewer" $viewer "Class" ""}}</td></tr>
330  {{end}}{{end}}
331  </table></div>{{end}}
332</details>
333{{end}}</div></div>{{end}}
334
335{{/* cmtln turns a line number into the link that opens the comment form
336     on that line. No JavaScript: the anchor travels in the query. */}}
337{{define "cmtln"}}{{if and .Viewer .Base}}<a class="cmt" aria-label="Comment on line {{.N}}" title="Comment on this line" href="{{.Base}}?view=diff&amp;cpath={{.Path}}&amp;cline={{.N}}&amp;cside={{.Side}}{{if .Carry}}&amp;layout={{.Carry}}{{end}}#compose">{{.N}}</a>{{else}}{{.N}}{{end}}{{end}}
338
339{{/* thread renders one review thread with its reply and resolve controls.
340     Class carries "stale" for threads whose anchor is gone. */}}
341{{define "thread"}}{{$t := .T}}<div class="thread{{if $t.Resolved}} resolved{{end}}{{if $t.Pending}} pending{{end}}{{if .Class}} {{.Class}}{{end}}" id="thread-{{$t.ID}}">
342{{if $t.Pending}}<p class="threadstate">pending — only you can see this until you submit your review</p>{{end}}
343{{if or $t.Resolved (and .Class $t.Stale)}}<p class="threadstate">{{if and .Class $t.Stale}}stale{{end}}{{if $t.Resolved}}{{if and .Class $t.Stale}} · {{end}}resolved by {{$t.Resolved}}{{end}}</p>{{end}}
344{{range $i, $c := $t.Comments}}<p class="commenthead"><strong>{{.Author}}</strong> <span class="when">{{when .CreatedAt}}</span></p><div class="rendered">{{.BodyHTML}}</div>{{if and (eq $i 0) $t.Suggestion}}{{template "suggestion" dict "S" $t.Suggestion "T" $t.ID "Base" $.Base}}{{end}}{{end}}
345{{if .Viewer}}<details class="threadreply"><summary>Reply</summary>
346<form method="post" action="{{.Base}}/diff-comment">
347  <input type="hidden" name="reply" value="{{$t.ID}}">
348  <p><textarea name="body" aria-label="Reply to thread {{$t.ID}}" rows="2" placeholder="Reply as {{.Viewer}}"></textarea></p>
349  <p><button type="submit" class="btn">Reply</button></p>
350</form></details>{{end}}
351{{if $t.CanResolve}}<form method="post" action="{{.Base}}/thread" class="threadact"><input type="hidden" name="thread" value="{{$t.ID}}"><button type="submit" name="action" value="{{if $t.Resolved}}unresolve{{else}}resolve{{end}}" class="linklike">{{if $t.Resolved}}Reopen thread{{else}}Resolve thread{{end}}</button></form>{{end}}
352</div>{{end}}
353
354{{/* suggestion renders the lines a thread's suggestion replaces and the
355     ones it proposes, with the apply button, or the command to run where
356     the server cannot sign the commit. */}}
357{{define "suggestion"}}{{$s := .S}}<div class="suggestion">
358<p class="threadstate">{{if $s.Outdated}}outdated suggestion: {{$s.Reason}}{{else}}suggested change{{end}}</p>
359<div class="tablewrap"><table class="difftable">
360{{range $s.Old}}<tr class="del"><td class="ln">{{.N}}</td><td class="src">{{.Text}}</td></tr>
361{{end}}{{range $s.New}}<tr class="add"><td class="ln">{{.N}}</td><td class="src">{{.Text}}</td></tr>
362{{end}}</table></div>
363{{if and $s.CanApply (not $s.Outdated)}}{{if $s.Local}}<p class="threadstate">This repository requires signed commits, which the server cannot make. Apply it from a clone: <code>{{$s.Command}}</code></p>
364{{else}}<form method="post" action="{{.Base}}/suggestion" class="threadact"><input type="hidden" name="thread" value="{{.T}}"><button type="submit" class="btn">Apply suggestion</button></form>
365{{end}}{{end}}</div>{{end}}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form