all repos — legit @ 30683a7ceca293d0a3db54f77ecc82c9ddcba787

legit - simple git web interface in go (fork)

templates/commit.html (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{{ define "commit" }}
<html>
{{ template "head" . }}
  <body>
  {{ template "repoheader" . }}
    {{ template "nav" . }}
    <main>
      <section class="commit">
        <pre>
          {{- .commit.Message -}}
        </pre>
        <div class="commit-info">
        {{ .commit.Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .commit.Author.Email}}</a>
        <time>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</time>
        {{ if .commit.PGPSignature }}
        <details><summary>PGP Signature</summary>
        <pre>{{ .commit.PGPSignature }}</pre>
        </details>
        {{ end }}
        </div>

        <div>
        <strong>commit</strong>
        <p><a href="/{{ .name }}/commit/{{ .commit.This }}" class="commit-hash">
          {{ .commit.This }}
        </a>
        </p>
        </div>

        {{ if .commit.Parent }}
        <div>
        <strong>parent</strong>
        <p><a href="/{{ .name }}/commit/{{ .commit.Parent }}" class="commit-hash">
          {{ .commit.Parent }}
        </a></p>
        </div>

        {{ end }}
        <div class="diff-stat">
          <div>
          {{ .stat.FilesChanged }} files changed,
          {{ .stat.Insertions }} insertions(+),
          {{ .stat.Deletions }} deletions(-)
          </div>
          <div>
            <br>
            <strong>jump to</strong>
            {{ range .diff }}
            <ul>
            <li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li>
            </ul>
            {{ end }}
          </div>
        </div>
      </section>
      <section>
        {{ $repo := .name }}
        {{ $this := .commit.This }}
        {{ $parent := .commit.Parent }}
        {{ range .diff }}
          <div id="{{ .Name.New }}">
            <div class="diff">
            {{ if .IsNew }}
            <span class="diff-type">A</span>
            {{ end }}
            {{ if .IsDelete }}
            <span class="diff-type">D</span>
            {{ end }}
            {{ if not (or .IsNew .IsDelete) }}
            <span class="diff-type">M</span>
            {{ end }}
          {{ if .Name.Old }}
          <a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>
          {{ if .Name.New }}
            &#8594; 
            <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
          {{ end }}
          {{ else }}
          <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
          {{- end -}}
          {{ if .IsBinary }}
          <p>Not showing binary file.</p>
          {{ else }}
            <pre>
            {{- range .TextFragments -}}
            <p>{{- .Header -}}</p>
            {{- range .Lines -}}
              {{- if eq .Op.String "+" -}}
              <span class="diff-add">{{ .String }}</span>
              {{- end -}}
              {{- if eq .Op.String "-" -}}
              <span class="diff-del">{{ .String }}</span>
              {{- end -}}
              {{- if eq .Op.String " " -}}
              <span class="diff-noop">{{ .String }}</span>
              {{- end -}}
            {{- end -}}
            {{- end -}}
          {{- end -}}
            </pre>
          </div>
          </div>
        {{ end }}
      </section>
    </main>
    {{ template "footer" .meta }}
  </body>
</html>
{{ end }}