all repos — legit @ 3e6a720154b70a9882af14399548e494b1d0089f

fork of git.icyphox.sh/legit

templates/commit.html

{{ define "commit" }}
<html>
{{ template "head" . }}

  <header>
    <h1>{{ .meta.Title }}</h1>
    <h2>{{ .meta.Description }}</h2>
  </header>
  <body>
    {{ template "nav" . }}
    <main>
      <section class="commit">
        <pre>
          {{- .commit.Message -}}
        </pre>
        <p>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</p>
        <p>{{ .commit.Author.Name }} <span class="commit-email">{{ .commit.Author.Email}}</span></p>
        <p>commit: <a href="/{{ .name }}/commit/{{ .commit.This }}">
          {{ .commit.This }}
        </a>
        </p>
        <p>parent: <a href="/{{ .name }}/commit/{{ .commit.Parent }}">
          {{ .commit.Parent }}
        </a>
        </p>
        <div class="diff-stat">
          <div>
          {{ .stat.FilesChanged }} files changed,
          {{ .stat.Insertions }} insertions(+),
          {{ .stat.Deletions }} deletions(-)
          </div>
          <div>
            <br>
            <p>jump to:</p>
            {{ range .diff }}
            <ul>
            <li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li>
            </ul>
            {{ end }}
          </div>
        </div>
      </section>
      <section>
        {{ $repo := .name }}
        {{ $this := .commit.This }}
        {{ range .diff }}
          <div class="diff">
          <div id="{{ .Name.New }}">
          {{ if .Name.Old }}
          <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.Old }}">{{ .Name.Old }}</a> &#8594; 
          <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
          {{ else }}
          <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
          {{- end -}}
          </div>

            <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 -}}
            </pre>
          </div>
        {{ end }}
      </section>
    </main>
  </body>
</html>
{{ end }}