all repos — legit @ 1375740735b2085d638b53d116c9efeb199ed4d6

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