Parent directory

repository.gohtml

4756 bytes
 1{{ define "repository" }}<!doctype html>
 2<html lang="en">
 3<head>
 4  <meta charset="utf-8">
 5  <meta name="viewport" content="width=device-width, initial-scale=1">
 6  <title>{{ .Title }} · {{ .ServerName }}</title>
 7  <link rel="stylesheet" href="/@/assets/site.css">
 8  <script src="/@/assets/site.js" defer></script>
 9</head>
10<body>
11  {{ template "site-header" . }}
12  <main class="page-shell">
13    <article>
14      <header class="repository-hero">
15        <h1>{{ .Title }}</h1>
16        {{ if ne .Title .Repository }}<p class="repository-name">{{ .Repository }}</p>{{ end }}
17        {{ if .Description }}<p class="repository-description">{{ .Description }}</p>{{ end }}
18        {{ if or .BuildStatus.Present (not .Empty) }}<div class="repository-meta">{{ if .BuildStatus.Present }}<span class="status-badge {{ .BuildStatus.Class }}">{{ .BuildStatus.Label }}</span>{{ end }}{{ if not .Empty }}<span>Default ref <code>{{ .Ref }}</code></span>{{ end }}</div>{{ end }}
19      </header>
20      {{ if .Empty }}
21      <p class="empty-state">This repository is empty.</p>
22      {{ else }}
23      <nav class="repository-tabs" aria-label="Repository navigation">
24        <a href="{{ .TreeURL }}">{{ template "icon-folder" }}<span>Files</span></a>
25        <a href="{{ .CommitsURL }}">{{ template "icon-history" }}<span>Commits</span></a>
26        <a href="{{ .RefsURL }}">{{ template "icon-branch" }}<span>Branches and tags</span></a>
27        <button class="repository-tab-button" type="button" data-copy="{{ .HTTPCloneURL }}" data-copy-label="HTTP clone URL" aria-label="Copy HTTP clone URL" aria-describedby="clone-copy-status" title="Copy HTTP clone URL">{{ template "icon-copy" }}<span>Copy URL</span></button>
28      </nav>
29      <span id="clone-copy-status" class="sr-only" aria-live="polite"></span>
30      {{ end }}
31      {{ if .Readme }}<section class="panel readme-panel"><div class="markdown">{{ .Readme }}</div></section>{{ end }}
32    </article>
33  </main>
34</body>
35</html>{{ end }}
36
37{{ define "tree" }}<!doctype html>
38<html lang="en">
39<head>
40  <meta charset="utf-8">
41  <meta name="viewport" content="width=device-width, initial-scale=1">
42  <title>{{ .Repository }} · {{ .ServerName }}</title>
43  <link rel="stylesheet" href="/@/assets/site.css">
44  <script src="/@/assets/site.js" defer></script>
45</head>
46<body>
47  {{ template "site-header" . }}
48  <main class="page-shell">
49    <nav class="breadcrumb" aria-label="Breadcrumb"><a href="{{ .OverviewURL }}">{{ .Repository }}</a><span aria-hidden="true">/</span><code>{{ .Ref }}</code>{{ if .Path }}<span aria-hidden="true">/</span><span>{{ .Path }}</span>{{ end }}</nav>
50    {{ if .ParentURL }}<p class="toolbar"><a class="button button-secondary" href="{{ .ParentURL }}">{{ template "icon-arrow-left" }}<span>Parent directory</span></a></p>{{ end }}
51    {{ if .File }}
52      <article class="panel file-panel">
53        <header class="file-header"><div class="file-title">{{ template "icon-file" }}<h1>{{ .File.Name }}</h1></div><div class="file-actions"><span>{{ .File.Size }} bytes</span>{{ if .File.DownloadURL }}<button class="button button-secondary" type="button" data-copy="{{ .File.DownloadURL }}" data-copy-label="Download URL" aria-label="Copy download URL" aria-describedby="download-copy-status" title="Copy download URL">{{ template "icon-copy" }}<span>Copy download URL</span></button>{{ end }}</div></header>
54        <span id="download-copy-status" class="sr-only" aria-live="polite"></span>
55        {{ if .File.Message }}<p class="empty-state">{{ .File.Message }}{{ if .File.DownloadURL }} <a class="button button-secondary" href="{{ .File.DownloadURL }}">{{ template "icon-download" }}<span>Download</span></a>{{ end }}</p>{{ else if .File.Markdown }}<div class="markdown">{{ .File.Markdown }}</div>{{ else }}<pre class="source"><code>{{ .File.Source }}</code></pre>{{ end }}
56      </article>
57    {{ else }}
58      <section class="panel directory-panel">
59        <div class="section-heading"><div><h1>Files</h1></div></div>
60        {{ if .Truncated }}<p class="notice">This directory has more than 1,000 entries; only the first 1,000 are shown.</p>{{ end }}
61        <div class="table-wrap"><table>
62          <thead><tr><th scope="col">Name</th><th scope="col">Last commit</th><th scope="col">Size</th></tr></thead>
63          <tbody>{{ range .Entries }}<tr><td><a class="file-link" href="{{ .URL }}">{{ template "icon-file" }}<span>{{ .Name }}</span></a></td><td>{{ if .LastCommit }}<a href="{{ .LastCommit.URL }}"><code>{{ .LastCommit.ShortHash }}</code></a> {{ .LastCommit.Subject }}{{ else }}—{{ end }}</td><td>{{ .Size }}</td></tr>{{ else }}<tr><td colspan="3">This directory is empty.</td></tr>{{ end }}</tbody>
64        </table></div>
65      </section>
66    {{ end }}
67  </main>
68</body>
69</html>{{ end }}