all repos — legit @ 7fe98772b079cca83b854e8f8a6be5dc55c10483

web frontend for git, written in go

templates/commit.html (view raw)

 1{{ define "commit" }}
 2<html>
 3{{ template "head" . }}
 4
 5  {{ template "repoheader" . }}
 6  <body>
 7    {{ template "nav" . }}
 8    <main>
 9      <section class="commit">
10        <pre>
11          {{- .commit.Message -}}
12        </pre>
13        <p>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</p>
14        <p>{{ .commit.Author.Name }} <span class="commit-email">{{ .commit.Author.Email}}</span></p>
15        <p>commit: <a href="/{{ .name }}/commit/{{ .commit.This }}">
16          {{ .commit.This }}
17        </a>
18        </p>
19        {{ if .commit.Parent }}
20        <p>parent: <a href="/{{ .name }}/commit/{{ .commit.Parent }}">
21          {{ .commit.Parent }}
22        </a>
23        {{ end }}
24        </p>
25        <div class="diff-stat">
26          <div>
27          {{ .stat.FilesChanged }} files changed,
28          {{ .stat.Insertions }} insertions(+),
29          {{ .stat.Deletions }} deletions(-)
30          </div>
31          <div>
32            <br>
33            <p>jump to:</p>
34            {{ range .diff }}
35            <ul>
36            <li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li>
37            </ul>
38            {{ end }}
39          </div>
40        </div>
41      </section>
42      <section>
43        {{ $repo := .name }}
44        {{ $this := .commit.This }}
45        {{ range .diff }}
46          <div class="diff">
47          <div id="{{ .Name.New }}">
48          {{ if .Name.Old }}
49          <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.Old }}">{{ .Name.Old }}</a> &#8594; 
50          <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
51          {{ else }}
52          <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
53          {{- end -}}
54          </div>
55
56            <pre>
57            {{- range .TextFragments -}}
58            <p>{{- .Header -}}</p>
59            {{- range .Lines -}}
60              {{- if eq .Op.String "+" -}}
61              <span class="diff-add">{{ .String }}</span>
62              {{- end -}}
63              {{- if eq .Op.String "-" -}}
64              <span class="diff-del">{{ .String }}</span>
65              {{- end -}}
66              {{- if eq .Op.String " " -}}
67              <span class="diff-noop">{{ .String }}</span>
68              {{- end -}}
69            {{- end -}}
70            {{- end -}}
71            </pre>
72          </div>
73        {{ end }}
74      </section>
75    </main>
76  </body>
77</html>
78{{ end }}