Moed pages/scene to pages/scenes/@sceneId for consistency.
This commit is contained in:
62
pages/scenes/@sceneId/revisions/+Page.vue
Normal file
62
pages/scenes/@sceneId/revisions/+Page.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<script setup>
|
||||
import { inject } from 'vue';
|
||||
|
||||
import Revisions from '#/components/edit/revisions.vue';
|
||||
|
||||
const pageContext = inject('pageContext');
|
||||
const scene = pageContext.pageProps.scene;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="content">
|
||||
<div class="revs-header">
|
||||
<h2 class="heading">Revisions for "{{ scene.title }}"</h2>
|
||||
|
||||
<div class="revs-actions">
|
||||
<a
|
||||
:href="`/scene/edit/${scene.id}/${scene.slug}`"
|
||||
class="link"
|
||||
>Edit scene</a>
|
||||
|
||||
<a
|
||||
:href="`/scene/${scene.id}/${scene.slug}`"
|
||||
target="_blank"
|
||||
class="link"
|
||||
>Go to scene</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Revisions context="scene" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.content {
|
||||
padding: 1rem;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.revs-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.heading {
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
.revs-actions {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@media(--compact) {
|
||||
.revs-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
34
pages/scenes/@sceneId/revisions/+onBeforeRender.js
Normal file
34
pages/scenes/@sceneId/revisions/+onBeforeRender.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { fetchSceneRevisions, fetchScenesById } from '#/src/scenes.js';
|
||||
|
||||
export async function onBeforeRender(pageContext) {
|
||||
const [scene] = await fetchScenesById([Number(pageContext.routeParams.sceneId)], {
|
||||
reqUser: pageContext.user,
|
||||
includeAssets: true,
|
||||
includePartOf: true,
|
||||
actorStashes: true,
|
||||
});
|
||||
|
||||
const {
|
||||
revisions,
|
||||
actors,
|
||||
tags,
|
||||
movies,
|
||||
} = await fetchSceneRevisions(null, {
|
||||
sceneId: scene.id,
|
||||
isFinalized: true,
|
||||
limit: 100,
|
||||
}, pageContext.user);
|
||||
|
||||
return {
|
||||
pageContext: {
|
||||
title: `Revs for '${scene.title}'`,
|
||||
pageProps: {
|
||||
scene,
|
||||
revisions,
|
||||
actors,
|
||||
tags,
|
||||
movies,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
19
pages/scenes/@sceneId/revisions/+route.js
Normal file
19
pages/scenes/@sceneId/revisions/+route.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { match } from 'path-to-regexp';
|
||||
|
||||
const path = '/scene/revs/:sceneId/:slug?';
|
||||
const urlMatch = match(path, { decode: decodeURIComponent });
|
||||
|
||||
export default (pageContext) => {
|
||||
const matched = urlMatch(pageContext.urlPathname);
|
||||
|
||||
if (matched) {
|
||||
return {
|
||||
routeParams: {
|
||||
sceneId: matched.params.sceneId,
|
||||
domain: 'scenes',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
Reference in New Issue
Block a user