feat(manage): delete photos from /manage, prune leftover pages
/manage/delete/{slug} asks for confirmation, then removes the image,
its sidecar and everything generated from them. Builds now drop day
pages of days without photos and pager pages past the last one, so a
delete or a date change leaves nothing behind.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Delete — {{.Photo.Caption}}</title>
|
||||
<link rel="stylesheet" href="{{.FontsURL}}">
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
<style>
|
||||
:root { --serif: '{{.SerifFamily}}', Georgia, serif; --mj: '{{.MlFamily}}', sans-serif; }
|
||||
.delete-page {
|
||||
max-width: 520px;
|
||||
margin: 0 auto;
|
||||
padding: 32px 20px;
|
||||
}
|
||||
.delete-page .back-btn {
|
||||
color: var(--fg3);
|
||||
text-decoration: none;
|
||||
font-size: 15px;
|
||||
}
|
||||
.delete-page .back-btn:hover { color: var(--fg); }
|
||||
.delete-page h2 {
|
||||
font-family: var(--serif);
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: var(--fg);
|
||||
margin: 16px 0 24px;
|
||||
}
|
||||
.delete-img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-height: 340px;
|
||||
object-fit: contain;
|
||||
background: var(--bg0);
|
||||
border: 1px solid var(--bg2);
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.delete-caption {
|
||||
font-size: 18px;
|
||||
color: var(--fg);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.delete-meta {
|
||||
font-size: 12px;
|
||||
color: var(--fg4);
|
||||
font-family: monospace;
|
||||
margin: 4px 0 24px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.delete-warning {
|
||||
font-size: 13px;
|
||||
font-family: monospace;
|
||||
line-height: 1.5;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 20px;
|
||||
background: #2e1d1d;
|
||||
color: #fb4934;
|
||||
border: 1px solid #5a2828;
|
||||
}
|
||||
.delete-btn {
|
||||
width: 100%;
|
||||
background: #2e1d1d;
|
||||
border: 1px solid #5a2828;
|
||||
color: #fb4934;
|
||||
font-family: var(--serif);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
padding: 12px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s, color 0.2s;
|
||||
}
|
||||
.delete-btn:hover { background: #5a2828; color: var(--fg); }
|
||||
.cancel-btn {
|
||||
display: block;
|
||||
margin-top: 12px;
|
||||
padding: 12px;
|
||||
text-align: center;
|
||||
background: var(--bg1);
|
||||
border: 1px solid var(--bg2);
|
||||
color: var(--fg2);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
}
|
||||
.cancel-btn:hover { background: var(--bg2); color: var(--fg); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="delete-page">
|
||||
<a href="/manage" class="back-btn">← Manage</a>
|
||||
<h2>Delete photo</h2>
|
||||
|
||||
<img class="delete-img" src="/{{.Photo.Medium}}" alt="">
|
||||
<p class="delete-caption">{{.Photo.Caption}}</p>
|
||||
<p class="delete-meta">{{.Photo.Date.Format "2006-01-02"}} · {{.Photo.Slug}}</p>
|
||||
|
||||
<p class="delete-warning">This removes the photo, its caption and every
|
||||
page and image generated from it. It cannot be undone.</p>
|
||||
|
||||
<form method="post" action="/manage/delete/{{.Photo.Slug}}">
|
||||
<button class="delete-btn" type="submit">Delete permanently</button>
|
||||
</form>
|
||||
<a href="/manage" class="cancel-btn">Cancel</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -79,6 +79,7 @@
|
||||
.mactions a { color: var(--fg3); text-decoration: none; }
|
||||
.mactions a:hover { color: var(--fg); }
|
||||
.mactions .medit { color: var(--aqua); }
|
||||
.mactions .mdelete { color: #fb4934; }
|
||||
.mempty { color: var(--fg4); font-size: 15px; }
|
||||
</style>
|
||||
</head>
|
||||
@@ -89,6 +90,7 @@
|
||||
<p class="manage-count">{{len .Photos}} {{if eq (len .Photos) 1}}photo{{else}}photos{{end}}</p>
|
||||
|
||||
{{if .Saved}}<p class="saved">✓ saved “{{.Saved}}”</p>{{end}}
|
||||
{{if .Deleted}}<p class="saved">✓ deleted “{{.Deleted}}”</p>{{end}}
|
||||
|
||||
{{if .Photos}}
|
||||
<ul class="mlist">
|
||||
@@ -102,6 +104,7 @@
|
||||
<div class="mactions">
|
||||
<a href="/photo/{{.Slug}}/">View</a>
|
||||
<a href="/manage/edit/{{.Slug}}" class="medit">Edit</a>
|
||||
<a href="/manage/delete/{{.Slug}}" class="mdelete">Delete</a>
|
||||
</div>
|
||||
</li>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user