Add per-page backgrounds to canvas pages
Each canvas page key (the landing page, /stp, shrines and other admin-made pages) can have its own background: a colour, an image and how the image fills the window. Admins set it from a Background button beside Edit layout, with live preview and image upload or drop; DefaultLayout paints it behind the whole window and falls back to the halftone. Backed by a new Background GraphQL type keyed by page key, validated server-side, hidden with admin-only pages, and moved or deleted along with its page. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# The background behind a canvas page, keyed by the same page key as its
|
||||
# boxes ("index" for the landing page, "stp", or a Page's slug), so the
|
||||
# landing page and every shrine are set the same way. Edited from the
|
||||
# canvas's "Background" button; see models.Background.
|
||||
#
|
||||
# Anyone may read it, as part of the page, except that an adminOnly page's
|
||||
# background is null to everyone but an admin.
|
||||
|
||||
type Background {
|
||||
id: ID!
|
||||
updatedAt: Time!
|
||||
page: String!
|
||||
# A CSS colour, or "" for the theme's page colour.
|
||||
color: String!
|
||||
# An image URL, or "" for none.
|
||||
image: String!
|
||||
# "cover", "contain" or "tile".
|
||||
fit: String!
|
||||
}
|
||||
|
||||
input BackgroundInput {
|
||||
color: String!
|
||||
image: String!
|
||||
fit: String!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
# Null when the page has none, i.e. shows the theme's default.
|
||||
background(page: String!): Background
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
# Creates or replaces the page's background.
|
||||
setBackground(page: String!, input: BackgroundInput!): Background! @admin
|
||||
# Back to the theme's default. True if there was one to remove.
|
||||
clearBackground(page: String!): Boolean! @admin
|
||||
}
|
||||
Reference in New Issue
Block a user