From d86f29687015c7f3c67b4ed840a9ab82549f3b88 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 20 Apr 2022 22:46:38 +0200 Subject: [PATCH] Deprecated Baggy - a big message will be displayed to user using the Baggy theme - switching from Material to Baggy is no more allowed in config (it'll be forced to material) - the theme label in the config for Baggy is now _Baggy (DEPRECATED)_ --- .../CoreBundle/Controller/ConfigController.php | 10 ++++++++++ src/Wallabag/CoreBundle/Form/Type/ConfigType.php | 8 +++++++- .../Resources/views/themes/baggy/layout.html.twig | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index d5873ca8d..5841f4da7 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -43,6 +43,16 @@ class ConfigController extends Controller $configForm->handleRequest($request); if ($configForm->isSubmitted() && $configForm->isValid()) { + // force theme to material to avoid using baggy + if ('baggy' === $config->getTheme()) { + $config->setTheme('material'); + + $this->addFlash( + 'notice', + 'Baggy is deprecated, forced to Material theme.' + ); + } + $em->persist($config); $em->flush(); diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 6901fa08e..af916b29f 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php @@ -24,7 +24,13 @@ class ConfigType extends AbstractType $this->themes = array_combine( $themes, array_map(function ($s) { - return ucwords(strtolower(str_replace('-', ' ', $s))); + $cleanTheme = ucwords(strtolower(str_replace('-', ' ', $s))); + + if ('Baggy' === $cleanTheme) { + $cleanTheme = 'Baggy (DEPRECATED)'; + } + + return $cleanTheme; }, $themes) ); diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig index 33b0ac8b7..d0be1e5cc 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig @@ -57,6 +57,11 @@ {% endblock %} {% block messages %} +
+

⚠️ You are using the Baggy theme which is now deprecated.

+

It will be removed in the next version. You can use the Material theme by updating the theme config.

+
+ {% for flashMessage in app.session.flashbag.get('notice') %}
×