All checks were successful
Deploy Preprod / Build and Deploy to Preprod (push) Successful in 28s
Backend : - Blueprint pochet : champ hiddenProjects - Route API toggle-hidden-project.php - Controller site.php : retourne hiddenProjects + uuid dans projects Frontend : - Store user : hiddenProjects, visibleProjects, toggleHiddenProject() - Store projects : filtrage automatique des projets masqués - Store api : fonction toggleHiddenProject() - Account.vue : section projets avec cartes horizontales + boutons toggle - Affichage pour Pochet (avec toggle) et Client (sans toggle) - Section client masquée pour Pochet Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
55 lines
No EOL
1.8 KiB
PHP
55 lines
No EOL
1.8 KiB
PHP
<?php
|
|
|
|
return function ($page, $kirby, $site) {
|
|
if (!$kirby->user() && $page->uri() !== 'login') {
|
|
go('/login');
|
|
}
|
|
|
|
$data = $page->toArray();
|
|
$data['template'] = (string) $page->template();
|
|
$data['newInspirations'] = (bool) page('inspirations')->children()->findBy('new', 'true');
|
|
|
|
if ($kirby->user()) {
|
|
$userData = [
|
|
"name" => (string) $kirby->user()->name()->or(null),
|
|
"email" => (string) $kirby->user()->email(),
|
|
"role" => (string) $kirby->user()->role(),
|
|
"uuid" => (string) $kirby->user()->uuid()
|
|
];
|
|
|
|
if ($kirby->user()->client()->exists() && $kirby->user()->client()->isNotEmpty()) {
|
|
$userData['client'] = [
|
|
"name" => (string) $kirby->user()->client()->toPage()->title(),
|
|
"uuid" => (string) $kirby->user()->client()->toPage()->uuid()
|
|
];
|
|
if ($kirby->user()->client()->toPage()->logo()->isNotEmpty()) {
|
|
$userData['client']["logo"] = $kirby->user()->client()->toPage()->logo()->toFile()->url();
|
|
}
|
|
}
|
|
|
|
if ($kirby->user()->projects()->exists() && $kirby->user()->projects()->isNotEmpty()) {
|
|
$userData['projects'] = $kirby->user()->projects()->toPages()->map(function ($project) {
|
|
return [
|
|
"title" => (string) $project->title(),
|
|
"uri" => (string) $project->uri(),
|
|
"step" => (string) $project->getStepLabel(),
|
|
"uuid" => (string) $project->uuid(),
|
|
];
|
|
})->data;
|
|
}
|
|
|
|
if ($kirby->user()->hiddenProjects()->exists() && $kirby->user()->hiddenProjects()->isNotEmpty()) {
|
|
$userData['hiddenProjects'] = $kirby->user()->hiddenProjects()->toPages()->map(function ($project) {
|
|
return (string) $project->uuid();
|
|
})->data;
|
|
} else {
|
|
$userData['hiddenProjects'] = [];
|
|
}
|
|
}
|
|
|
|
|
|
return [
|
|
'genericData' => $data,
|
|
'userData' => $userData ?? null
|
|
];
|
|
}; |