Files
pages/templates/pages/revisions.gohtml
T
Anya Tokugawa 96065d1e89
Build and publish container images / images (push) Successful in 9m28s
Release container images / release (push) Successful in 19s
fix(revisions): connect safe restore UI and readable change history
2026-11-10 11:34:28 +09:00

122 lines
2.1 KiB
Go Template

{{ define "revisions.gohtml" }}
<!DOCTYPE html>
<html lang="{{ .Locale }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ T "history.title" }} · {{ .WikiName }}</title>
<link
rel="stylesheet"
href="/static/css/main.css"
>
<link
rel="stylesheet"
href="/static/css/revisions.css"
>
<link rel="stylesheet" href="/static/css/theme/base.css">
<link rel="stylesheet" href="{{ .ThemeCSS }}">
</head>
<body class="mode-revisions">
<header class="topbar">
<div class="brand">
<a href="/">{{ .WikiName }}</a>
</div>
<nav>
<a href="/">{{ T "config.home" }}</a>
</nav>
{{ template "auth-menu" . }}</header>
<main class="container">
<section class="card">
<h1>{{ T "history.title" }}</h1>
<p>
Object UUID:
<code>{{ .ObjectUUID }}</code>
</p>
</section>
<section class="revision-timeline">
{{ range $i, $r := .Revisions }}
<article class="revision-card">
<div class="revision-header">
<div>
<code>{{ $r.UUID }}</code>
</div>
<div>
<time data-revision-time="{{ $r.CreatedAt }}">{{ $r.CreatedAt }}</time>
· {{ $r.Language }}
</div>
</div>
<div class="revision-message">
{{ if $r.Message }}{{ $r.Message }}{{ else }}—{{ end }}
</div>
<div class="revision-actions">
{{ if $.CanRestore }}{{ $head := index $.RevisionHeads $r.Language }}{{ if $head }}{{ if ne $head $r.UUID }}
<button type="button" data-restore-revision="{{ $r.UUID }}" data-base-revision="{{ $head }}">{{ T "editor.restore" }}</button>
{{ end }}{{ end }}{{ end }}
<a
class="button"
href="/r/view/{{ $r.UUID }}"
>
{{ T "history.view" }}
</a>
{{ if lt (add $i 1) (len $.Revisions) }}
{{ $prev := index $.Revisions (add $i 1) }}
<a
class="button"
href="/r/diff/{{ $prev.UUID }}/{{ $r.UUID }}"
>
{{ T "history.diff_previous" }}
</a>
{{ end }}
</div>
</article>
{{ end }}
</section>
<nav class="revision-pagination" aria-label="{{ T "history.title" }}">
{{ if .HasPrevious }}<a href="{{ .NewestURL }}">{{ T "history.newest" }}</a>{{ end }}
{{ if .NextURL }}<a href="{{ .NextURL }}" rel="next">{{ T "history.older" }}</a>{{ end }}
</nav>
</main>
<script src="/static/js/revisions.js?v=2" defer></script>
</body>
</html>
{{ end }}