~gitpocket/gitpocket

8
161949a0fab0794bbb7e894db46ad9ede8bc5ce2
mainfeed-discovery
gitpocket/web/templates/gist.tmpl -rw-r--r--3.3 KiB ViewLogBlameView rawPermalink 9c68a68a5b feat(gists): host multi-file gists as git repositories with a cookie-less raw origin 10 hours ago
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{{define "content"}}
{{$d := .Data}}
{{$g := $d.Gist}}
<div class="gisthead">
<div>
<h2><a href="/~{{$g.Owner.Name}}">~{{$g.Owner.Name}}</a> / <a href="/gist/{{$g.ID}}">{{$d.Title}}</a>{{if $g.Secret}} <span class="tag">secret</span>{{end}}</h2>
<p class="muted small">{{with $d.Last}}{{template "who" .}} · {{end}}created {{ago $g.Created}}{{if ne $g.Updated $g.Created}} · updated {{ago $g.Updated}}{{end}}{{with $d.Parent}} · forked from <a href="/gist/{{.ID}}">~{{.Owner.Name}}/{{.Title nil}}</a>{{end}}{{if .User}} · <a class="muted" href="/report?kind=gist&amp;target={{$g.ID}}">report</a>{{end}}</p>
{{if $g.Secret}}<p class="muted small">Secret gists are unlisted, anyone with this link can read them.</p>{{end}}
</div>
<div class="gistactions">
{{if .User}}<form method="post" action="/gist/{{$g.ID}}/star" class="inline"><button class="btn{{if $d.Starred}} starred{{end}}">{{if $d.Starred}}Unstar{{else}}Star{{end}} <span class="count">{{$g.Stars}}</span></button></form>
{{if not $d.Owner}}<form method="post" action="/gist/{{$g.ID}}/fork" class="inline"><button class="btn">Fork <span class="count">{{$g.Forks}}</span></button></form>{{end}}{{end}}
{{if $d.Owner}}<a class="btn" href="/gist/{{$g.ID}}/edit">Edit</a>{{end}}
{{if or $d.Owner $d.Admin}}<form method="post" action="/gist/{{$g.ID}}/delete" class="inline"><button class="btn danger">Delete</button></form>{{end}}
</div>
</div>
<nav class="tabs small gisttabs"><a class="active" href="/gist/{{$g.ID}}">code</a><a href="/gist/{{$g.ID}}/revisions">revisions</a></nav>
{{if $d.Old}}<p class="info">You are looking at an older revision, <a href="/gist/{{$g.ID}}">see the latest</a>.</p>{{end}}
<details class="clonebox"><summary>Clone, embed or share</summary>
<dl class="meta">
<dt>https</dt><dd><code>{{$d.Clone}}</code></dd>
<dt>ssh</dt><dd><code>{{$d.SSH}}</code></dd>
<dt>embed</dt><dd><code>{{$d.Embed}}</code></dd>
<dt>api</dt><dd><code>https://{{.Host}}/api/gists/{{$g.ID}}</code></dd>
</dl>
</details>
{{range $d.Files}}<section class="gistfile" id="file-{{.Name}}">
<div class="gistfilebar"><a href="#file-{{.Name}}">{{.Name}}</a><span class="muted small">{{size .Size}}</span><span class="spacer"></span><a href="{{.Raw}}">raw</a></div>
{{template "gistbody" .}}
</section>{{end}}
{{with $d.Forks}}<h4 class="rule">Forks</h4><ul class="gistforks">{{range .}}<li><a href="/gist/{{.ID}}">~{{.Owner.Name}}</a> <span class="muted small">{{ago .Created}}</span></li>{{end}}</ul>{{end}}
<h4 class="rule" id="comments">Comments{{with $d.Comments}} <span class="count">{{len .}}</span>{{end}}</h4>
{{range $d.Comments}}<div class="comment"><div class="who"><a href="/~{{.Comment.Author.Name}}">~{{.Comment.Author.Name}}</a> <span class="muted">{{ago .Comment.Created}}</span>{{if $.User}}{{if or (eq $.User.ID .Comment.Author.ID) $d.Owner $d.Admin}} <form method="post" action="/gist/{{$g.ID}}/comment/{{.Comment.ID}}/delete" class="inlineform"><button class="linkbutton small">delete</button></form>{{end}}{{end}}</div><div class="readme">{{.Body}}</div></div>{{end}}
{{if .User}}<form method="post" action="/gist/{{$g.ID}}/comment" class="stack wide">
<label>Leave a comment <textarea name="body" rows="4" required placeholder="Markdown supported" data-md></textarea></label>
<div class="actions"><button class="btn primary">Comment ▸</button></div>
</form>{{else}}<p class="muted"><a href="/login">Log in</a> to comment.</p>{{end}}
{{end}}