mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-21 11:27:47 +00:00
Simplify the slot organisation to avoid multiple slots declaration
This commit is contained in:
@@ -30,65 +30,73 @@
|
||||
</h3>
|
||||
</template>
|
||||
|
||||
<template #body v-if="type === 'person' && action === 'show'">
|
||||
<on-the-fly-person
|
||||
:id="id"
|
||||
:type="type"
|
||||
:action="action"
|
||||
ref="castPerson"
|
||||
/>
|
||||
<div v-if="hasResourceComment">
|
||||
<h3>{{ trans(ONTHEFLY_RESOURCE_COMMENT_TITLE) }}</h3>
|
||||
<blockquote class="chill-user-quote">
|
||||
{{ parent?.comment }}
|
||||
</blockquote>
|
||||
</div>
|
||||
</template>
|
||||
<template #body>
|
||||
<!-- person / show -->
|
||||
<template v-if="type === 'person' && action === 'show'">
|
||||
<on-the-fly-person
|
||||
:id="id"
|
||||
:type="type"
|
||||
:action="action"
|
||||
ref="castPerson"
|
||||
/>
|
||||
<div v-if="hasResourceComment">
|
||||
<h3>{{ trans(ONTHEFLY_RESOURCE_COMMENT_TITLE) }}</h3>
|
||||
<blockquote class="chill-user-quote">
|
||||
{{ parent?.comment }}
|
||||
</blockquote>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #body v-else-if="type === 'person' && action === 'edit'">
|
||||
<PersonEdit
|
||||
:id="id"
|
||||
:action="'edit'"
|
||||
:query="''"
|
||||
ref="castEditPerson"
|
||||
></PersonEdit>
|
||||
</template>
|
||||
<!-- person / edit -->
|
||||
<template v-else-if="type === 'person' && action === 'edit'">
|
||||
<PersonEdit
|
||||
:id="id"
|
||||
:action="'edit'"
|
||||
:query="''"
|
||||
ref="castEditPerson"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #body v-else-if="type === 'thirdparty' && action === 'show'">
|
||||
<on-the-fly-thirdparty
|
||||
:id="id"
|
||||
:type="type"
|
||||
:action="action"
|
||||
ref="castThirdparty"
|
||||
/>
|
||||
<div v-if="hasResourceComment">
|
||||
<h3>{{ trans(ONTHEFLY_RESOURCE_COMMENT_TITLE) }}</h3>
|
||||
<blockquote class="chill-user-quote">
|
||||
{{ parent?.comment }}
|
||||
</blockquote>
|
||||
</div>
|
||||
</template>
|
||||
<!-- thirdparty / show -->
|
||||
<template v-else-if="type === 'thirdparty' && action === 'show'">
|
||||
<on-the-fly-thirdparty
|
||||
:id="id"
|
||||
:type="type"
|
||||
:action="action"
|
||||
ref="castThirdparty"
|
||||
/>
|
||||
<div v-if="hasResourceComment">
|
||||
<h3>{{ trans(ONTHEFLY_RESOURCE_COMMENT_TITLE) }}</h3>
|
||||
<blockquote class="chill-user-quote">
|
||||
{{ parent?.comment }}
|
||||
</blockquote>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #body v-else-if="type === 'thirdparty' && action === 'edit'">
|
||||
<ThirdPartyEdit ref="castEditThirdParty" action="edit" :id="id"></ThirdPartyEdit>
|
||||
</template>
|
||||
<!-- thirdparty / edit -->
|
||||
<template v-else-if="type === 'thirdparty' && action === 'edit'">
|
||||
<ThirdPartyEdit ref="castEditThirdParty" action="edit" :id="id" />
|
||||
</template>
|
||||
|
||||
<template #body v-else-if="parent">
|
||||
<on-the-fly-thirdparty
|
||||
:parent="parent"
|
||||
:action="action"
|
||||
type="thirdparty"
|
||||
ref="castThirdparty"
|
||||
/>
|
||||
</template>
|
||||
<!-- parent provided (thirdparty create with parent) -->
|
||||
<template v-else-if="parent">
|
||||
<on-the-fly-thirdparty
|
||||
:parent="parent"
|
||||
:action="action"
|
||||
type="thirdparty"
|
||||
ref="castThirdparty"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #body v-else>
|
||||
<on-the-fly-create
|
||||
:action="action"
|
||||
:allowed-types="allowedTypes"
|
||||
:query="query || ''"
|
||||
ref="castNew"
|
||||
/>
|
||||
<!-- default: creation wizard -->
|
||||
<template v-else>
|
||||
<on-the-fly-create
|
||||
:action="action"
|
||||
:allowed-types="allowedTypes"
|
||||
:query="query || ''"
|
||||
ref="castNew"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
@@ -136,7 +144,6 @@ import {
|
||||
} from "translator";
|
||||
import PersonEdit from "ChillPersonAssets/vuejs/_components/OnTheFly/PersonEdit.vue";
|
||||
import ThirdPartyEdit from "ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdPartyEdit.vue";
|
||||
import ThirdParty from "ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue";
|
||||
|
||||
// Types
|
||||
type EntityType = "person" | "thirdparty";
|
||||
@@ -175,7 +182,7 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
type castEditPersonType = InstanceType<typeof PersonEdit>;
|
||||
type castEditThirdPartyType = InstanceType<typeof ThirdParty>;
|
||||
type castEditThirdPartyType = InstanceType<typeof ThirdPartyEdit>;
|
||||
const castEditPerson = useTemplateRef<castEditPersonType>('castEditPerson')
|
||||
const castEditThirdParty = useTemplateRef<castEditThirdPartyType>('castEditThirdParty');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user