backports murph-skeleton
This commit is contained in:
parent
a20a32ea0f
commit
d34ce1b585
|
@ -12,7 +12,6 @@ $pagination-bg: #ffffff !default;
|
|||
$pagination-active-color: #ffffff !default;
|
||||
$pagination-active-bg: #343a40 !default;
|
||||
|
||||
@import "~simplemde/dist/simplemde.min.css";
|
||||
@import "~choices.js/src/styles/choices.scss";
|
||||
@import "~bootstrap/scss/bootstrap.scss";
|
||||
@import "~@fortawesome/fontawesome-free/css/all.css";
|
||||
|
@ -96,9 +95,9 @@ body {
|
|||
padding-right: 25px;
|
||||
}
|
||||
|
||||
.thead-light {
|
||||
.table .thead-light {
|
||||
a, th {
|
||||
color: #333333;
|
||||
color: map-get($theme-colors, 'dark-blue');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,8 +111,21 @@ tr.table-primary-light {
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.table tr {
|
||||
td {
|
||||
transition: border 500ms ease-out;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
td {
|
||||
border-bottom: 1px solid #a8aaac;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bg-dark-blue {
|
||||
background: #242b3b;
|
||||
background: map-get($theme-colors, 'dark-blue');
|
||||
color: #fff;
|
||||
|
||||
.nav-item-label {
|
||||
|
@ -132,6 +144,7 @@ tr.table-primary-light {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
.sidebar {
|
||||
width: 260px;
|
||||
display: inline-block;
|
||||
|
|
|
@ -2,6 +2,19 @@ core:
|
|||
site:
|
||||
name: "Blog"
|
||||
logo: "build/images/core/logo.svg"
|
||||
controllers:
|
||||
- {name: 'PostController::posts', action: 'App\Controller\Blog\PostController::posts'}
|
||||
- {name: 'CategoryController::categories', action: 'App\Controller\Blog\CategoryController::categories'}
|
||||
- {name: 'PostController::category', action: 'App\Controller\Blog\PostController::category'}
|
||||
- {name: 'PostController::search', action: 'App\Controller\Blog\PostController::search'}
|
||||
- {name: 'LinkController:links', action: 'App\Controller\LinkController:links'}
|
||||
- {name: 'ContactController::contact', action: 'App\Controller\ContactController::contact'}
|
||||
- {name: 'PostController::post', action: 'App\Controller\Blog\PostController::post'}
|
||||
- {name: '\Blog\PostController::rss', action: 'App\Controller\Blog\PostController::rss'}
|
||||
- {name: 'BotController::formWithoutJavascript', action: 'App\Controller\BotController::formWithoutJavascript'}
|
||||
- {name: 'LinkController:rss', action: 'App\Controller\LinkController:rss'}
|
||||
- {name: 'PostController::jsonApi', action: 'App\Controller\Blog\PostController::jsonApi'}
|
||||
- {name: 'TextController:text', action: 'App\Controller\TextController:text'}
|
||||
pages:
|
||||
App\Entity\Page\SimplePage:
|
||||
name: 'Page de contenu'
|
||||
|
|
|
@ -20,6 +20,7 @@ use Symfony\Component\Form\FormError;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use App\Core\Site\ControllerLocator;
|
||||
|
||||
/**
|
||||
* @Route("/admin/site/node")
|
||||
|
@ -36,11 +37,13 @@ class NodeAdminController extends AdminController
|
|||
EntityManager $entityManager,
|
||||
NodeRepository $nodeRepository,
|
||||
PageLocator $pageLocator,
|
||||
ControllerLocator $controllerLocator,
|
||||
Request $request
|
||||
): Response {
|
||||
$entity = $factory->create($node->getMenu());
|
||||
$form = $this->createForm(EntityType::class, $entity, [
|
||||
'pages' => $pageLocator->getPages(),
|
||||
'controllers' => $controllerLocator->getControllers(),
|
||||
'navigation' => $node->getMenu()->getNavigation(),
|
||||
]);
|
||||
|
||||
|
@ -105,10 +108,12 @@ class NodeAdminController extends AdminController
|
|||
EntityManager $entityManager,
|
||||
PageFactory $pageFactory,
|
||||
PageLocator $pageLocator,
|
||||
ControllerLocator $controllerLocator,
|
||||
Request $request
|
||||
): Response {
|
||||
$form = $this->createForm(EntityType::class, $entity, [
|
||||
'pages' => $pageLocator->getPages(),
|
||||
'controllers' => $controllerLocator->getControllers(),
|
||||
'navigation' => $entity->getMenu()->getNavigation(),
|
||||
]);
|
||||
|
||||
|
|
|
@ -23,6 +23,18 @@ class Configuration implements ConfigurationInterface
|
|||
->isRequired()
|
||||
->cannotBeEmpty()
|
||||
->end()
|
||||
->arrayNode('controllers')
|
||||
->prototype('array')
|
||||
->children()
|
||||
->scalarNode('name')
|
||||
->cannotBeEmpty()
|
||||
->end()
|
||||
->scalarNode('action')
|
||||
->cannotBeEmpty()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->arrayNode('pages')
|
||||
->prototype('array')
|
||||
->children()
|
||||
|
@ -42,6 +54,7 @@ class Configuration implements ConfigurationInterface
|
|||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
|
|
|
@ -89,15 +89,20 @@ class NodeType extends AbstractType
|
|||
|
||||
$builder->add(
|
||||
'controller',
|
||||
TextType::class,
|
||||
ChoiceType::class,
|
||||
[
|
||||
'label' => 'Controller',
|
||||
'required' => false,
|
||||
'help' => 'Leave blank to use the default one. Example: App\\Controller\\FooController::barAction',
|
||||
'attr' => [
|
||||
],
|
||||
'constraints' => [
|
||||
],
|
||||
'help' => 'Leave blank to use the default one',
|
||||
'choices' => call_user_func(function () use ($options) {
|
||||
$choices = [];
|
||||
|
||||
foreach ($options['controllers'] as $controller) {
|
||||
$choices[$controller->getName()] = $controller->getAction();
|
||||
}
|
||||
|
||||
return $choices;
|
||||
}),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -259,6 +264,7 @@ class NodeType extends AbstractType
|
|||
$resolver->setDefaults([
|
||||
'data_class' => Node::class,
|
||||
'pages' => [],
|
||||
'controllers' => [],
|
||||
'navigation' => null,
|
||||
]);
|
||||
}
|
||||
|
|
38
core/Site/ControllerConfiguration.php
Normal file
38
core/Site/ControllerConfiguration.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Core\Site;
|
||||
|
||||
/**
|
||||
* class ControllerConfiguration.
|
||||
*
|
||||
* @author Simon Vieille <simon@deblan.fr>
|
||||
*/
|
||||
class ControllerConfiguration
|
||||
{
|
||||
protected string $name;
|
||||
protected string $action;
|
||||
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setAction(string $action): self
|
||||
{
|
||||
$this->action = $action;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAction(): string
|
||||
{
|
||||
return $this->action;
|
||||
}
|
||||
}
|
42
core/Site/ControllerLocator.php
Normal file
42
core/Site/ControllerLocator.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Core\Site;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
/**
|
||||
* class ControllerLocator.
|
||||
*
|
||||
* @author Simon Vieille <simon@deblan.fr>
|
||||
*/
|
||||
class ControllerLocator
|
||||
{
|
||||
protected array $params;
|
||||
protected array $controllers = [];
|
||||
|
||||
public function __construct(ParameterBagInterface $bag)
|
||||
{
|
||||
$this->params = $bag->get('core');
|
||||
$this->loadControllers();
|
||||
}
|
||||
|
||||
public function getControllers(): array
|
||||
{
|
||||
return $this->controllers;
|
||||
}
|
||||
|
||||
protected function loadControllers(): void
|
||||
{
|
||||
$params = $this->params['site']['controllers'] ?? [];
|
||||
|
||||
foreach ($params as $conf) {
|
||||
$controllerConfiguration = new ControllerConfiguration();
|
||||
$controllerConfiguration
|
||||
->setName($conf['name'])
|
||||
->setAction($conf['action'])
|
||||
;
|
||||
|
||||
$this->controllers[$conf['action']] = $controllerConfiguration;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|||
class PageLocator
|
||||
{
|
||||
protected array $params;
|
||||
protected array $pages;
|
||||
protected array $pages = [];
|
||||
|
||||
public function __construct(ParameterBagInterface $bag)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue