Add saved layouts, and make /stp an ordinary canvas page
A layout is a named copy of one canvas page's boxes and background (models.Layout, layout.graphql), saved from the canvas's new Layouts button and loaded onto any page from there or from the admin Pages tab. Loading onto a page with boxes asks whether to replace them or add on top; a replace first saves the page as a "<page> before <layout>" layout so it can be undone. Copies, not links: editing a page never changes a layout or another page. The copying is server-side in one transaction, and everything is @admin since a layout keeps admin-only boxes. /stp loses its static route and becomes a Page with slug "stp", created once at start-up (ensureStpPage), so it can be renamed, hidden or deleted like a shrine. Its boxes were already keyed "stp". Home3.vue is kept as legacy; its starter is now "Old /stp grid" in pageStarters.js. ConfirmDialog gains an optional second button. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -24,11 +24,11 @@ const maxSlugLen = 100
|
||||
// reservedFirstSegments are paths a page could never be reached at, because
|
||||
// nginx or one of the SPA's own routes answers them first (see
|
||||
// nginx/nginx_routes.conf.template and vue/src/router/index.js), plus the
|
||||
// built-in canvases' page keys, whose boxes a page of the same slug would
|
||||
// share. "shrines" is deliberately absent: /shrines and the shrine pages under
|
||||
// it are all canvas pages.
|
||||
// landing page's key "index", whose boxes a page of the same slug would
|
||||
// share. "shrines" and "stp" are deliberately absent: /shrines, the shrine
|
||||
// pages under it and the home page /stp are all canvas pages.
|
||||
var reservedFirstSegments = map[string]bool{
|
||||
"stp": true, "stp2": true, "index": true, "admin": true, "cv": true,
|
||||
"stp2": true, "index": true, "admin": true, "cv": true,
|
||||
"automata": true, "hotels": true, "api": true, "py": true, "radio": true,
|
||||
"gitea": true, "notes": true, "sb": true, "jobs": true, "tracker": true,
|
||||
"usaco": true, "uploads": true, "img": true, "fonts": true, "pdf": true,
|
||||
@@ -52,7 +52,7 @@ func validateSlug(slug string) error {
|
||||
}
|
||||
|
||||
// pageHiddenFrom reports whether the page with this key is an adminOnly page
|
||||
// and the caller is not an admin. A key with no Page row (a built-in canvas,
|
||||
// and the caller is not an admin. A key with no Page row (the landing page,
|
||||
// or a page that doesn't exist) is not hidden.
|
||||
func pageHiddenFrom(ctx context.Context, db *gorm.DB, key string) (bool, error) {
|
||||
if IsAdminFromCtx(ctx) {
|
||||
|
||||
Reference in New Issue
Block a user