From 3f0ad51114dce51e13df535eb88a27d0995b20b8 Mon Sep 17 00:00:00 2001 From: LenaertsJ Date: Tue, 13 Jan 2026 15:35:26 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20"Afficher=20le=20num=C3=A9ro=20de=20v?= =?UTF-8?q?ersion=20de=20Chill=20dans=20l'UX"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../unreleased/Feature-20260105-150817.yaml | 6 +++ composer.json | 1 + .../Resources/views/Layout/_footer.html.twig | 4 ++ .../Service/VersionProvider.php | 45 +++++++++++++++++++ .../Templating/VersionRenderExtension.php | 35 +++++++++++++++ .../ChillMainBundle/config/services.yaml | 4 ++ .../config/services/templating.yaml | 4 ++ .../translations/messages.fr.yml | 3 ++ 8 files changed, 102 insertions(+) create mode 100644 .changes/unreleased/Feature-20260105-150817.yaml create mode 100644 src/Bundle/ChillMainBundle/Service/VersionProvider.php create mode 100644 src/Bundle/ChillMainBundle/Templating/VersionRenderExtension.php diff --git a/.changes/unreleased/Feature-20260105-150817.yaml b/.changes/unreleased/Feature-20260105-150817.yaml new file mode 100644 index 000000000..c1d5977d3 --- /dev/null +++ b/.changes/unreleased/Feature-20260105-150817.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: Display version of chill bundles in application footer +time: 2026-01-05T15:08:17.317719064+01:00 +custom: + Issue: "473" + SchemaChange: No schema change diff --git a/composer.json b/composer.json index 829d5e7db..8fc4c300e 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "ext-openssl": "*", "ext-redis": "*", "ext-zlib": "*", + "composer-runtime-api": "*", "champs-libres/wopi-bundle": "dev-symfony-v5@dev", "champs-libres/wopi-lib": "dev-master@dev", "doctrine/data-fixtures": "^1.8", diff --git a/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig index df6ba912b..43a91b5e1 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig @@ -2,6 +2,10 @@

{{ 'This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License'|trans|raw }}
+ {% if get_chill_version() %} + {{ 'footer.Running chill version %version%'|trans({ '%version%': get_chill_version() }) }} + {% endif %} +
{{ 'User manual'|trans }} diff --git a/src/Bundle/ChillMainBundle/Service/VersionProvider.php b/src/Bundle/ChillMainBundle/Service/VersionProvider.php new file mode 100644 index 000000000..28b4f3ff3 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Service/VersionProvider.php @@ -0,0 +1,45 @@ +packageName); + + if (null === $version) { + return 'unknown'; + } + + return $version; + } catch (\OutOfBoundsException) { + return 'unknown'; + } + } + + public function getFormattedVersion(): string + { + $version = $this->getVersion(); + + if ('unknown' === $version) { + return 'Version unavailable'; + } + + return $version; + } +} diff --git a/src/Bundle/ChillMainBundle/Templating/VersionRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/VersionRenderExtension.php new file mode 100644 index 000000000..ca3f362a2 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Templating/VersionRenderExtension.php @@ -0,0 +1,35 @@ +getChillVersion(...)), + ]; + } + + public function getChillVersion(): string + { + return $this->versionProvider->getFormattedVersion(); + } +} diff --git a/src/Bundle/ChillMainBundle/config/services.yaml b/src/Bundle/ChillMainBundle/config/services.yaml index d8d4a475d..f73eeb071 100644 --- a/src/Bundle/ChillMainBundle/config/services.yaml +++ b/src/Bundle/ChillMainBundle/config/services.yaml @@ -115,3 +115,7 @@ services: $vienEntityInfoProviders: !tagged_iterator chill_main.entity_info_provider Chill\MainBundle\Action\User\UpdateProfile\UpdateProfileCommandHandler: ~ + + Chill\MainBundle\Service\VersionProvider: + arguments: + $packageName: 'chill-project/chill-bundles' diff --git a/src/Bundle/ChillMainBundle/config/services/templating.yaml b/src/Bundle/ChillMainBundle/config/services/templating.yaml index 56bc1ff75..c081d96fd 100644 --- a/src/Bundle/ChillMainBundle/config/services/templating.yaml +++ b/src/Bundle/ChillMainBundle/config/services/templating.yaml @@ -66,3 +66,7 @@ services: resource: './../../Templating/Listing' Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface: '@Chill\MainBundle\Templating\Listing\FilterOrderHelperFactory' + + Chill\MainBundle\Templating\VersionRenderExtension: + tags: + - { name: twig.extension } diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index b6343312e..387c16662 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -48,6 +48,9 @@ See: Voir Name: Nom Label: Nom +footer: + Running chill version %version%: "Version de Chill: %version%" + user: current_user: Utilisateur courant profile: