aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/templates/dashboard/page_form.html
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2026-09-18 14:32:22 +0300
committergrm <grm@eyesin.space>2026-09-18 14:32:22 +0300
commit0fc470a8d588cac1a51cc4b3e1a2237dc56041c9 (patch)
treef4cde97479977d46046bc18953a1d0ecc3686165 /internal/web/templates/dashboard/page_form.html
parenta2b2574538c30278f4edd8e6b2704a176a7750a2 (diff)
downloadblogspace-0fc470a8d588cac1a51cc4b3e1a2237dc56041c9.tar.gz
blogspace-0fc470a8d588cac1a51cc4b3e1a2237dc56041c9.tar.bz2
blogspace-0fc470a8d588cac1a51cc4b3e1a2237dc56041c9.zip
Special pages: a gallery page of the blog's images
A page's kind says what it shows between its intro and outro: posts, as before, or something special. The first special kind is a gallery — every image in the files library as a masonry wall (CSS columns, no script), newest first, each linked to its full-size file. The page form lists the library's images with a Hide tick per picture; exclusions are stored (page_hidden_files) rather than inclusions so a new upload shows up without editing the page, and the design's own pictures — logo, favicon, header and background image — are never shown. Special pages keep the page chrome (menu, announcements, home, ordering) but hold no posts: the post forms skip them and a forced page id is refused. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A
Diffstat (limited to 'internal/web/templates/dashboard/page_form.html')
-rw-r--r--internal/web/templates/dashboard/page_form.html15
1 files changed, 13 insertions, 2 deletions
diff --git a/internal/web/templates/dashboard/page_form.html b/internal/web/templates/dashboard/page_form.html
index 4ee720b..5b47d05 100644
--- a/internal/web/templates/dashboard/page_form.html
+++ b/internal/web/templates/dashboard/page_form.html
@@ -1,9 +1,12 @@
-{{define "title"}}{{if .Data.page.ID}}{{t "Edit page"}}{{else}}{{t "New page"}}{{end}} · {{.Blog.Title}}{{end}}
+{{define "title"}}{{template "pageformtitle" .}} · {{.Blog.Title}}{{end}}
+{{define "pageformtitle"}}{{if eq .Data.page.Kind "gallery"}}{{if .Data.page.ID}}{{t "Edit gallery page"}}{{else}}{{t "New gallery page"}}{{end}}{{else}}{{if .Data.page.ID}}{{t "Edit page"}}{{else}}{{t "New page"}}{{end}}{{end}}{{end}}
{{define "content"}}
<div class="card">
- <h1>{{if .Data.page.ID}}{{t "Edit page"}}{{else}}{{t "New page"}}{{end}}</h1>
+ <h1>{{template "pageformtitle" .}}</h1>
+ {{if eq .Data.page.Kind "gallery"}}<p class="lead muted">{{t "A gallery page shows every image in your files as a wall of pictures, newest first, between its intro and closing text."}}</p>{{end}}
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="_csrf" value="{{.CSRF}}">
+ {{if not .Data.page.ID}}<input type="hidden" name="kind" value="{{.Data.page.Kind}}">{{end}}
<label>{{t "Title"}}<br><input name="title" value="{{.Data.page.Title}}" required maxlength="120"></label>
<label>{{t "Address"}} <span class="muted">({{t "leave empty to make one from the title; e.g."}} <code>about</code> → {{.BlogURL}}/about)</span><br>
<input name="slug" value="{{.Data.page.Slug}}" pattern="[a-z0-9]([a-z0-9-]*[a-z0-9])?" maxlength="80"></label>
@@ -11,6 +14,14 @@
{{template "editor" (dict "name" "intro" "value" .Data.page.IntroMD "format" .Data.page.Format "rows" 8 "tall" false "upload" (print "/b/" .Blog.Subdomain "/files/upload") "preview" (print "/b/" .Blog.Subdomain "/preview") "csrf" .CSRF)}}
<label for="ed-outro">{{t "Closing text"}} <span class="muted">({{t "shown after the posts, in the same format; optional"}})</span></label>
{{template "editor" (dict "name" "outro" "value" .Data.page.OutroMD "format" .Data.page.Format "formatof" "intro" "rows" 8 "tall" false "upload" (print "/b/" .Blog.Subdomain "/files/upload") "preview" (print "/b/" .Blog.Subdomain "/preview") "csrf" .CSRF)}}
+ {{if eq .Data.page.Kind "gallery"}}
+ <h2>{{t "Images"}}</h2>
+ <p class="muted small">{{t "Every image in your files is shown except the ones ticked here. The logo, favicon, header and background images are never shown."}}</p>
+ {{if .Data.images}}<div class="imagegrid hidegrid">
+ {{range .Data.images}}<label class="pick"><img src="/b/{{$.Blog.Subdomain}}/media/{{.ID}}" alt="" loading="lazy"><span class="name" title="{{.Filename}}">{{.Filename}}</span><span class="hide"><input type="checkbox" name="hide" value="{{.ID}}"{{if index $.Data.hidden .ID.String}} checked{{end}}> {{t "Hide"}}</span></label>{{end}}
+ </div>
+ {{else}}<p class="muted">{{t "No images in your files yet."}} <a href="/b/{{.Blog.Subdomain}}/files">{{t "Files"}}</a></p>{{end}}
+ {{end}}
<label class="check"><input type="checkbox" name="show_in_nav"{{if .Data.page.ShowInNav}} checked{{end}}> {{t "Show in menu"}}</label>
<label class="check"><input type="checkbox" name="show_notices"{{if .Data.page.ShowNotices}} checked{{end}}> {{t "Show announcements on this page"}}</label>
<p class="actionrow">