DTL proposals : add custom titles

This commit is contained in:
isUnknown 2025-01-27 15:51:26 +01:00
parent 8e12988961
commit 46b0e8a4e0
3 changed files with 26 additions and 6 deletions

View file

@ -40,6 +40,9 @@ fields:
type: headline type: headline
label: La proposition label: La proposition
DTLProposalTitle:
label: Titre
type: text
DTLProposalLocation: DTLProposalLocation:
label: Localisation label: Localisation
help: Quelle étape contient la proposition Design to Light ? help: Quelle étape contient la proposition Design to Light ?

View file

@ -80,6 +80,7 @@ function processDTLProposals($page) {
if ($proposalPage && $proposalFile) { if ($proposalPage && $proposalFile) {
$index = $proposalPage->pdf()->toFiles()->indexOf($proposalFile); $index = $proposalPage->pdf()->toFiles()->indexOf($proposalFile);
$DTLProposal = [ $DTLProposal = [
"title" => $proposal->DTLProposalTitle()->isNotEmpty() ? (string) $proposal->DTLProposalTitle() : null,
"location" => [ "location" => [
"step" => "proposal", "step" => "proposal",
"source" => (string) $proposalFile->url() "source" => (string) $proposalFile->url()
@ -97,6 +98,7 @@ function processDTLProposals($page) {
if ($proposalPage && $proposalFile) { if ($proposalPage && $proposalFile) {
$DTLProposal = [ $DTLProposal = [
"title" => $proposal->DTLProposalTitle()->isNotEmpty() ? (string) $proposal->DTLProposalTitle() : null,
"location" => [ "location" => [
"step" => "industrialIdeation", "step" => "industrialIdeation",
"source" => (string) $proposalFile->url() "source" => (string) $proposalFile->url()
@ -112,6 +114,7 @@ function processDTLProposals($page) {
$proposalPage = $proposal->DTLVirtualSampleDynamicTrack()->toPage(); $proposalPage = $proposal->DTLVirtualSampleDynamicTrack()->toPage();
if ($proposalPage) { if ($proposalPage) {
$DTLProposal = [ $DTLProposal = [
"title" => $proposal->DTLProposalTitle()->isNotEmpty() ? (string) $proposal->DTLProposalTitle() : null,
"location" => [ "location" => [
"step" => "virtualSample", "step" => "virtualSample",
"type" => "dynamic", "type" => "dynamic",
@ -129,6 +132,7 @@ function processDTLProposals($page) {
$proposalFile = $proposal->DTLVirtualSampleStaticTrack()->toFile(); $proposalFile = $proposal->DTLVirtualSampleStaticTrack()->toFile();
if ($proposalPage && $proposalFile) { if ($proposalPage && $proposalFile) {
$DTLProposal = [ $DTLProposal = [
"title" => $proposal->DTLProposalTitle()->isNotEmpty() ? (string) $proposal->DTLProposalTitle() : null,
"location" => [ "location" => [
"step" => "virtualSample", "step" => "virtualSample",
"type" => "static", "type" => "static",

View file

@ -2,7 +2,7 @@
<aside <aside
id="dtl-panel" id="dtl-panel"
class="text-sm bg-black rounded-2xl" class="text-sm bg-black rounded-2xl"
:class="{'with-dialog': isDialogOpen}" :class="{ 'with-dialog': isDialogOpen }"
aria-labelledby="dtl-label" aria-labelledby="dtl-label"
@click="preventClose($event)" @click="preventClose($event)"
> >
@ -10,9 +10,16 @@
class="flex items-center | border-b pl-32 pr-16 py-8" class="flex items-center | border-b pl-32 pr-16 py-8"
data-icon="leaf" data-icon="leaf"
style="--column-gap: 0.5rem" style="--column-gap: 0.5rem"
> >
<!-- TODO: ajouter un title à dans le Panel pour chaque propositio et l'utiliser ici pour le h2 --> <h2 id="dtl-label" class="font-serif text-md">
<h2 id="dtl-label" class="font-serif text-md">Design to Light</h2> {{
proposals.length > 1 || isDialogOpen
? activeProposal.title
? activeProposal.title
: "Design to light"
: "Design to light"
}}
</h2>
<button <button
v-if="!isDialogOpen" v-if="!isDialogOpen"
@click="emits('close')" @click="emits('close')"
@ -22,7 +29,7 @@
<span class="sr-only">Fermer</span> <span class="sr-only">Fermer</span>
</button> </button>
</header> </header>
<nav class="tabs" role="tablist" tabindex="-1"> <nav v-if="!isDialogOpen" class="tabs" role="tablist" tabindex="-1">
<button <button
v-for="(proposal, index) in proposals" v-for="(proposal, index) in proposals"
@click="activeProposal = proposal" @click="activeProposal = proposal"
@ -30,7 +37,13 @@
:aria-selected="proposal.isActive" :aria-selected="proposal.isActive"
aria-controls="" aria-controls=""
> >
{{ index === 0 ? "Proposition initiale" : "Alternative " + index }} {{
activeProposal.title
? activeProposal.title
: index === 0
? "Proposition initiale"
: "Alternative " + index
}}
</button> </button>
</nav> </nav>
<section class="overflow-y" tabindex="-1"> <section class="overflow-y" tabindex="-1">