all repos

mugit @ 6e88b48c21e672351799572fe3a7b74cebe7178e

🐮 git server that your cow will love

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

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