all repos — legit @ d58151dbb07a5d5dd7eaf6fc9f12566898823a46

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