all repos — legit @ 5091695e75b2db30b8926d8aa17164c84031bc77

web frontend for git, written in go

templates/commit.html (view raw)

 1{{ define "commit" }}
 2<html>
 3{{ template "head" . }}
 4
 5  <header>
 6    <h1>{{ .meta.Title }}</h1>
 7    <h2>{{ .meta.Description }}</h2>
 8  </header>
 9  <body>
10    {{ template "nav" . }}
11    <main>
12      <section>
13        <p>author: {{ .commit.Author.Name }} <{{ .commit.Author.Email}}> on {{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</p>
14        <p>commit: <a href="/{{ .name }}/commit/{{ .commit.This }}">
15          {{ .commit.This }}
16        </a>
17        </p>
18        <p>parent: <a href="/{{ .name }}/commit/{{ .commit.Parent }}">
19          {{ .commit.Parent }}
20        </a>
21        </p>
22        <p>{{ .stat.FilesChanged }} files changed,
23          {{ .stat.Insertions }} insertions(+),
24          {{ .stat.Deletions }} deletions(-)
25        </p>
26      </section>
27      <section>
28        {{ range .diff }}
29          {{ if .Name.Old }}
30          <p>{{ .Name.Old }} → {{ .Name.New }}</p>
31          {{ else }}
32          <p>{{.Name.New }}</p>
33          {{- end -}}
34            <pre>
35            {{- range .TextFragments -}}
36            <p>{{- .Header -}}</p>
37              {{- range .Lines -}}
38                {{- if eq .Op.String "+" -}}
39                <span style="color: green">{{ .String }}</span>
40                {{- end -}}
41                {{- if eq .Op.String "-" -}}
42                <span style="color: red">{{ .String }}</span>
43                {{- end -}}
44                {{- if eq .Op.String " " -}}
45                <span style="color: gray">{{ .String }}</span>
46                {{- end -}}
47              {{- end -}}
48            {{- end -}}
49            </pre>
50        {{ end }}
51      </section>
52    </main>
53  </body>
54</html>
55{{ end }}