Show the pending changes as a colored diff with line numbers

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 13:46:25 +01:00
co-authored by Claude Sonnet 5.5
parent a3fed902ef
commit 2102207a24
5 changed files with 109 additions and 21 deletions
+5 -3
View File
@@ -1,10 +1,12 @@
{{define "content"}}
{{with .Data}}
{{if .Diff}}
<p>The saved settings differ from the confirmed (running) ones: <code>-</code> lines go away, <code>+</code> lines are new.
{{if .Rows}}
<p>The saved settings differ from the confirmed (running) ones: red lines go away, green lines are new.
Nothing is applied until you press Apply.</p>
{{with .TokenEdit}}<p class="error">{{.}}</p>{{end}}
<pre class="log">{{.Diff}}</pre>
<div class="diff" role="table" aria-label="Changes">
{{range .Rows}}{{if eq .Class "gap"}}<div class="drow gap" role="row"><span class="gaptext">…</span></div>{{else}}<div class="drow {{.Class}}" role="row"><span class="ln" role="cell">{{if .Old}}{{.Old}}{{end}}</span><span class="ln" role="cell">{{if .New}}{{.New}}{{end}}</span><span class="mk" role="cell">{{.Mark}}</span><code role="cell">{{.Text}}</code></div>{{end}}{{end}}
</div>
<div class="actions">
<form method="post" action="/apply"><input type="hidden" name="csrf" value="{{$.CSRF}}"><button>Apply</button></form>
<form method="post" action="/discard"><input type="hidden" name="csrf" value="{{$.CSRF}}"><button class="secondary">Discard changes</button></form>