Migration This is my new public git source viewer. Source coming soon. Please contact with concerns/bugs. Contact me

templates/layouts/partials.html

3a50036d96eb14462e96598fd169d1c79264ac4b · 2.3 KB · 61 lines raw

1 {{/* {{ template "tree-table" (dict "Base" "/slug" "Ref" ref "Entries" entries) }} */}}
2 {{ define "tree-table" }}
3 <table class="listing tree">
4 <tbody>
5 {{ $ := . }}{{ range .Entries }}
6 <tr>
7 <td class="icon">{{ if .IsDir }}<span class="glyph dir">▸</span>{{ else }}<span class="glyph file">·</span>{{ end }}</td>
8 <td class="name">
9 {{ if .IsDir }}<a class="dir" href="{{ $.Base }}/tree/{{ $.Ref }}/{{ .Path }}">{{ .Name }}</a>
10 {{ else }}<a href="{{ $.Base }}/blob/{{ $.Ref }}/{{ .Path }}">{{ .Name }}</a>{{ end }}
11 </td>
12 <td class="num">{{ if .IsDir }}<span class="muted">—</span>{{ else }}{{ bytes .Size }}{{ end }}</td>
13 <td class="act">{{ if not .IsDir }}<a class="ghost" href="{{ $.Base }}/raw/{{ $.Ref }}/{{ .Path }}">raw</a>{{ end }}</td>
14 </tr>
15 {{ else }}
16 <tr><td class="empty" colspan="4">This directory is empty.</td></tr>
17 {{ end }}
18 </tbody>
19 </table>
20 {{ end }}
21
22 {{ define "commit-table" }}
23 <table class="listing log">
24 <tbody>
25 {{ $ := . }}{{ range .Commits }}
26 <tr>
27 <td class="sha"><a href="{{ $.Base }}/commit/{{ .SHA }}">{{ .Short }}</a></td>
28 <td class="name"><a class="subject" href="{{ $.Base }}/commit/{{ .SHA }}">{{ trunc 78 .Subject }}</a></td>
29 <td class="who">{{ .Author }}</td>
30 <td class="when"><time datetime="{{ rfc3339 .When }}">{{ date .When }}</time></td>
31 </tr>
32 {{ else }}
33 <tr><td class="empty" colspan="4">No commits on this ref yet.</td></tr>
34 {{ end }}
35 </tbody>
36 </table>
37 {{ end }}
38
39 {{/* {{ template "diffstat" (dict "Base" "/slug" "Ref" sha "Diff" d) }} */}}
40 {{ define "diffstat" }}
41 {{ $ := . }}
42 {{ with .Diff.Stats }}
43 <table class="listing stat">
44 <tbody>
45 {{ range . }}
46 <tr>
47 <td class="name"><a href="{{ $.Base }}/blob/{{ $.Ref }}/{{ .Path }}">{{ .Path }}</a></td>
48 <td class="churn">
49 {{ if eq .Status "B" }}<span class="muted">binary</span>
50 {{ else }}<span class="add">+{{ .Added }}</span><span class="del">−{{ .Deleted }}</span>{{ end }}
51 </td>
52 <td class="act"><a class="ghost" href="{{ $.Base }}/raw/{{ $.Ref }}/{{ .Path }}">raw</a></td>
53 </tr>
54 {{ end }}
55 </tbody>
56 </table>
57 {{ else }}
58 <p class="empty">No files changed.</p>
59 {{ end }}
60 {{ if .Diff.Truncated }}<p class="notice">This diff exceeds the size limit and is shown in part. Fetch the file with <code>raw</code> to see all of it.</p>{{ end }}
61 {{ end }}