all repos — legit @ 3e6a720154b70a9882af14399548e494b1d0089f

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