forked from tangled.org/core
this repo has no description

add next/prev links to commits

Changed files
+18 -2
appview
pages
templates
+18 -2
appview/pages/templates/repo/commit.html
···
{{ $this := $commit.This }}
{{ $parent := $commit.Parent }}
-
{{ range $diff }}
+
{{ $last := sub (len $diff) 1 }}
+
{{ range $idx, $hunk := $diff }}
+
{{ with $hunk }}
<section class="mt-4 border border-black w-full mx-auto">
<div id="file-{{ .Name.New }}">
<div id="diff-file">
···
</div>
<div id="right-side-items" class="p-2">
-
<a href="#file-{{ .Name.New }}" class="no-underline hover:underline">to top of file</a>
+
<a href="#file-{{ .Name.New }}" class="no-underline hover:underline">top of file</a>
+
+
{{ if gt $idx 0 }}
+
&nbsp;·&nbsp;
+
{{ $prev := index $diff (sub $idx 1) }}
+
<a href="#file-{{ $prev.Name.New }}" class="no-underline hover:underline">prev</a>
+
{{ end }}
+
+
+
{{ if lt $idx $last }}
+
&nbsp;·&nbsp;
+
{{ $next := index $diff (add $idx 1) }}
+
<a href="#file-{{ $next.Name.New }}" class="no-underline hover:underline">next</a>
+
{{ end }}
</div>
</div>
···
</div>
</div>
</section>
+
{{ end }}
{{ end }}
{{end}}