Browse Source

prepare the core to be override

develop
Simon Vieille 2 months ago
parent
commit
e93a63f9e9
  1. 1
      config/bundles.php
  2. 1
      config/packages/twig.yaml
  3. 2
      core/Controller/Dashboard/DashboardAdminController.php
  4. 8
      core/Resources/views/admin/layout.html.twig
  5. 25
      core/Resources/views/admin/module/account.html.twig
  6. 1
      core/Resources/views/dashboard/admin/index.html.twig
  7. 23
      src/Bundle/AppBundle.php
  8. 28
      src/DependencyInjection/AppExtension.php
  9. 16
      src/DependencyInjection/Configuration.php
  10. 13
      templates/core/dashboard/index.html.twig

1
config/bundles.php

@ -18,4 +18,5 @@ return [
Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
App\Core\Bundle\CoreBundle::class => ['all' => true],
App\Bundle\AppBundle::class => ['all' => true],
];

1
config/packages/twig.yaml

@ -2,4 +2,5 @@ twig:
default_path: '%kernel.project_dir%/templates'
form_themes: ['@Core/form/bootstrap_4_form_theme.html.twig']
paths:
'%kernel.project_dir%/templates/core/': Core
'%kernel.project_dir%/core/Resources/views/': Core

2
core/Controller/Dashboard/DashboardAdminController.php

@ -16,7 +16,7 @@ class DashboardAdminController extends AdminController
*/
public function index(): Response
{
return $this->render('@Core/dashboard/admin/index.html.twig', [
return $this->render('@Core/dashboard/index.html.twig', [
]);
}

8
core/Resources/views/admin/layout.html.twig

@ -21,14 +21,8 @@
</a>
<div class="ml-auto">
<div class="collapse navbar-collapse" id="navigation">
{{ include('@Core/admin/module/account.html.twig') }}
</div>
{{ include('@Core/admin/module/account.html.twig') }}
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navigation" aria-controls="navigation" aria-expanded="false" aria-label="Afficher navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
{% block body_container %}

25
core/Resources/views/admin/module/account.html.twig

@ -1,16 +1,15 @@
<div>
<div class="btn-group">
<button type="button" class="btn btn-light dropdown-toggle dropdown-toggle-hide-after" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fa fa-cog"></span>
</button>
<div class="dropdown-menu dropdown-menu-lg-right">
<a href="{{ path('admin_account') }}" class="dropdown-item">
Mon compte
</a>
<div class="btn-group">
<button type="button" class="btn btn-light dropdown-toggle dropdown-toggle-hide-after" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ app.user }}
<span class="ml-1 fa fa-cog"></span>
</button>
<div class="dropdown-menu dropdown-menu-right">
<a href="{{ path('admin_account') }}" class="dropdown-item">
Mon compte
</a>
<a href="{{ path('auth_logout') }}" class="dropdown-item">
Déconnexion
</a>
</div>
<a href="{{ path('auth_logout') }}" class="dropdown-item">
Déconnexion
</a>
</div>
</div>

1
core/Resources/views/dashboard/admin/index.html.twig

@ -1 +0,0 @@
{% extends '@Core/admin/layout.html.twig' %}

23
src/Bundle/AppBundle.php

@ -0,0 +1,23 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Bundle;
use App\DependencyInjection\AppExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AppBundle extends Bundle
{
public function getContainerExtension()
{
return new AppExtension();
}
}

28
src/DependencyInjection/AppExtension.php

@ -0,0 +1,28 @@
<?php
namespace App\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
class AppExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter('app', $config);
}
/**
* {@inheritdoc}
*/
public function getConfiguration(array $configs, ContainerBuilder $container)
{
return new Configuration();
}
}

16
src/DependencyInjection/Configuration.php

@ -0,0 +1,16 @@
<?php
namespace App\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('app');
return $treeBuilder;
}
}

13
templates/core/dashboard/index.html.twig

@ -0,0 +1,13 @@
{% extends '@Core/admin/layout.html.twig' %}
{% block body %}
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
<div class="d-flex">
<div class="mr-auto w-50">
<h1 class="display-5">
Tableau de bord
</h1>
</div>
</div>
</div>
{% endblock %}
Loading…
Cancel
Save