Files
modern-glance/internal/glance/templates/admin.html
T
uhlwoogiandClaude Opus 4.7 7f36f30dad Add page management to the structured editor
Pages can now be reordered, renamed, and have their metadata edited
without touching YAML.

- Up/down arrows next to each page in the /edit list to reorder.
- "Settings" button per page opens /edit/pages/{slug}/settings — a
  form covering name, slug, page width, desktop nav width, mobile
  header, hide desktop nav, center vertically.
- POST /edit/api/pages/{slug}/fields applies metadata changes
  surgically via the existing yaml.Node + atomic-save flow so
  columns/widgets/comments stay untouched.
- POST /edit/api/pages/{slug}/move?dir=up|down swaps adjacent pages.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 17:18:52 +00:00

50 lines
2.5 KiB
HTML

{{- template "document.html" . }}
{{- define "document-title" }}Edit - {{ .App.Config.Branding.AppName }}{{ end }}
{{- define "document-body" }}
<div class="flex flex-column body-content">
<main class="content-bounds" style="padding-block: 2rem;">
<h1 class="size-h1 margin-bottom-15">Edit</h1>
<p class="color-subdue margin-bottom-25">
Editing <code>{{ .App.ConfigPath }}</code>. Changes take effect via hot-reload.
</p>
<h2 class="size-h2 margin-bottom-10">Pages</h2>
<ul class="list list-gap-10 margin-bottom-25">
{{- range .Pages }}
<li class="flex items-center gap-10">
<div class="grow">
<a class="color-primary" href="{{ $.App.Config.Server.BaseURL }}/edit/pages/{{ .Slug }}">
{{ .Title }}
</a>
<span class="color-subdue"> — {{ .WidgetCount }} widget{{ if ne .WidgetCount 1 }}s{{ end }}</span>
<div class="color-subdue size-h5">/{{ .Slug }}</div>
</div>
<form method="post" action="{{ $.App.Config.Server.BaseURL }}/edit/api/pages/{{ .Slug }}/move?dir=up">
<button type="submit" {{ if .IsFirst }}disabled{{ end }} title="Move up"></button>
</form>
<form method="post" action="{{ $.App.Config.Server.BaseURL }}/edit/api/pages/{{ .Slug }}/move?dir=down">
<button type="submit" {{ if .IsLast }}disabled{{ end }} title="Move down"></button>
</form>
<a href="{{ $.App.Config.Server.BaseURL }}/edit/pages/{{ .Slug }}/settings" title="Page settings">
<button type="button">Settings</button>
</a>
<form method="post" action="{{ $.App.Config.Server.BaseURL }}/edit/api/pages/{{ .Slug }}/delete"
onsubmit="return confirm('Delete page &quot;{{ .Title }}&quot; and all its widgets?');">
<button type="submit" class="color-negative">Delete</button>
</form>
</li>
{{- end }}
</ul>
<h3 class="size-h3 margin-bottom-10">Add a page</h3>
<form method="post" action="{{ .App.Config.Server.BaseURL }}/edit/api/pages" class="flex gap-10 items-center">
<input type="text" name="title" required placeholder="Page title" class="input grow">
<button type="submit">Add page</button>
</form>
</main>
{{ template "footer.html" . }}
</div>
{{- end }}