From 4f60dc91d3f55eebf252dda9df9b704ef98fa80c Mon Sep 17 00:00:00 2001 From: isUnknown Date: Mon, 11 Nov 2024 11:43:34 +0100 Subject: [PATCH] reorganize panel: - project blueprints : add managers field - projects blueprint : re organize, add 'Vos projets' section based on custom user method - menu : hide dashboard item (useless) --- .../1_miss-dior-blooming-bouquet/project.txt | 4 ++ .../test/1_client-brief/client-brief.txt | 25 -------- .../_drafts/test/2_proposal/proposal.txt | 13 ---- .../test/3_extended-brief/extended-brief.txt | 13 ---- .../test/4_virtual-sample/virtual-sample.txt | 13 ---- .../industrial-ideation.txt | 13 ---- .../physical-sample/physical-sample.txt | 13 ---- .../content/projects/_drafts/test/project.txt | 9 --- public/site/blueprints/pages/project.yml | 4 ++ public/site/blueprints/pages/projects.yml | 59 ++++++++++++++----- public/site/blueprints/site.yml | 17 ++---- public/site/blueprints/users/admin.yml | 1 + public/site/config/menu.php | 48 +++++++-------- public/site/models/project.php | 13 ++++ public/site/plugins/your-projects/index.php | 15 +++++ 15 files changed, 110 insertions(+), 150 deletions(-) delete mode 100644 public/content/projects/_drafts/test/1_client-brief/client-brief.txt delete mode 100644 public/content/projects/_drafts/test/2_proposal/proposal.txt delete mode 100644 public/content/projects/_drafts/test/3_extended-brief/extended-brief.txt delete mode 100644 public/content/projects/_drafts/test/4_virtual-sample/virtual-sample.txt delete mode 100644 public/content/projects/_drafts/test/_drafts/industrial-ideation/industrial-ideation.txt delete mode 100644 public/content/projects/_drafts/test/_drafts/physical-sample/physical-sample.txt delete mode 100644 public/content/projects/_drafts/test/project.txt create mode 100644 public/site/plugins/your-projects/index.php diff --git a/public/content/projects/1_miss-dior-blooming-bouquet/project.txt b/public/content/projects/1_miss-dior-blooming-bouquet/project.txt index 0e46d90..3acd237 100644 --- a/public/content/projects/1_miss-dior-blooming-bouquet/project.txt +++ b/public/content/projects/1_miss-dior-blooming-bouquet/project.txt @@ -10,4 +10,8 @@ Client: - page://G418qZ4ABsoWFx4i ---- +Managers: - user://WWjXgPWk + +---- + Uuid: jDag30qUf8zyiEwC \ No newline at end of file diff --git a/public/content/projects/_drafts/test/1_client-brief/client-brief.txt b/public/content/projects/_drafts/test/1_client-brief/client-brief.txt deleted file mode 100644 index 59bde7e..0000000 --- a/public/content/projects/_drafts/test/1_client-brief/client-brief.txt +++ /dev/null @@ -1,25 +0,0 @@ -Title: Brief client - ----- - -Stepname: clientBrief - ----- - -Stepindex: 1 - ----- - -Uuid: 5NGq8baScF9pCeK9 - ----- - -Pdf: - ----- - -Description: - ----- - -Moodboard: \ No newline at end of file diff --git a/public/content/projects/_drafts/test/2_proposal/proposal.txt b/public/content/projects/_drafts/test/2_proposal/proposal.txt deleted file mode 100644 index 9eddb1a..0000000 --- a/public/content/projects/_drafts/test/2_proposal/proposal.txt +++ /dev/null @@ -1,13 +0,0 @@ -Title: Offre commerciale - ----- - -Stepname: proposal - ----- - -Stepindex: 2 - ----- - -Uuid: b1ZjuC8nDSXOOBf9 \ No newline at end of file diff --git a/public/content/projects/_drafts/test/3_extended-brief/extended-brief.txt b/public/content/projects/_drafts/test/3_extended-brief/extended-brief.txt deleted file mode 100644 index 81facc1..0000000 --- a/public/content/projects/_drafts/test/3_extended-brief/extended-brief.txt +++ /dev/null @@ -1,13 +0,0 @@ -Title: Brief enrichi - ----- - -Stepname: extended-brief - ----- - -Stepindex: 3 - ----- - -Uuid: cOMCwMHw0SRwCDjD \ No newline at end of file diff --git a/public/content/projects/_drafts/test/4_virtual-sample/virtual-sample.txt b/public/content/projects/_drafts/test/4_virtual-sample/virtual-sample.txt deleted file mode 100644 index a0253e8..0000000 --- a/public/content/projects/_drafts/test/4_virtual-sample/virtual-sample.txt +++ /dev/null @@ -1,13 +0,0 @@ -Title: Échantillon virtuel - ----- - -Stepname: virtualSample - ----- - -Stepindex: 5 - ----- - -Uuid: FouVvjVPGInE74Yv \ No newline at end of file diff --git a/public/content/projects/_drafts/test/_drafts/industrial-ideation/industrial-ideation.txt b/public/content/projects/_drafts/test/_drafts/industrial-ideation/industrial-ideation.txt deleted file mode 100644 index efcf5a2..0000000 --- a/public/content/projects/_drafts/test/_drafts/industrial-ideation/industrial-ideation.txt +++ /dev/null @@ -1,13 +0,0 @@ -Title: Idéation industrielle - ----- - -Stepname: industrialIdeation - ----- - -Stepindex: 4 - ----- - -Uuid: 2B5pbQQ6BrcDHGnG \ No newline at end of file diff --git a/public/content/projects/_drafts/test/_drafts/physical-sample/physical-sample.txt b/public/content/projects/_drafts/test/_drafts/physical-sample/physical-sample.txt deleted file mode 100644 index 35bfa0a..0000000 --- a/public/content/projects/_drafts/test/_drafts/physical-sample/physical-sample.txt +++ /dev/null @@ -1,13 +0,0 @@ -Title: Échantillon physique - ----- - -Stepname: physicalSample - ----- - -Stepindex: 6 - ----- - -Uuid: XdHzenC81EA7rS4e \ No newline at end of file diff --git a/public/content/projects/_drafts/test/project.txt b/public/content/projects/_drafts/test/project.txt deleted file mode 100644 index 12eed61..0000000 --- a/public/content/projects/_drafts/test/project.txt +++ /dev/null @@ -1,9 +0,0 @@ -Title: test - ----- - -Client: - ----- - -Uuid: Wz0hErzk7ltN2qT8 \ No newline at end of file diff --git a/public/site/blueprints/pages/project.yml b/public/site/blueprints/pages/project.yml index cd043fc..47971d9 100644 --- a/public/site/blueprints/pages/project.yml +++ b/public/site/blueprints/pages/project.yml @@ -28,6 +28,10 @@ tabs: image: query: page.logo.toFile layout: cardlets + managers: + label: Chefs de projet + type: users + help: Utilisateurs autorisés à intervenir sur ce projet et notifiés lorsque quelqu'un intervient dessus. - width: 2/3 sections: diff --git a/public/site/blueprints/pages/projects.yml b/public/site/blueprints/pages/projects.yml index 5706efd..637e478 100644 --- a/public/site/blueprints/pages/projects.yml +++ b/public/site/blueprints/pages/projects.yml @@ -1,21 +1,50 @@ title: Projets -sections: - fieldsSection: - type: fields +tabs: + contentTab: + label: Contenu + columns: + - width: 1/1 + sections: + drafts: + extends: sections/projects + headline: Brouillons + status: draft + - width: 1/2 + sections: + yourProjects: + label: Vos projets + type: pages + query: user.projects + create: false + help: Projets pour lesquels vous êtes nommé chef de projet. + image: + query: page.client.toPage.logo.toFile + listed: + extends: sections/projects + headline: En cours + layout: list + info: "étape : {{ page.getStepLabel }}" + status: listed + - width: 1/2 + sections: + modifiedProjects: + extends: sections/projects + create: false + headline: Projets récement modifiés + sortBy: modified desc + layout: list + image: + query: page.client.toPage.logo.toFil + unlisted: + extends: sections/projects + headline: Archivés + status: unlisted + + settings: + label: Réglages + icon: cog fields: clientBriefImageTags: label: Tags des images ajoutées aux briefs type: tags - drafts: - extends: sections/projects - headline: Brouillons - status: draft - listed: - extends: sections/projects - headline: En cours - status: listed - unlisted: - extends: sections/projects - headline: Archivés - status: unlisted diff --git a/public/site/blueprints/site.yml b/public/site/blueprints/site.yml index d8124a6..9f01f6c 100644 --- a/public/site/blueprints/site.yml +++ b/public/site/blueprints/site.yml @@ -8,23 +8,16 @@ tabs: clients: width: 1/2 sections: - clients: - label: Clients + yourProjects: + label: Vos projets type: pages - parent: site.find("clients") - template: client - search: true + query: user.projects + help: Projets pour lesquels vous êtes nommé chef de projet. image: - back: white + query: page.client.toPage.logo.toFile projects: width: 1/2 sections: - projects: - extends: sections/projects - headline: Projets récement modifiés - parent: site.find("projects") - layout: list - sortBy: modified desc settings: label: Paramètres icon: cog diff --git a/public/site/blueprints/users/admin.yml b/public/site/blueprints/users/admin.yml index 984dd65..b04c6d6 100644 --- a/public/site/blueprints/users/admin.yml +++ b/public/site/blueprints/users/admin.yml @@ -1,4 +1,5 @@ title: Admin +home: /panel/pages/projects fields: notifications: diff --git a/public/site/config/menu.php b/public/site/config/menu.php index aa53313..f85f1b5 100644 --- a/public/site/config/menu.php +++ b/public/site/config/menu.php @@ -1,22 +1,31 @@ [ - 'label' => 'Dashboard', - 'icon' => 'dashboard', + // 'site' => [ + // 'label' => 'Dashboard', + // 'icon' => 'dashboard', + // 'current' => function (string $current): bool { + // // the links of all your custom menu entries + // $links = [ + // 'pages/clients', + // 'pages/projects', + // 'pages/inspirations', + // 'pages/notifications', + // 'pages/reunions' + // ]; + // $path = Kirby\Cms\App::instance()->path(); + // return + // $current === 'site' && + // A::every($links, fn ($link) => Str::contains($path, $link) === false); + // } + // ], + 'projects' => [ + 'label' => 'Projets', + 'icon' => 'folder', + 'link' => 'pages/projects', 'current' => function (string $current): bool { - // the links of all your custom menu entries - $links = [ - 'pages/clients', - 'pages/projects', - 'pages/inspirations', - 'pages/notifications', - 'pages/reunions' - ]; - $path = Kirby\Cms\App::instance()->path(); - return - $current === 'site' && - A::every($links, fn ($link) => Str::contains($path, $link) === false); + $path = Kirby\Cms\App::instance()->path(); + return Str::contains($path, 'pages/projects'); } ], 'clients' => [ @@ -28,15 +37,6 @@ return [ return Str::contains($path, 'pages/clients'); } ], - 'projects' => [ - 'label' => 'Projets', - 'icon' => 'folder', - 'link' => 'pages/projects', - 'current' => function (string $current): bool { - $path = Kirby\Cms\App::instance()->path(); - return Str::contains($path, 'pages/projects'); - } - ], '-', 'inspirations' => [ 'label' => 'Inspirations', diff --git a/public/site/models/project.php b/public/site/models/project.php index e7269f0..177409d 100644 --- a/public/site/models/project.php +++ b/public/site/models/project.php @@ -32,4 +32,17 @@ class ProjectPage extends Page { return $steps; } + + public function getStepLabel() { + $stepsLabel = [ + "clientBrief" => "brief", + "proposal" => "offre commerciale", + "extendedBrief" => "brief enrichi", + "industrialIdeation" => "idéation industrielle", + "virtualSample" => "échantillon virtuel", + "physicalSample" => "échantillon physique", + ]; + + return $stepsLabel[$this->currentStep()->value()]; + } } \ No newline at end of file diff --git a/public/site/plugins/your-projects/index.php b/public/site/plugins/your-projects/index.php new file mode 100644 index 0000000..4b63b8e --- /dev/null +++ b/public/site/plugins/your-projects/index.php @@ -0,0 +1,15 @@ + [ + 'projects' => function() { + $allProjects = page('projects')->children(); + + $managedProjects = $allProjects->filter( + fn ($project) => $project->managers()->toUsers()->has($this) + ); + + return $managedProjects; + } + ] +]);