all repos

mugit @ 870359125ebb60e000bec53a10aec959c60bedd8

🐮 git server that your cow will love

mugit/web/templates/repo_commit.html (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ui: hint links more clearly, 3 months ago
1
{{ define "repo_commit" }}
2
<html>
3
  <head>
4
    {{ template "head" . }}
5
    <title>{{ .name }}: {{ .commit.HashShort }}</title>
6
  </head>
7
  <body>
8
    {{ template "repo_header" . }}
9
    <main>
10
      <section class="commit">
11
        <div class="commit-refs">
12
          {{ .stat.FilesChanged }} files changed,
13
          {{ .stat.Insertions }} insertions(+),
14
          {{ .stat.Deletions }} deletions(-)
15
        </div>
16
17
        <div class="box">
18
          <pre class="commit-message">{{ .commit.Message }}</pre>
19
          <div>
20
            <strong>Author:</strong>
21
            {{ .commit.AuthorName }}
22
            <a href="mailto:{{ .AuthorEmail }}" class="commit-email">{{ .commit.AuthorEmail }}</a>
23
          </div>
24
          <div>
25
            <strong>Committed at:</strong>
26
            {{ .commit.Committed }}
27
          </div>
28
          {{ if .commit.ChangeID -}}
29
          <div>
30
            <strong>Change ID:</strong>
31
            {{ .commit.ChangeID }}
32
          </div>
33
          {{- end }}
34
          <div>
35
            <strong>Parent:</strong>
36
            {{ range $i, $p := .parents -}}
37
            {{ if $i }}, {{ end -}}
38
            <a class="link" href="/{{ $.name }}/commit/{{ $p }}">{{ $p }}</a>
39
            {{- end }}
40
          </div>
41
        </div>
42
43
        {{ if gt (len .diff) 1 -}}
44
        <div class="jump">
45
          <strong>jump to</strong>
46
          <table class="table jump-table">
47
            <tbody>
48
              {{ range .diff }}
49
              {{ $path := .Name.New }}
50
              {{ if not $path }}{{ $path = .Name.Old }}{{ end }}
51
              <tr>
52
                <td class="diff-type">
53
                  {{ if .IsNew }}<span class="diff-type diff-add">A</span>{{ end }}
54
                  {{ if .IsDelete }}<span class="diff-type diff-del">D</span>{{ end }}
55
                  {{ if not (or .IsNew .IsDelete) }}<span class="diff-type diff-mod">M</span>{{ end }}
56
                </td>
57
                <td class="fill">
58
                  <a href="#{{ $path }}">
59
                    {{ if and .Name.Old .Name.New }}{{ .Name.Old }} &#8594; {{ .Name.New }}{{ else }}{{ $path }}{{ end }}
60
                  </a>
61
                </td>
62
              </tr>
63
              {{ end }}
64
            </tbody>
65
          </table>
66
        </div>
67
        {{ end }}
68
      </section>
69
      <section>
70
        {{ $repo := .name }}
71
        {{ $this := .commit.Hash }}
72
        {{ $parent := index .parents 0 }}
73
        {{ range .diff }}
74
          {{ $path := .Name.New }}
75
          {{ if not $path }}{{ $path = .Name.Old }}{{ end }}
76
          <div id="{{ $path }}">
77
            <div class="diff">
78
            {{ if .IsNew }}
79
            <span class="diff-type diff-add">A</span>
80
            {{ end }}
81
            {{ if .IsDelete }}
82
            <span class="diff-type diff-del">D</span>
83
            {{ end }}
84
            {{ if not (or .IsNew .IsDelete) }}
85
            <span class="diff-type diff-mod">M</span>
86
            {{ end }}
87
          {{ if .Name.Old }}
88
          <a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>
89
          {{ if .Name.New }}
90
            &#8594;
91
            <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
92
          {{ end }}
93
          {{ else }}
94
          <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
95
          {{- end -}}
96
          {{ if .IsBinary }}
97
          <p>Not showing binary file.</p>
98
          {{ else }}
99
            <pre>
100
            {{- range .TextFragments -}}
101
            <p>{{- .Header -}}</p>
102
            {{- range .Lines -}}
103
              {{- if eq .Op.String "+" -}}
104
              <span class="diff-add">{{ .String }}</span>
105
              {{- end -}}
106
              {{- if eq .Op.String "-" -}}
107
              <span class="diff-del">{{ .String }}</span>
108
              {{- end -}}
109
              {{- if eq .Op.String " " -}}
110
              <span class="diff-noop">{{ .String }}</span>
111
              {{- end -}}
112
            {{- end -}}
113
            {{- end -}}
114
          {{- end -}}
115
            </pre>
116
          </div>
117
          </div>
118
        {{ end }}
119
      </section>
120
    </main>
121
  </body>
122
</html>
123
{{ end }}