100 lines
2.6 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
<pre>{{- $commit.Message -}}</pre>
12
<div class="commit-info">
13
{{ $commit.Author.Name }} <a href="mailto:{{ $commit.Author.Email }}" class="commit-email">{{ $commit.Author.Email}}</a>
14
<div>{{ $commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
15
</div>
16
17
<div>
18
<strong>commit</strong>
19
<p><a href="/{{ $repo }}/commit/{{ $commit.This }}" class="commit-hash">
20
{{ slice $commit.This 0 8 }}
21
</a>
22
</p>
23
</div>
24
25
{{ if $commit.Parent }}
26
<div>
27
<strong>parent</strong>
28
<p><a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="commit-hash">
29
{{ slice $commit.Parent 0 8 }}
30
</a></p>
31
</div>
32
33
{{ end }}
34
<div class="diff-stat">
35
<div>
36
{{ $stat.FilesChanged }} files changed,
37
{{ $stat.Insertions }} insertions(+),
38
{{ $stat.Deletions }} deletions(-)
39
</div>
40
<div>
41
<br>
42
<strong>jump to</strong>
43
{{ range $diff }}
44
<ul>
45
<li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li>
46
</ul>
47
{{ end }}
48
</div>
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>
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