all repos

mugit @ 3362e0d

🐮 git server that your cow will love

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

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ui: redesign commit page, 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
          <div>
29
            <strong>Parent:</strong>
30
            {{ range $i, $p := .parents -}}
31
            {{ if $i }}, {{ end -}}
32
            <a href="/{{ $.name }}/commit/{{ $p }}">{{ $p }}</a>
33
            {{- end }}
34
          </div>
35
        </div>
36
37
        {{ if gt (len .diff) 1 -}}
38
        <div class="jump">
39
          <strong>jump to</strong>
40
          <table class="table jump-table">
41
            <tbody>
42
              {{ range .diff }}
43
              {{ $path := .Name.New }}
44
              {{ if not $path }}{{ $path = .Name.Old }}{{ end }}
45
              <tr>
46
                <td class="diff-type">
47
                  {{ if .IsNew }}<span class="diff-type diff-add">A</span>{{ end }}
48
                  {{ if .IsDelete }}<span class="diff-type diff-del">D</span>{{ end }}
49
                  {{ if not (or .IsNew .IsDelete) }}<span class="diff-type diff-mod">M</span>{{ end }}
50
                </td>
51
                <td class="fill">
52
                  <a href="#{{ $path }}">
53
                    {{ if and .Name.Old .Name.New }}{{ .Name.Old }} &#8594; {{ .Name.New }}{{ else }}{{ $path }}{{ end }}
54
                  </a>
55
                </td>
56
              </tr>
57
              {{ end }}
58
            </tbody>
59
          </table>
60
        </div>
61
        {{ end }}
62
      </section>
63
      <section>
64
        {{ $repo := .name }}
65
        {{ $this := .commit.Hash }}
66
        {{ $parent := index .parents 0 }}
67
        {{ range .diff }}
68
          {{ $path := .Name.New }}
69
          {{ if not $path }}{{ $path = .Name.Old }}{{ end }}
70
          <div id="{{ $path }}">
71
            <div class="diff">
72
            {{ if .IsNew }}
73
            <span class="diff-type diff-add">A</span>
74
            {{ end }}
75
            {{ if .IsDelete }}
76
            <span class="diff-type diff-del">D</span>
77
            {{ end }}
78
            {{ if not (or .IsNew .IsDelete) }}
79
            <span class="diff-type diff-mod">M</span>
80
            {{ end }}
81
          {{ if .Name.Old }}
82
          <a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>
83
          {{ if .Name.New }}
84
            &#8594;
85
            <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
86
          {{ end }}
87
          {{ else }}
88
          <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
89
          {{- end -}}
90
          {{ if .IsBinary }}
91
          <p>Not showing binary file.</p>
92
          {{ else }}
93
            <pre>
94
            {{- range .TextFragments -}}
95
            <p>{{- .Header -}}</p>
96
            {{- range .Lines -}}
97
              {{- if eq .Op.String "+" -}}
98
              <span class="diff-add">{{ .String }}</span>
99
              {{- end -}}
100
              {{- if eq .Op.String "-" -}}
101
              <span class="diff-del">{{ .String }}</span>
102
              {{- end -}}
103
              {{- if eq .Op.String " " -}}
104
              <span class="diff-noop">{{ .String }}</span>
105
              {{- end -}}
106
            {{- end -}}
107
            {{- end -}}
108
          {{- end -}}
109
            </pre>
110
          </div>
111
          </div>
112
        {{ end }}
113
      </section>
114
    </main>
115
  </body>
116
</html>
117
{{ end }}