diff --git a/assets/img/blank.png b/assets/images/blank.png similarity index 100% rename from assets/img/blank.png rename to assets/images/blank.png diff --git a/assets/img/logo.png b/assets/images/logo.png similarity index 100% rename from assets/img/logo.png rename to assets/images/logo.png diff --git a/assets/img/no-image.png b/assets/images/no-image.png similarity index 100% rename from assets/img/no-image.png rename to assets/images/no-image.png diff --git a/assets/js/admin.js b/assets/js/admin.js index 4d1b469..99a51a7 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -1,10 +1,3 @@ -const imagesContext = require.context( - '../img', - true, /\.(png|jpg|jpeg|gif|ico|svg|webp)$/ -); - -imagesContext.keys().forEach(imagesContext); - import '../css/admin.scss'; require('../../node_modules/bootstrap/dist/js/bootstrap.min.js'); diff --git a/config/packages/app.yaml b/config/packages/app.yaml index 5e6020c..de474c3 100644 --- a/config/packages/app.yaml +++ b/config/packages/app.yaml @@ -1,5 +1,7 @@ core: site: + name: "Tinternet & cie" + logo: "build/images/logo.png" pages: App\Entity\Page\SimplePage: name: 'Page simple' diff --git a/core/Controller/Admin/AdminController.php b/core/Controller/Admin/AdminController.php index e007d34..f7cce81 100644 --- a/core/Controller/Admin/AdminController.php +++ b/core/Controller/Admin/AdminController.php @@ -4,15 +4,25 @@ namespace App\Core\Controller\Admin; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; abstract class AdminController extends AbstractController { + protected array $coreParameters; + + public function __construct(ParameterBagInterface $parameters) + { + $this->coreParameters = $parameters->get('core'); + } + /** * {@inheritdoc} */ protected function render(string $view, array $parameters = [], Response $response = null): Response { $parameters['section'] = $this->getSection(); + $parameters['site_name'] = $this->coreParameters['site']['name']; + $parameters['site_logo'] = $this->coreParameters['site']['logo']; return parent::render($view, $parameters, $response); } diff --git a/core/Controller/Auth/AuthController.php b/core/Controller/Auth/AuthController.php index 39250ed..2aa4881 100644 --- a/core/Controller/Auth/AuthController.php +++ b/core/Controller/Auth/AuthController.php @@ -14,9 +14,17 @@ use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use ZxcvbnPhp\Zxcvbn; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; class AuthController extends AbstractController { + protected array $coreParameters; + + public function __construct(ParameterBagInterface $parameters) + { + $this->coreParameters = $parameters->get('core'); + } + /** * @Route("/login", name="auth_login") */ @@ -32,6 +40,8 @@ class AuthController extends AbstractController return $this->render('@Core/auth/login.html.twig', [ 'last_username' => $lastUsername, 'error' => $error, + 'site_name' => $this->coreParameters['site']['name'], + 'site_logo' => $this->coreParameters['site']['logo'], ]); } @@ -70,6 +80,8 @@ class AuthController extends AbstractController return $this->render('@Core/auth/resetting_request.html.twig', [ 'email_sent' => $request->isMethod('POST'), + 'site_name' => $this->coreParameters['site']['name'], + 'site_logo' => $this->coreParameters['site']['logo'], ]); } @@ -128,6 +140,8 @@ class AuthController extends AbstractController 'password_updated' => $passwordUpdated, 'token' => $token, 'expired' => $expired, + 'site_name' => $this->coreParameters['site']['name'], + 'site_logo' => $this->coreParameters['site']['logo'], ]); } diff --git a/core/DependencyInjection/Configuration.php b/core/DependencyInjection/Configuration.php index 54618ff..199223b 100644 --- a/core/DependencyInjection/Configuration.php +++ b/core/DependencyInjection/Configuration.php @@ -15,6 +15,14 @@ class Configuration implements ConfigurationInterface ->children() ->arrayNode('site') ->children() + ->scalarNode('name') + ->isRequired() + ->cannotBeEmpty() + ->end() + ->scalarNode('logo') + ->isRequired() + ->cannotBeEmpty() + ->end() ->arrayNode('pages') ->prototype('array') ->children() diff --git a/core/Resources/views/admin/layout.html.twig b/core/Resources/views/admin/layout.html.twig index 5d39537..b8d6cef 100644 --- a/core/Resources/views/admin/layout.html.twig +++ b/core/Resources/views/admin/layout.html.twig @@ -4,7 +4,7 @@ {{ include('@Core/admin/module/metas.html.twig') }} - {% block title %}Tinternet & cie{% endblock %} + {% block title %}{{ site_name }}{% endblock %} {% block css %} {{ encore_entry_link_tags('admin') }} @@ -15,9 +15,9 @@