Added actor revision overviews to actor and user pages.
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<div class="revs-header">
|
||||
<h2 class="heading">Revisions for "{{ scene.title }}"</h2>
|
||||
<h2 class="heading">Revisions for "{{ actor.name }}"</h2>
|
||||
|
||||
<div class="revs-actions">
|
||||
<a
|
||||
:href="`/scene/edit/${scene.id}/${scene.slug}`"
|
||||
:href="`/actor/edit/${actor.id}/${actor.slug}`"
|
||||
class="link"
|
||||
>Edit scene</a>
|
||||
>Edit actor</a>
|
||||
|
||||
<a
|
||||
:href="`/scene/${scene.id}/${scene.slug}`"
|
||||
:href="`/actor/${actor.id}/${actor.slug}`"
|
||||
target="_blank"
|
||||
class="link"
|
||||
>Go to scene</a>
|
||||
>Go to actor</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Revisions context="scene" />
|
||||
<Revisions context="actor" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -27,7 +27,7 @@ import { inject } from 'vue';
|
||||
import Revisions from '#/components/edit/revisions.vue';
|
||||
|
||||
const pageContext = inject('pageContext');
|
||||
const scene = pageContext.pageProps.scene;
|
||||
const actor = pageContext.pageProps.actor;
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
import { fetchActorsById } from '#/src/actors.js';
|
||||
import { fetchSceneRevisions } from '#/src/scenes.js';
|
||||
import { fetchActorsById, fetchActorRevisions } from '#/src/actors.js';
|
||||
|
||||
export async function onBeforeRender(pageContext) {
|
||||
const [actor] = await fetchActorsById([Number(pageContext.routeParams.actorId)], {}, pageContext.user);
|
||||
|
||||
const {
|
||||
revisions,
|
||||
} = await fetchSceneRevisions(null, {
|
||||
sceneId: actor.id,
|
||||
avatars,
|
||||
} = await fetchActorRevisions(null, {
|
||||
actorId: actor.id,
|
||||
isFinalized: true,
|
||||
limit: 100,
|
||||
}, pageContext.user);
|
||||
|
||||
return {
|
||||
pageContext: {
|
||||
title: `Revisions for '${actor.name}'`,
|
||||
title: `Revs for '${actor.name}'`,
|
||||
pageProps: {
|
||||
actor,
|
||||
revisions,
|
||||
avatars,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1 +1,19 @@
|
||||
export default '/actor/revisions/@actorId/*';
|
||||
import { match } from 'path-to-regexp';
|
||||
|
||||
const path = '/actor/revs/:actorId/:slug?';
|
||||
const urlMatch = match(path, { decode: decodeURIComponent });
|
||||
|
||||
export default (pageContext) => {
|
||||
const matched = urlMatch(pageContext.urlPathname);
|
||||
|
||||
if (matched) {
|
||||
return {
|
||||
routeParams: {
|
||||
actorId: matched.params.actorId,
|
||||
domain: 'actors',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user