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:
@@ -16,6 +16,7 @@ import CreateActivity from "./CreateActivity.vue";
|
||||
import CreateRowing from "./CreateRowing.vue";
|
||||
import CreateBookmark from "./CreateBookmark.vue";
|
||||
import CreatePlace from "./CreatePlace.vue";
|
||||
import ManagePages from "./ManagePages.vue";
|
||||
import ManageUsers from "./ManageUsers.vue";
|
||||
import ManageRadio from "./ManageRadio.vue";
|
||||
import Environment from "./Environment.vue";
|
||||
@@ -31,6 +32,7 @@ const sections = [
|
||||
{ id: "rowing", label: "Rowing", component: CreateRowing },
|
||||
{ id: "bookmark", label: "Bookmark", component: CreateBookmark },
|
||||
{ id: "place", label: "Place / Thing To Do", component: CreatePlace },
|
||||
{ id: "pages", label: "Pages", component: ManagePages },
|
||||
{ id: "users", label: "Manage Users", component: ManageUsers },
|
||||
{ id: "radio", label: "Manage Radio", component: ManageRadio },
|
||||
{ id: "environment", label: "Environment", component: Environment },
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Admin tab: the canvas pages made in the browser (views/canvas/). Lists them
|
||||
* all, admin-only ones included, and creates new ones. A page's title,
|
||||
* address and visibility are edited from "Page settings" on the page itself.
|
||||
*/
|
||||
import { usePagesStore } from "@/stores/pages";
|
||||
import PageForm from "@/views/canvas/PageForm.vue";
|
||||
|
||||
const pages = usePagesStore();
|
||||
pages.fetch();
|
||||
|
||||
async function remove(page) {
|
||||
if (!confirm(`Delete the page “${page.title}” and everything on it?`)) return;
|
||||
try {
|
||||
await pages.remove(page.id);
|
||||
} catch (err) {
|
||||
alert(err?.message || "Failed to delete");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<section>
|
||||
<h1>Pages</h1>
|
||||
<p class="text-muted">
|
||||
The home page (/stp) and the landing page's notes are canvases too —
|
||||
edit those on the pages themselves.
|
||||
</p>
|
||||
<p v-if="pages.error" class="text-tertiary">Couldn't load the pages.</p>
|
||||
<table v-else-if="pages.pages.length" class="w-full">
|
||||
<tr v-for="page in pages.pages" :key="page.id">
|
||||
<td>
|
||||
<RouterLink :to="`/${page.slug}`">/{{ page.slug }}</RouterLink>
|
||||
</td>
|
||||
<td>{{ page.title }}</td>
|
||||
<td>{{ page.adminOnly ? "🔒 admin only" : "public" }}</td>
|
||||
<td class="text-right">
|
||||
<button type="button" class="text-tertiary cursor-pointer" @click="remove(page)">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p v-else-if="pages.loaded" class="text-muted">No pages yet.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h1>New page</h1>
|
||||
<PageForm />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user