forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

add next/prev links to commits

Changed files
+18 -2
appview
pages
templates
+18 -2
appview/pages/templates/repo/commit.html
··· 61 {{ $this := $commit.This }} 62 {{ $parent := $commit.Parent }} 63 64 - {{ range $diff }} 65 <section class="mt-4 border border-black w-full mx-auto"> 66 <div id="file-{{ .Name.New }}"> 67 <div id="diff-file"> ··· 91 </div> 92 93 <div id="right-side-items" class="p-2"> 94 - <a href="#file-{{ .Name.New }}" class="no-underline hover:underline">to top of file</a> 95 </div> 96 97 </div> ··· 127 </div> 128 </div> 129 </section> 130 {{ end }} 131 132 {{end}}
··· 61 {{ $this := $commit.This }} 62 {{ $parent := $commit.Parent }} 63 64 + {{ $last := sub (len $diff) 1 }} 65 + {{ range $idx, $hunk := $diff }} 66 + {{ with $hunk }} 67 <section class="mt-4 border border-black w-full mx-auto"> 68 <div id="file-{{ .Name.New }}"> 69 <div id="diff-file"> ··· 93 </div> 94 95 <div id="right-side-items" class="p-2"> 96 + <a href="#file-{{ .Name.New }}" class="no-underline hover:underline">top of file</a> 97 + 98 + {{ if gt $idx 0 }} 99 + &nbsp;·&nbsp; 100 + {{ $prev := index $diff (sub $idx 1) }} 101 + <a href="#file-{{ $prev.Name.New }}" class="no-underline hover:underline">prev</a> 102 + {{ end }} 103 + 104 + 105 + {{ if lt $idx $last }} 106 + &nbsp;·&nbsp; 107 + {{ $next := index $diff (add $idx 1) }} 108 + <a href="#file-{{ $next.Name.New }}" class="no-underline hover:underline">next</a> 109 + {{ end }} 110 </div> 111 112 </div> ··· 142 </div> 143 </div> 144 </section> 145 + {{ end }} 146 {{ end }} 147 148 {{end}}