legit/templates/commit.html

105 lines
3 KiB
HTML
Raw 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>
2022-12-18 14:30:19 +00:00
<div class="commit-info">
{{ .commit.Author.Name }} <span class="commit-email">{{ .commit.Author.Email}}</span>
<div>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
</div>
<div>
<strong>commit</strong>
<p><a href="/{{ .name }}/commit/{{ .commit.This }}">
2022-12-12 11:47:49 +00:00
{{ .commit.This }}
</a>
</p>
</div>
2022-12-18 05:12:18 +00:00
{{ if .commit.Parent }}
<div>
<strong>parent</strong>
<p><a href="/{{ .name }}/commit/{{ .commit.Parent }}">
2022-12-12 11:47:49 +00:00
{{ .commit.Parent }}
</a></p>
</div>
2022-12-18 05:12:18 +00:00
{{ end }}
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 }}
{{ $parent := .commit.Parent }}
2022-12-12 11:47:49 +00:00
{{ range .diff }}
2022-12-17 17:05:48 +00:00
<div id="{{ .Name.New }}">
2022-12-19 12:37:13 +00:00
<div class="diff">
{{ if .IsNew }}
<span class="diff-type">A</span>
{{ end }}
{{ if .IsDelete }}
<span class="diff-type">D</span>
{{ end }}
{{ if not (or .IsNew .IsDelete) }}
<span class="diff-type">M</span>
{{ end }}
2022-12-12 11:47:49 +00:00
{{ if .Name.Old }}
<a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>
2022-12-19 12:19:32 +00:00
{{ if .Name.New }}
&#8594;
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
{{ end }}
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-19 06:06:50 +00:00
{{ if .IsBinary }}
<p>Not showing binary file.</p>
{{ else }}
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 -}}
2022-12-19 06:06:50 +00:00
{{- end -}}
2022-12-12 11:47:49 +00:00
</pre>
2022-12-17 17:05:48 +00:00
</div>
2022-12-19 16:45:03 +00:00
</div>
2022-12-12 11:47:49 +00:00
{{ end }}
</section>
</main>
</body>
</html>
{{ end }}