feat(manage): add /manage pages to edit caption and date
/manage lists every photo; /manage/edit/{slug} rewrites the photo's
.toml sidecar, which triggers a rebuild. The pages sit behind the same
htpasswd as /upload and are not linked from the public site.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
<!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>Edit — {{.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; }
|
||||
.edit-page {
|
||||
max-width: 520px;
|
||||
margin: 0 auto;
|
||||
padding: 32px 20px;
|
||||
}
|
||||
.edit-page .back-btn {
|
||||
color: var(--fg3);
|
||||
text-decoration: none;
|
||||
font-size: 15px;
|
||||
}
|
||||
.edit-page .back-btn:hover { color: var(--fg); }
|
||||
.edit-page h2 {
|
||||
font-family: var(--serif);
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: var(--fg);
|
||||
margin: 16px 0 24px;
|
||||
}
|
||||
.edit-img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-height: 340px;
|
||||
object-fit: contain;
|
||||
background: var(--bg0);
|
||||
border: 1px solid var(--bg2);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.edit-slug {
|
||||
font-size: 12px;
|
||||
color: var(--fg4);
|
||||
font-family: monospace;
|
||||
margin-bottom: 24px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.field { margin-bottom: 18px; }
|
||||
.field label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: var(--fg4);
|
||||
font-family: monospace;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.field input[type="text"],
|
||||
.field input[type="date"] {
|
||||
width: 100%;
|
||||
background: var(--bg0);
|
||||
border: 1px solid var(--bg2);
|
||||
color: var(--fg);
|
||||
font-size: 16px;
|
||||
padding: 10px 12px;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.field input[type="text"] { font-family: var(--serif); }
|
||||
.field input[type="date"] { font-family: monospace; font-size: 14px; color-scheme: dark; }
|
||||
.field input:focus { border-color: var(--fg4); }
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
background: var(--bg1);
|
||||
border: 1px solid var(--bg2);
|
||||
color: var(--fg2);
|
||||
font-family: var(--serif);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
padding: 12px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s, color 0.2s;
|
||||
}
|
||||
.submit-btn:hover { background: var(--bg2); color: var(--fg); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="edit-page">
|
||||
<a href="/manage" class="back-btn">← Manage</a>
|
||||
<h2>Edit photo</h2>
|
||||
|
||||
<img class="edit-img" src="/{{.Photo.Medium}}" alt="">
|
||||
<p class="edit-slug">{{.Photo.Slug}}</p>
|
||||
|
||||
<!-- A plain form post, no script: the server answers with a redirect
|
||||
back to /manage, so a reload never resubmits the edit. -->
|
||||
<form method="post" action="/manage/edit/{{.Photo.Slug}}">
|
||||
<div class="field">
|
||||
<label for="caption">Caption</label>
|
||||
<input type="text" id="caption" name="caption" value="{{.Photo.Caption}}" autocomplete="off" autofocus>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="date">Date</label>
|
||||
<input type="date" id="date" name="date" value="{{.Photo.Date.Format "2006-01-02"}}" required>
|
||||
</div>
|
||||
|
||||
<button class="submit-btn" type="submit">Save changes</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,114 @@
|
||||
<!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>Manage — Photo Gallery</title>
|
||||
<link rel="stylesheet" href="{{.FontsURL}}">
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
<style>
|
||||
:root { --serif: '{{.SerifFamily}}', Georgia, serif; --mj: '{{.MlFamily}}', sans-serif; }
|
||||
.manage-page {
|
||||
max-width: 720px;
|
||||
margin: 0 auto;
|
||||
padding: 32px 20px;
|
||||
}
|
||||
.manage-page .back-btn {
|
||||
color: var(--fg3);
|
||||
text-decoration: none;
|
||||
font-size: 15px;
|
||||
}
|
||||
.manage-page .back-btn:hover { color: var(--fg); }
|
||||
.manage-page h2 {
|
||||
font-family: var(--serif);
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: var(--fg);
|
||||
margin: 16px 0 6px;
|
||||
}
|
||||
.manage-count {
|
||||
font-size: 12px;
|
||||
color: var(--fg4);
|
||||
font-family: monospace;
|
||||
letter-spacing: 0.04em;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.saved {
|
||||
margin-bottom: 20px;
|
||||
font-size: 13px;
|
||||
font-family: monospace;
|
||||
padding: 10px 12px;
|
||||
background: #1d2e1d;
|
||||
color: #b8bb26;
|
||||
border: 1px solid #344d28;
|
||||
}
|
||||
.mlist { list-style: none; }
|
||||
.mrow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 12px 0;
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
.mrow img {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
object-fit: cover;
|
||||
background: var(--bg0);
|
||||
flex: none;
|
||||
}
|
||||
.minfo { flex: 1; min-width: 0; }
|
||||
.mcaption {
|
||||
font-size: 17px;
|
||||
color: var(--fg);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.mdate {
|
||||
font-size: 12px;
|
||||
color: var(--fg4);
|
||||
font-family: monospace;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.mactions {
|
||||
flex: none;
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.mactions a { color: var(--fg3); text-decoration: none; }
|
||||
.mactions a:hover { color: var(--fg); }
|
||||
.mactions .medit { color: var(--aqua); }
|
||||
.mempty { color: var(--fg4); font-size: 15px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="manage-page">
|
||||
<a href="/" class="back-btn">← Gallery</a>
|
||||
<h2>Manage photos</h2>
|
||||
<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 .Photos}}
|
||||
<ul class="mlist">
|
||||
{{range .Photos}}
|
||||
<li class="mrow">
|
||||
<img src="/{{.Thumb}}" alt="" loading="lazy">
|
||||
<div class="minfo">
|
||||
<p class="mcaption">{{.Caption}}</p>
|
||||
<p class="mdate">{{.Date.Format "2006-01-02"}}</p>
|
||||
</div>
|
||||
<div class="mactions">
|
||||
<a href="/photo/{{.Slug}}/">View</a>
|
||||
<a href="/manage/edit/{{.Slug}}" class="medit">Edit</a>
|
||||
</div>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{else}}
|
||||
<p class="mempty">No photos yet.</p>
|
||||
{{end}}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user