Make the box canvas reusable: canvas pages, admin-only boxes, landing notes
The /stp canvas is now BoxCanvas.vue, keyed by a page. Boxes carry a
page ("stp", "index" for the landing page's notes overlay, or a Page
slug) and an adminOnly flag that the boxes resolver filters server-side.
A new Page type lets the admin create canvas pages in the browser,
served at /<slug> by the router's catch-all (CanvasPage.vue), starting
from a Blank, Shrine or Notes-board layout. Slugs that an SPA or nginx
route would answer first are refused. Renaming a page moves its boxes;
deleting it deletes them.
The GTO, Evangelion and Skipskipbenben placeholder routes are dropped
in favour of canvas pages listed on /shrines, which the landing page
now links to. The box editor gains an admin-only toggle and an
upload-and-insert button, and there are Note, Heading, Text, Gallery
and Video templates.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# Boxes on the home page canvas (/stp). Anyone may read the layout — it is
|
||||
# the page — but only an admin may change it. x/y/w/h are px on a fixed
|
||||
# 1400px-wide design canvas; see models.Box.
|
||||
# Boxes on a canvas page: the home page (/stp, page "stp"), the landing
|
||||
# page's overlay (page "index") or an admin-created Page (page = its slug).
|
||||
# Anyone may read a page's layout — it is the page — but only an admin may
|
||||
# change it, and adminOnly boxes are only ever returned to an admin. x/y/w/h
|
||||
# are px on a fixed 1400px-wide design canvas; see models.Box.
|
||||
#
|
||||
# kind is "widget" (a built-in Vue component named by `widget`) or "html"
|
||||
# (`html` rendered in a sandboxed iframe on the front end).
|
||||
@@ -9,6 +11,7 @@ type Box {
|
||||
id: ID!
|
||||
createdAt: Time!
|
||||
updatedAt: Time!
|
||||
page: String!
|
||||
kind: String!
|
||||
widget: String
|
||||
html: String
|
||||
@@ -20,9 +23,11 @@ type Box {
|
||||
z: Int!
|
||||
framed: Boolean!
|
||||
hideOnMobile: Boolean!
|
||||
adminOnly: Boolean!
|
||||
}
|
||||
|
||||
input CreateBoxInput {
|
||||
page: String!
|
||||
kind: String!
|
||||
widget: String
|
||||
html: String
|
||||
@@ -34,6 +39,7 @@ input CreateBoxInput {
|
||||
z: Int
|
||||
framed: Boolean
|
||||
hideOnMobile: Boolean
|
||||
adminOnly: Boolean
|
||||
}
|
||||
|
||||
input UpdateBoxInput {
|
||||
@@ -47,10 +53,11 @@ input UpdateBoxInput {
|
||||
z: Int
|
||||
framed: Boolean
|
||||
hideOnMobile: Boolean
|
||||
adminOnly: Boolean
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
boxes: [Box!]!
|
||||
boxes(page: String!): [Box!]!
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Admin-created canvas pages. A page is just a slug and a title; its content
|
||||
# is the boxes whose `page` is the slug (see box.graphql). The SPA serves it
|
||||
# at /<slug> through its catch-all route, so a slug may not start with a path
|
||||
# the site already uses — see validateSlug in page_helpers.go.
|
||||
#
|
||||
# adminOnly pages, and their boxes, are invisible to everyone but an admin:
|
||||
# `page` answers null and `pages` leaves them out.
|
||||
|
||||
type Page {
|
||||
id: ID!
|
||||
createdAt: Time!
|
||||
updatedAt: Time!
|
||||
slug: String!
|
||||
title: String!
|
||||
adminOnly: Boolean!
|
||||
}
|
||||
|
||||
input CreatePageInput {
|
||||
slug: String!
|
||||
title: String!
|
||||
adminOnly: Boolean
|
||||
}
|
||||
|
||||
input UpdatePageInput {
|
||||
slug: String
|
||||
title: String
|
||||
adminOnly: Boolean
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
pages: [Page!]!
|
||||
page(slug: String!): Page
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
createPage(input: CreatePageInput!): Page! @admin
|
||||
# Renaming a page moves its boxes with it.
|
||||
updatePage(id: ID!, input: UpdatePageInput!): Page! @admin
|
||||
# Deletes the page's boxes too.
|
||||
deletePage(id: ID!): Page! @admin
|
||||
}
|
||||
Reference in New Issue
Block a user