legit/templates/commit.html

79 lines
2.3 KiB
HTML
Raw Permalink Normal View History

2022-12-12 11:47:49 +00:00
{{ define "commit" }}
<html>
{{ template "head" . }}
2022-12-18 05:12:18 +00:00
{{ template "repoheader" . }}
2022-12-12 11:47:49 +00:00
<body>
{{ template "nav" . }}
<main>
2022-12-17 17:05:48 +00:00
<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>
2022-12-12 11:47:49 +00:00
<p>commit: <a href="/{{ .name }}/commit/{{ .commit.This }}">
{{ .commit.This }}
</a>
</p>
2022-12-18 05:12:18 +00:00
{{ if .commit.Parent }}
2022-12-12 11:47:49 +00:00
<p>parent: <a href="/{{ .name }}/commit/{{ .commit.Parent }}">
{{ .commit.Parent }}
</a>
2022-12-18 05:12:18 +00:00
{{ end }}
2022-12-12 11:47:49 +00:00
</p>
2022-12-17 17:05:48 +00:00
<div class="diff-stat">
<div>
{{ .stat.FilesChanged }} files changed,
2022-12-12 11:47:49 +00:00
{{ .stat.Insertions }} insertions(+),
{{ .stat.Deletions }} deletions(-)
2022-12-17 17:05:48 +00:00
</div>
<div>
<br>
<p>jump to:</p>
{{ range .diff }}
<ul>
<li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li>
</ul>
{{ end }}
</div>
</div>
2022-12-12 11:47:49 +00:00
</section>
<section>
2022-12-17 17:05:48 +00:00
{{ $repo := .name }}
{{ $this := .commit.This }}
2022-12-12 11:47:49 +00:00
{{ range .diff }}
2022-12-17 17:05:48 +00:00
<div class="diff">
<div id="{{ .Name.New }}">
2022-12-12 11:47:49 +00:00
{{ if .Name.Old }}
2022-12-17 17:05:48 +00:00
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.Old }}">{{ .Name.Old }}</a> &#8594;
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
2022-12-12 11:47:49 +00:00
{{ else }}
2022-12-17 17:05:48 +00:00
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
2022-12-12 11:47:49 +00:00
{{- end -}}
2022-12-17 17:05:48 +00:00
</div>
2022-12-12 11:47:49 +00:00
<pre>
{{- range .TextFragments -}}
<p>{{- .Header -}}</p>
2022-12-17 17:05:48 +00:00
{{- range .Lines -}}
{{- if eq .Op.String "+" -}}
<span class="diff-add">{{ .String }}</span>
2022-12-12 11:47:49 +00:00
{{- end -}}
2022-12-17 17:05:48 +00:00
{{- if eq .Op.String "-" -}}
<span class="diff-del">{{ .String }}</span>
{{- end -}}
{{- if eq .Op.String " " -}}
<span class="diff-noop">{{ .String }}</span>
{{- end -}}
{{- end -}}
2022-12-12 11:47:49 +00:00
{{- end -}}
</pre>
2022-12-17 17:05:48 +00:00
</div>
2022-12-12 11:47:49 +00:00
{{ end }}
</section>
</main>
</body>
</html>
{{ end }}