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,9 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Route `/shrines/evangelion` — placeholder, renders <Wip>.
|
||||
* STATUS: no route points here — /shrines/<name> is a canvas page now
|
||||
* (views/canvas/CanvasPage.vue), created from the /shrines index.
|
||||
*
|
||||
* Was route `/shrines/evangelion` — placeholder, renders <Wip>.
|
||||
*/
|
||||
import Wip from "@/components/util/Wip.vue";
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Route `/shrines/gto` — placeholder, renders <Wip>.
|
||||
* STATUS: no route points here — /shrines/<name> is a canvas page now
|
||||
* (views/canvas/CanvasPage.vue), created from the /shrines index.
|
||||
*
|
||||
* Was route `/shrines/gto` — placeholder, renders <Wip>.
|
||||
*/
|
||||
import Wip from "@/components/util/Wip.vue";
|
||||
</script>
|
||||
|
||||
@@ -1,14 +1,31 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Route `/shrines` — index of the shrine pages.
|
||||
* Route `/shrines` — index of the shrine pages. Demoman is a hand-written
|
||||
* view; every other shrine is a canvas page (views/canvas/) whose address
|
||||
* starts with "shrines/", listed from the pages query. Admins get a form to
|
||||
* start a new one from the Shrine layout.
|
||||
*/
|
||||
import { computed } from "vue";
|
||||
import RouterTable from "@/components/util/RouterTable.vue";
|
||||
const shrine_links = [
|
||||
{ name: "Demoman", link: "/shrines/demoman" },
|
||||
{ name: "Evangelion", link: "/shrines/evangelion" },
|
||||
{ name: "GTO", link: "/shrines/gto" },
|
||||
{ name: "Skipskipbenben", link: "/shrines/skipskipbenben" },
|
||||
];
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { usePagesStore } from "@/stores/pages";
|
||||
import PageForm from "@/views/canvas/PageForm.vue";
|
||||
|
||||
const auth = useAuthStore();
|
||||
const pages = usePagesStore();
|
||||
auth.ensureLoaded();
|
||||
pages.fetch();
|
||||
|
||||
const isAdmin = computed(() => auth.loggedIn && !!auth.user.admin);
|
||||
|
||||
const shrine_links = computed(() =>
|
||||
[
|
||||
{ name: "Demoman", link: "/shrines/demoman" },
|
||||
...pages.pages
|
||||
.filter((p) => p.slug.startsWith("shrines/"))
|
||||
.map((p) => ({ name: p.adminOnly ? `${p.title} 🔒` : p.title, link: `/${p.slug}` })),
|
||||
].sort((a, b) => a.name.localeCompare(b.name)),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -17,6 +34,10 @@ const shrine_links = [
|
||||
class="page-a4 bdr-1 flex flex-col relative overflow-scroll gap-1"
|
||||
>
|
||||
<RouterTable :linkArr="shrine_links" />
|
||||
<section v-if="isAdmin" class="mt-4">
|
||||
<h3>New shrine</h3>
|
||||
<PageForm prefix="shrines/" starter="shrine" />
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<script setup>
|
||||
/**
|
||||
* Route `/shrines/skipskipbenben` — placeholder, renders <Wip>.
|
||||
* STATUS: no route points here — /shrines/<name> is a canvas page now
|
||||
* (views/canvas/CanvasPage.vue), created from the /shrines index.
|
||||
*
|
||||
* Was route `/shrines/skipskipbenben` — placeholder, renders <Wip>.
|
||||
*/
|
||||
import Wip from "@/components/util/Wip.vue";
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user