templates/commit.html (view raw)
1{{ define "commit" }}
2<!doctype html>
3<html>
4{{ template "head" . }}
5
6 <body>
7 {{ template "repoheader" . }}
8 {{ template "nav" . }}
9 <main>
10 <section class="commit">
11 <pre>
12 {{- .commit.Message -}}
13 </pre>
14 <div class="commit-info">
15 {{ .commit.Author.Name }} <a href="mailto:{{ .commit.Author.Email }}" class="commit-email">{{ .commit.Author.Email}}</a>
16 <div>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
17 </div>
18
19 <div>
20 <strong>commit</strong>
21 <p><a href="/{{ .name }}/commit/{{ .commit.This }}" class="commit-hash">
22 {{ .commit.This }}
23 </a>
24 </p>
25 </div>
26
27 {{ if .commit.Parent }}
28 <div>
29 <strong>parent</strong>
30 <p><a href="/{{ .name }}/commit/{{ .commit.Parent }}" class="commit-hash">
31 {{ .commit.Parent }}
32 </a></p>
33 </div>
34
35 {{ end }}
36 <div class="diff-stat">
37 <div>
38 {{ .stat.FilesChanged }} files changed,
39 {{ .stat.Insertions }} insertions(+),
40 {{ .stat.Deletions }} deletions(-)
41 </div>
42 <div>
43 <br>
44 <strong>jump to</strong>
45 {{ range .diff }}
46 <ul>
47 <li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li>
48 </ul>
49 {{ end }}
50 </div>
51 </div>
52 </section>
53 <section>
54 {{ $repo := .name }}
55 {{ $this := .commit.This }}
56 {{ $parent := .commit.Parent }}
57 {{ range .diff }}
58 <div id="{{ .Name.New }}">
59 <div class="diff">
60 {{ if .IsNew }}
61 <span class="diff-type">A</span>
62 {{ end }}
63 {{ if .IsDelete }}
64 <span class="diff-type">D</span>
65 {{ end }}
66 {{ if not (or .IsNew .IsDelete) }}
67 <span class="diff-type">M</span>
68 {{ end }}
69 {{ if .Name.Old }}
70 <a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>
71 {{ if .Name.New }}
72 →
73 <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
74 {{ end }}
75 {{ else }}
76 <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
77 {{- end -}}
78 {{ if .IsBinary }}
79 <p>Not showing binary file.</p>
80 {{ else }}
81 <pre>
82 {{- range .TextFragments -}}
83 <p>{{- .Header -}}</p>
84 {{- range .Lines -}}
85 {{- if eq .Op.String "+" -}}
86 <span class="diff-add">{{ .String }}</span>
87 {{- end -}}
88 {{- if eq .Op.String "-" -}}
89 <span class="diff-del">{{ .String }}</span>
90 {{- end -}}
91 {{- if eq .Op.String " " -}}
92 <span class="diff-noop">{{ .String }}</span>
93 {{- end -}}
94 {{- end -}}
95 {{- end -}}
96 {{- end -}}
97 </pre>
98 </div>
99 </div>
100 {{ end }}
101 </section>
102 </main>
103 </body>
104</html>
105{{ end }}