josie / simplegit

{{define "repo_nav"}}
<div class="repo-header">
  <h1 class="repo-title"><a href="/{{.Owner}}">{{.Owner}}</a> <span class="sep">/</span> <a href="/{{.Owner}}/{{.RepoName}}">{{.RepoName}}</a>{{if eq .Visibility "private"}} <span class="badge">private</span>{{end}}</h1>
</div>
<div class="clone-row">
  <input id="clone-url" readonly value="{{cloneURL .Owner .RepoName}}" onclick="this.select()">
  <button type="button" onclick="var i=document.getElementById('clone-url');i.select();if(navigator.clipboard)navigator.clipboard.writeText(i.value)">copy</button>
</div>
<nav class="repo-tabs">
  <a href="/{{.Owner}}/{{.RepoName}}"{{if eq .Active "code"}} class="active"{{end}}>Code</a>
  <a href="/{{.Owner}}/{{.RepoName}}/issues"{{if eq .Active "issues"}} class="active"{{end}}>Issues</a>
  <a href="/{{.Owner}}/{{.RepoName}}/pulls"{{if eq .Active "pulls"}} class="active"{{end}}>Pull Requests</a>
  <a href="/{{.Owner}}/{{.RepoName}}/releases"{{if eq .Active "releases"}} class="active"{{end}}>Releases</a>
  {{if eq .Username .Owner}}<a{{if eq .Active "settings"}} class="active"{{end}} href="/{{.Owner}}/{{.RepoName}}/settings">Settings</a>{{end}}
</nav>
{{end}}

{{define "filetree"}}
<ul class="file-tree">
{{range .}}
  <li>{{if .Href}}<a href="{{.Href}}">{{.Name}}</a>{{else}}<span class="muted">{{.Name}}</span>{{end}}{{if .Children}}{{template "filetree" .Children}}{{end}}</li>
{{end}}
</ul>
{{end}}

{{define "comment"}}
<article class="comment{{if .Pending}} pending{{end}}" id="comment-{{.ID}}">
  <div class="comment-meta muted">{{.Author}}{{if .AuthorIsOwner}} <span class="badge">owner</span>{{end}}{{if .IsOwner}}{{if .AuthorEmail}} &lt;{{.AuthorEmail}}&gt;{{end}}{{end}} · {{.Created}}{{if .Pending}} <span class="badge pending">pending</span>{{end}}</div>
  <div class="comment-body">{{.BodyHTML}}</div>
  {{if .IsOwner}}
  <div class="comment-actions">
    {{if .Pending}}<form method="post" action="{{.Base}}/comments/{{.ID}}/approve"><button class="linklike" type="submit">approve</button></form>{{end}}
    <form method="post" action="{{.Base}}/comments/{{.ID}}/delete"><button class="linklike" type="submit">delete</button></form>
  </div>
  {{end}}
</article>
{{end}}

{{define "comment_pending"}}
<p class="ok">your comment was submitted and is awaiting review.</p>
{{end}}

{{define "guest_fields"}}
<fieldset class="guest-fields">
  <legend>how should we credit you?</legend>
  <p><label for="{{.}}name">name</label><br>
     <input id="{{.}}name" name="author_name" maxlength="100" placeholder="Anonymous"></p>
  <p><label for="{{.}}email">email (optional, not public)</label><br>
     <input id="{{.}}email" name="author_email" type="email" maxlength="200"></p>
</fieldset>
{{end}}