100 lines
2.9 kB
1
{{ define "title" }} commit {{ .Diff.Commit.This }} {{ end }}
2
3
{{ define "repoContent" }}
4
5
{{ $repo := .RepoInfo.FullName }}
6
{{ $commit := .Diff.Commit }}
7
{{ $stat := .Diff.Stat }}
8
{{ $diff := .Diff.Diff }}
9
10
<section class="commit">
11
<div id="commit-message">
12
{{ $messageParts := splitN $commit.Message "\n\n" 2 }}
13
<div>
14
{{ index $messageParts 0 }}
15
{{ if gt (len $messageParts) 1 }}
16
<p class="mt-1 cursor-text pb-2">{{ nl2br (unwrapText (index $messageParts 1)) }}</p>
17
{{ end }}
18
</div>
19
</div>
20
21
<p class="text-sm text-gray-500">
22
<a href="mailto:{{ $commit.Author.Email }}" class="no-underline hover:underline text-gray-500">
23
{{ $commit.Author.Name }}
24
</a>
25
·
26
{{ timeFmt $commit.Author.When }}
27
·
28
<span class="font-mono">{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span>
29
·
30
<a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500">
31
{{ slice $commit.This 0 8 }}
32
</a>
33
{{ if $commit.Parent }}
34
<--
35
<a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500">
36
{{ slice $commit.Parent 0 8 }}
37
</a>
38
{{ end }}
39
</p>
40
41
<div class="diff-stat">
42
<br>
43
<strong>jump to</strong>
44
{{ range $diff }}
45
<ul>
46
<li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li>
47
</ul>
48
{{ end }}
49
</div>
50
</section>
51
<section>
52
{{ $this := $commit.This }}
53
{{ $parent := $commit.Parent }}
54
{{ range $diff }}
55
<div id="{{ .Name.New }}">
56
<div class="diff">
57
{{ if .IsNew }}
58
<span class="diff-type">A</span>
59
{{ end }}
60
{{ if .IsDelete }}
61
<span class="diff-type">D</span>
62
{{ end }}
63
{{ if not (or .IsNew .IsDelete) }}
64
<span class="diff-type">M</span>
65
{{ end }}
66
{{ if .Name.Old }}
67
<a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>
68
{{ if .Name.New }}
69
→
70
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
71
{{ end }}
72
{{ else }}
73
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
74
{{- end -}}
75
{{ if .IsBinary }}
76
<p>Not showing binary file.</p>
77
{{ else }}
78
<pre class="overflow-auto">
79
{{- range .TextFragments -}}
80
<p>{{- .Header -}}</p>
81
{{- range .Lines -}}
82
{{- if eq .Op.String "+" -}}
83
<span class="diff-add">{{ .String }}</span>
84
{{- end -}}
85
{{- if eq .Op.String "-" -}}
86
<span class="diff-del">{{ .String }}</span>
87
{{- end -}}
88
{{- if eq .Op.String " " -}}
89
<span class="diff-noop">{{ .String }}</span>
90
{{- end -}}
91
{{- end -}}
92
{{- end -}}
93
{{- end -}}
94
</pre>
95
</div>
96
</div>
97
{{ end }}
98
</section>
99
100
{{end}}
101