From 6a52faed97c56fe56f23bdc399f991b0753277e3 Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 28 Aug 2024 08:37:49 +0200 Subject: [PATCH] =?UTF-8?q?nouveau=20nom=20et=20l=C3=A9gende?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/packages/twig.yaml | 4 +++- config/services.yaml | 2 ++ src/Service/TaskLifecycleManager.php | 11 ++++++++++- templates/home/index.html.twig | 2 +- templates/macro.html.twig | 8 ++++++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 2b0eab2..ae3fe83 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -2,12 +2,14 @@ twig: file_name_pattern: '*.twig' form_themes: ['bootstrap_5_layout.html.twig'] globals: - title: Gestionnaire de tâches simple + title: '%short_title%' menu: header: - { route: 'app_project', label: 'Projets', icon: '' } taskLifecycleManager: '@App\Service\TaskLifecycleManager' geoJsonManager: '@App\Service\GeoJsonManager' + short_title: '%short_title%' + long_title: '%long_title%' when@test: twig: diff --git a/config/services.yaml b/config/services.yaml index 4904dd1..ebd3d95 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -5,6 +5,8 @@ # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: timezone: '%env(APP_TIMEZONE)%' + short_title: 'OMO' + long_title: 'Outil de Manipulation et d’Organisation' services: # default configuration for services in *this* file diff --git a/src/Service/TaskLifecycleManager.php b/src/Service/TaskLifecycleManager.php index d1176a5..a093dc9 100644 --- a/src/Service/TaskLifecycleManager.php +++ b/src/Service/TaskLifecycleManager.php @@ -3,6 +3,7 @@ namespace App\Service; use App\Entity\Project; +use App\Entity\Task; use Symfony\Component\Workflow\WorkflowInterface; class TaskLifecycleManager @@ -13,8 +14,16 @@ class TaskLifecycleManager ) { } - public function getProjectStats(Project $project) + public function getProjectStats($entity) { + if ($entity instanceof Project) { + $project = $entity; + } elseif ($entity instanceof Task) { + $project = $entity->getProject(); + } else { + throw new \RuntimeException(); + } + $stats = []; $places = $this->taskLifecycleStateMachine->getDefinition()->getPlaces(); diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 80fbe28..0ecea3e 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -2,7 +2,7 @@ {% block page_content %}
-

Gestionnaire de tâches simple

+

{{ long_title }}

L’idée c’est d’avoir un petit outil collaboratif simple et facile à administrer/utiliser pour mapper des trucs de façon coordonnée à un endroit.

diff --git a/templates/macro.html.twig b/templates/macro.html.twig index 684efc4..305b663 100644 --- a/templates/macro.html.twig +++ b/templates/macro.html.twig @@ -31,4 +31,12 @@ {% endif %} data-map-icon-value="{{ asset('images/marker.svg') }}" >
+
+ Légende + Overpass + {% set stats = taskLifecycleManager.getProjectStats(entity) %} + {% for place, data in stats %} + {{ data.title }} + {% endfor %} +
{% endmacro %}