navid/veinsforge / ff3477091cc92ed92cd07ce1e14ccc09435b1ea57933a80577d80dc351eb838a / internal/web/templates/repo.html

repo.html

← internal/web/templates · 4560 bytes · raw · download

{{define "content"}}
<p class="kicker"><a href="{{ownerURL .Data.Repo}}">{{.Data.Repo.OwnerName}}</a> / repository</p>
<h1><a href="{{ownerURL .Data.Repo}}">{{.Data.Repo.OwnerName}}</a> / {{.Data.Repo.Name}}</h1>
{{if .Data.Repo.Description}}<p>{{.Data.Repo.Description}}</p>{{end}}
<p class="muted">
  {{.Data.Repo.Visibility}}{{if .Data.Repo.Archived}} · archived{{end}} · {{.Data.StarCount}} stars
  {{if .Data.Rev}} · default branch <code>{{.Data.Rev}}</code>{{end}}
  {{if .Data.LatestTag}} · latest tag <code>{{.Data.LatestTag}}</code>{{end}}
  {{if .Data.Perms.CanAdmin}} · <a href="{{repoURL .Data.Repo}}/settings">settings</a>{{end}}
</p>
{{if .Data.License}}
<p class="muted license">
  <svg class="license-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
    <polyline points="14 2 14 8 20 8"></polyline>
    <line x1="16" y1="13" x2="8" y2="13"></line>
    <line x1="16" y1="17" x2="8" y2="17"></line>
    <polyline points="10 9 9 9 8 9"></polyline>
  </svg>
  <span>{{.Data.License}}</span>
</p>
{{end}}
{{with .Data.Languages}}
<div class="language-bar" role="img" aria-label="Language breakdown">
  <svg viewBox="0 0 100 10" preserveAspectRatio="none" aria-hidden="true" focusable="false">
    {{range .}}<rect x="{{printf "%.3f" .Offset}}" y="0" width="{{printf "%.3f" .Percent}}" height="10" fill="{{.Color}}"><title>{{.Name}} {{printf "%.1f" .Percent}}%</title></rect>{{end}}
    {{range .}}{{if .Offset}}<line class="language-gap" x1="{{printf "%.3f" .Offset}}" x2="{{printf "%.3f" .Offset}}" y1="0" y2="10" vector-effect="non-scaling-stroke"></line>{{end}}{{end}}
  </svg>
</div>
<ul class="language-legend">
  {{range .}}<li><svg class="language-dot" viewBox="0 0 10 10" aria-hidden="true" focusable="false"><circle cx="5" cy="5" r="5" fill="{{.Color}}"></circle></svg><span class="language-name">{{.Name}}</span> <span class="language-percent">{{printf "%.1f" .Percent}}%</span></li>{{end}}
</ul>
{{end}}
<p class="repo-actions">
  {{if .User}}
  <form method="post" action="{{repoURL .Data.Repo}}/star" class="inline">
    <input type="hidden" name="csrf" value="{{.CSRF}}">
    <button class="link" type="submit">{{if .Data.Starred}}unstar{{else}}star{{end}}</button>
  </form>
  {{else}}
  <a href="/login?next={{repoURL .Data.Repo | urlquery}}">star</a>
  {{end}}
</p>

<nav class="tabs" aria-label="Repository">
  <a class="active" href="{{repoURL .Data.Repo}}">code</a>
  <a href="{{repoURL .Data.Repo}}/issues">issues ({{.Data.IssueCount}})</a>
  <a href="{{repoURL .Data.Repo}}/pulls">pull requests ({{.Data.PullCount}})</a>
  <a href="{{repoURL .Data.Repo}}/commits">commits</a>
  <a href="{{repoURL .Data.Repo}}/branches">branches ({{len .Data.Branches}})</a>
  <a href="{{repoURL .Data.Repo}}/tags">tags ({{len .Data.Tags}})</a>
  <a href="{{repoURL .Data.Repo}}/releases">releases</a>
  <a href="{{repoURL .Data.Repo}}/clone">clone</a>
</nav>

{{if .Data.Empty}}
{{if .Data.Perms.CanAdmin}}
<h2>Empty repository</h2>
<p>No commits yet. See <a href="{{repoURL .Data.Repo}}/clone">Clone</a> for the clone command, then set a bookmark, add files, and push.</p>
{{end}}
{{else}}
{{with index .Data.Commits 0}}
<p class="commit-strip">
  <span><strong>{{.Author}}</strong> — {{.Message}}</span>
  <span class="muted"><a href="{{commitURL $.Data.Repo .Hash}}"><code>{{short .Hash}}</code></a> · {{timeago .Date}}</span>
</p>
{{end}}

{{if .Data.FilesError}}<p class="flash flash-error">{{.Data.FilesError}}</p>{{end}}
<ul class="file-list">
  {{range .Data.Tree}}
  <li>
    {{if .IsDir}}
    <a href="{{treeURL $.Data.Repo $.Data.Rev .Path}}">{{.Name}}/</a>
    {{else}}
    <a href="{{blobURL $.Data.Repo $.Data.Rev .Path}}">{{.Name}}</a>
    {{end}}
  </li>
  {{else}}
  <li class="muted">No tracked files.</li>
  {{end}}
</ul>
<p class="small"><a href="{{repoURL .Data.Repo}}/tree/{{revPath .Data.Rev}}">Browse full tree</a> · <a href="{{repoURL .Data.Repo}}/commits/{{revPath .Data.Rev}}">History</a> · <a href="{{archiveURL .Data.Repo .Data.Rev}}">Download source</a></p>

{{if .Data.Readme}}
<h2>{{.Data.ReadmePath}}</h2>
<div class="markdown">{{.Data.Readme}}</div>
{{end}}
{{end}}

{{if .Data.Activity}}
<h2>Activity</h2>
<ul class="activity">
  {{range .Data.Activity}}<li><span class="muted">{{timeago .CreatedAt}}</span> {{if .ActorName}}{{.ActorName}} {{end}}{{.Kind}} {{.Detail}}</li>{{end}}
</ul>
{{end}}
{{end}}