diff --git a/src/Controller/Blog/CategoryAdminController.php b/src/Controller/Blog/CategoryAdminController.php index 2ca02cc..81cfe69 100644 --- a/src/Controller/Blog/CategoryAdminController.php +++ b/src/Controller/Blog/CategoryAdminController.php @@ -2,23 +2,21 @@ namespace App\Controller\Blog; -use App\Core\Controller\Admin\AdminController; +use App\Core\Controller\Admin\Crud\CrudController; +use App\Core\Crud\CrudConfiguration; +use App\Core\Crud\Field\ButtonField; +use App\Core\Crud\Field\TextField; +use App\Core\Entity\EntityInterface; use App\Core\Manager\EntityManager; use App\Entity\Blog\Category as Entity; use App\Factory\Blog\CategoryFactory as EntityFactory; -use App\Form\Blog\CategoryType as EntityType; +use App\Form\Blog\CategoryType; use App\Repository\Blog\CategoryRepositoryQuery as RepositoryQuery; use App\Repository\Blog\PostRepositoryQuery; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; -use App\Core\Controller\Admin\Crud\CrudController; -use App\Core\Crud\CrudConfiguration; use Symfony\Component\HttpFoundation\Session\Session; -use App\Core\Crud\Field\TextField; -use App\Form\Blog\CategoryType; -use App\Core\Crud\Field\ButtonField; -use App\Core\Entity\EntityInterface; +use Symfony\Component\Routing\Annotation\Route; /** * @Route("/admin/blog/category") @@ -42,24 +40,17 @@ class CategoryAdminController extends CrudController ->setForm('edit', CategoryType::class, []) ->setForm('new', CategoryType::class) - // ->setForm('filter', FooFilterType::class) ->setMaxPerPage('index', 100) - ->setAction('index', 'new', true) - ->setAction('index', 'show', true) - ->setAction('index', 'edit', true) - ->setAction('index', 'delete', true) - - ->setAction('edit', 'back', true) - ->setAction('edit', 'show', true) - ->setAction('edit', 'delete', true) + ->setView('newForm', 'blog/category_admin/_form.html.twig') + ->setView('editForm', 'blog/category_admin/_form.html.twig') ->setField('index', 'Titre', TextField::class, [ 'property' => 'title', ]) ->setField('index', 'Articles', ButtonField::class, [ - 'property_builder' => function(EntityInterface $entity) { + 'property_builder' => function (EntityInterface $entity) { $count = $entity->getPosts()->count(); return ''.$count.' article'.($count > 1 ? 's' : ''); @@ -77,7 +68,6 @@ class CategoryAdminController extends CrudController { $query->orderBy('.title', 'ASC'); - return $this->doIndex($page, $query, $request, $session); } /** @@ -85,8 +75,6 @@ class CategoryAdminController extends CrudController */ public function new(EntityFactory $factory, EntityManager $entityManager, Request $request): Response { - $this->getConfiguration()->setView('newForm', 'blog/category_admin/_form.html.twig'); - return $this->doNew($factory->create(), $entityManager, $request); } @@ -95,8 +83,6 @@ class CategoryAdminController extends CrudController */ public function edit(Entity $entity, EntityManager $entityManager, Request $request): Response { - $this->getConfiguration()->setView('editForm', 'blog/category_admin/_form.html.twig'); - return $this->doEdit($entity, $entityManager, $request); } @@ -118,6 +104,14 @@ class CategoryAdminController extends CrudController return $this->doShow($entity); } + /** + * @Route("/filter", name="admin_blog_category_filter", methods={"GET"}) + */ + public function filter(Session $session): Response + { + return $this->doFilter($session); + } + /** * @Route("/delete/{entity}", name="admin_blog_category_delete", methods={"DELETE"}) */ diff --git a/src/Controller/Blog/CommentAdminController.php b/src/Controller/Blog/CommentAdminController.php index 0b972a5..e0f8a80 100644 --- a/src/Controller/Blog/CommentAdminController.php +++ b/src/Controller/Blog/CommentAdminController.php @@ -12,31 +12,61 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\Routing\Annotation\Route; +use App\Core\Controller\Admin\Crud\CrudController; +use App\Core\Crud\CrudConfiguration; +use App\Core\Crud\Field\DatetimeField; +use App\Core\Crud\Field\TextField; +use App\Form\Blog\CommentType; /** * @Route("/admin/blog/comment") */ -class CommentAdminController extends AdminController +class CommentAdminController extends CrudController { - protected $filters = []; + public function getConfiguration(): CrudConfiguration + { + return CrudConfiguration::create() + ->setPageTitle('index', 'Commentaire') + ->setPageTitle('edit', 'Par {author}') + ->setPageTitle('show', 'Par {author}') + + ->setPageRoute('index', 'admin_blog_comment_index') + ->setPageRoute('edit', 'admin_blog_comment_edit') + ->setPageRoute('show', 'admin_blog_comment_show') + ->setPageRoute('delete', 'admin_blog_comment_delete') + ->setPageRoute('filter', 'admin_blog_comment_filter') + + ->setForm('edit', CommentType::class, []) + ->setForm('filter', CommentFilterType::class, []) + + ->setAction('index', 'new', false) + + ->setView('showEntity', 'blog/comment_admin/_show.html.twig') + ->setView('editForm', 'blog/comment_admin/_form.html.twig') + + ->setField('index', 'Auteur', TextField::class, [ + 'view' => 'blog/comment_admin/field/author.html.twig', + 'attr' => ['class' => 'miw-300'], + ]) + ->setField('index', 'Date', DatetimeField::class, [ + 'property' => 'createdAt', + 'attr' => ['class' => 'miw-200'], + ]) + ->setField('index', 'Status', TextField::class, [ + 'view' => 'blog/comment_admin/field/status.html.twig', + 'attr' => ['class' => 'miw-100'], + ]) + ; + } /** * @Route("/{page}", name="admin_blog_comment_index", requirements={"page": "\d+"}) */ public function index(int $page = 1, RepositoryQuery $query, Request $request, Session $session): Response { - $this->updateFilters($request, $session); + $query->orderBy('.id', 'DESC'); - $pager = $query - ->orderBy('.id', 'DESC') - ->useFilters($this->filters) - ->paginate($page) - ; - - return $this->render('blog/comment_admin/index.html.twig', [ - 'pager' => $pager, - 'hasFilters' => !empty($this->filters), - ]); + return $this->doIndex($page, $query, $request, $session); } /** @@ -44,26 +74,7 @@ class CommentAdminController extends AdminController */ public function edit(Entity $entity, EntityManager $entityManager, Request $request): Response { - $form = $this->createForm(EntityType::class, $entity); - - if ($request->isMethod('POST')) { - $form->handleRequest($request); - - if ($form->isValid()) { - $entityManager->update($entity); - $this->addFlash('success', 'The form is not valid.'); - - return $this->redirectToRoute('admin_blog_comment_edit', [ - 'entity' => $entity->getId(), - ]); - } - $this->addFlash('warning', 'The form is not valid.'); - } - - return $this->render('blog/comment_admin/edit.html.twig', [ - 'form' => $form->createView(), - 'entity' => $entity, - ]); + return $this->doEdit($entity, $entityManager, $request); } /** @@ -71,22 +82,15 @@ class CommentAdminController extends AdminController */ public function show(Entity $entity): Response { - return $this->render('blog/comment_admin/show.html.twig', [ - 'entity' => $entity, - ]); + return $this->doShow($entity); } /** - * @Route("/filters", name="admin_blog_comment_filters") + * @Route("/filters", name="admin_blog_comment_filter") */ - public function filters(Session $session): Response + public function filter(Session $session): Response { - $form = $this->createForm(CommentFilterType::class); - $form->submit($session->get('comment_filter')); - - return $this->render('blog/comment_admin/filters.html.twig', [ - 'form' => $form->createView(), - ]); + return $this->doFilter($session); } /** @@ -94,43 +98,11 @@ class CommentAdminController extends AdminController */ public function delete(Entity $entity, EntityManager $entityManager, Request $request): Response { - if ($this->isCsrfTokenValid('delete'.$entity->getId(), $request->request->get('_token'))) { - $entityManager->delete($entity); - - $this->addFlash('success', 'The data has been removed.'); - } - - return $this->redirectToRoute('admin_blog_comment_index'); + return $this->doDelete($entity, $entityManager, $request); } public function getSection(): string { return 'blog_comment'; } - - protected function updateFilters(Request $request, Session $session) - { - if ($request->query->has('comment_filter')) { - $filters = $request->query->get('comment_filter'); - - if ('0' === $filters) { - $filters = []; - } - } elseif ($session->has('comment_filter')) { - $filters = $session->get('comment_filter'); - } else { - $filters = []; - } - - $form = $this->createForm(CommentFilterType::class); - $form->submit($filters); - - if (empty($filters)) { - $this->filters = $filters; - $session->set('comment_filter', $filters); - } elseif ($form->isValid()) { - $this->filters = $form->getData(); - $session->set('comment_filter', $filters); - } - } } diff --git a/src/Controller/Blog/PostAdminController.php b/src/Controller/Blog/PostAdminController.php index 3912bc6..d93ec43 100644 --- a/src/Controller/Blog/PostAdminController.php +++ b/src/Controller/Blog/PostAdminController.php @@ -2,84 +2,93 @@ namespace App\Controller\Blog; -use App\Core\Controller\Admin\AdminController; +use App\Core\Controller\Admin\Crud\CrudController; +use App\Core\Crud\CrudConfiguration; +use App\Core\Crud\Field\DatetimeField; +use App\Core\Crud\Field\TextField; use App\Core\Form\FileUploadHandler; use App\Core\Manager\EntityManager; use App\Entity\Blog\Post as Entity; use App\Factory\Blog\PostFactory as EntityFactory; use App\Form\Blog\Filter\PostFilterType; +use App\Form\Blog\PostType; use App\Form\Blog\PostType as EntityType; use App\Repository\Blog\PostRepositoryQuery as RepositoryQuery; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Form\Form; /** * @Route("/admin/blog/post") */ -class PostAdminController extends AdminController +class PostAdminController extends CrudController { - protected $filters = []; + public function getConfiguration(): CrudConfiguration + { + return CrudConfiguration::create() + ->setPageTitle('index', 'Articles') + ->setPageTitle('new', 'Nouvel article') + ->setPageTitle('edit', '{title}') + ->setPageTitle('show', '{title}') + + ->setPageRoute('index', 'admin_blog_post_index') + ->setPageRoute('edit', 'admin_blog_post_edit') + ->setPageRoute('new', 'admin_blog_post_new') + ->setPageRoute('show', 'admin_blog_post_show') + ->setPageRoute('delete', 'admin_blog_post_delete') + ->setPageRoute('filter', 'admin_blog_post_filter') + + ->setForm('new', PostType::class, []) + ->setForm('edit', PostType::class, []) + ->setForm('filter', PostFilterType::class, []) + + ->setView('showEntity', 'blog/post_admin/_show.html.twig') + ->setView('editForm', 'blog/post_admin/_form.html.twig') + ->setView('newForm', 'blog/post_admin/_form.html.twig') + + ->setField('index', 'Titre', TextField::class, [ + 'view' => 'blog/post_admin/field/title.html.twig', + 'attr' => ['class' => 'miw-400'], + ]) + ->setField('index', 'Mise à jour', DatetimeField::class, [ + 'property' => 'updatedAt', + 'attr' => ['class' => 'miw-200'], + ]) + ->setField('index', 'Publié le', DatetimeField::class, [ + 'property' => 'updatedAt', + 'attr' => ['class' => 'miw-200'], + ]) + ->setField('index', 'Status', TextField::class, [ + 'view' => 'blog/post_admin/field/status.html.twig', + 'attr' => ['class' => 'miw-100'], + ]) + ; + } /** * @Route("/{page}", name="admin_blog_post_index", requirements={"page": "\d+"}) */ public function index(int $page = 1, RepositoryQuery $query, Request $request, Session $session): Response { - $this->updateFilters($request, $session); + $query->orderBy('.id', 'DESC'); - $pager = $query - ->orderBy('.id', 'DESC') - ->useFilters($this->filters) - ->paginate($page) - ; - - return $this->render('blog/post_admin/index.html.twig', [ - 'pager' => $pager, - 'hasFilters' => !empty($this->filters), - ]); + return $this->doIndex($page, $query, $request, $session); } /** * @Route("/new", name="admin_blog_post_new") */ - public function new(EntityFactory $factory, EntityManager $entityManager, Request $request): Response + public function new(EntityFactory $factory, EntityManager $entityManager, FileUploadHandler $fileUpload, Request $request): Response { $entity = $factory->create($this->getUser()); - $form = $this->createForm(EntityType::class, $entity); - if ($request->isMethod('POST')) { - $form->handleRequest($request); - - if ($form->isValid()) { - $entityManager->create($entity); - $this->addFlash('success', 'The data has been saved.'); - - return $this->redirectToRoute('admin_blog_post_edit', [ - 'entity' => $entity->getId(), - ]); - } - $this->addFlash('warning', 'The form is not valid.'); - } - - return $this->render('blog/post_admin/new.html.twig', [ - 'form' => $form->createView(), - 'entity' => $entity, - ]); - } - - /** - * @Route("/edit/{entity}", name="admin_blog_post_edit") - */ - public function edit(Entity $entity, EntityManager $entityManager, FileUploadHandler $fileUpload, Request $request): Response - { - $form = $this->createForm(EntityType::class, $entity); - - if ($request->isMethod('POST')) { - $form->handleRequest($request); - - if ($form->isValid()) { + return $this->doNew( + $factory->create($this->getUser()), + $entityManager, + $request, + function(Entity $entity, Form $form, Request $request) use ($fileUpload) { $directory = 'uploads/post/'.date('Y'); $fileUpload->handleForm( @@ -89,21 +98,31 @@ class PostAdminController extends AdminController $entity->setImage($directory.'/'.$filename); } ); - - $entityManager->update($entity); - $this->addFlash('success', 'The data has been saved.'); - - return $this->redirectToRoute('admin_blog_post_edit', [ - 'entity' => $entity->getId(), - ]); } - $this->addFlash('warning', 'The form is not valid.'); - } + ); + } - return $this->render('blog/post_admin/edit.html.twig', [ - 'form' => $form->createView(), - 'entity' => $entity, - ]); + /** + * @Route("/edit/{entity}", name="admin_blog_post_edit") + */ + public function edit(Entity $entity, EntityManager $entityManager, FileUploadHandler $fileUpload, Request $request): Response + { + return $this->doEdit( + $entity, + $entityManager, + $request, + function(Entity $entity, Form $form, Request $request) use ($fileUpload) { + $directory = 'uploads/post/'.date('Y'); + + $fileUpload->handleForm( + $form->get('image')->getData(), + $directory, + function ($filename) use ($entity, $directory) { + $entity->setImage($directory.'/'.$filename); + } + ); + } + ); } /** @@ -111,9 +130,7 @@ class PostAdminController extends AdminController */ public function show(Entity $entity): Response { - return $this->render('blog/post_admin/show.html.twig', [ - 'entity' => $entity, - ]); + return $this->doShow($entity); } /** @@ -121,6 +138,8 @@ class PostAdminController extends AdminController */ public function fetchQuickData(Entity $entity, EntityManager $entityManager): Response { + $configuration = $this->getConfiguration(); + if (!$entity->getIsQuick()) { $this->addFlash('warning', 'L\'article n\'est pas Quick'); } else { @@ -145,7 +164,8 @@ class PostAdminController extends AdminController ->setQuickImage($opengraph['images'][0]['url'] ?? $graby['image'] ?? null) ->setQuickVideo($opengraph['videos'][0]['url'] ?? null) ->setQuickVideoWidth($opengraph['videos'][0]['width'] ?? null) - ->setQuickVideoHeight($opengraph['videos'][0]['height'] ?? null); + ->setQuickVideoHeight($opengraph['videos'][0]['height'] ?? null) + ; $entityManager->update($entity); @@ -155,22 +175,17 @@ class PostAdminController extends AdminController } } - return $this->redirectToRoute('admin_blog_post_edit', [ + return $this->redirectToRoute($configuration->getPageRoute('edit'), [ 'entity' => $entity->getId(), ]); } /** - * @Route("/filters", name="admin_blog_post_filters") + * @Route("/filters", name="admin_blog_post_filter") */ - public function filters(Session $session): Response + public function filter(Session $session): Response { - $form = $this->createForm(PostFilterType::class); - $form->submit($session->get('post_filter', [])); - - return $this->render('blog/post_admin/filters.html.twig', [ - 'form' => $form->createView(), - ]); + return $this->doFilter($session); } /** @@ -178,43 +193,11 @@ class PostAdminController extends AdminController */ public function delete(Entity $entity, EntityManager $entityManager, Request $request): Response { - if ($this->isCsrfTokenValid('delete'.$entity->getId(), $request->request->get('_token'))) { - $entityManager->delete($entity); - - $this->addFlash('success', 'The data has been removed.'); - } - - return $this->redirectToRoute('admin_blog_post_index'); + return $this->doDelete($entity, $entityManager, $request); } public function getSection(): string { return 'blog_post'; } - - protected function updateFilters(Request $request, Session $session) - { - if ($request->query->has('post_filter')) { - $filters = $request->query->get('post_filter'); - - if ('0' === $filters) { - $filters = []; - } - } elseif ($session->has('post_filter')) { - $filters = $session->get('post_filter'); - } else { - $filters = []; - } - - $form = $this->createForm(PostFilterType::class); - $form->submit($filters); - - if (empty($filters)) { - $this->filters = $filters; - $session->set('post_filter', $filters); - } elseif ($form->isValid()) { - $this->filters = $form->getData(); - $session->set('post_filter', $filters); - } - } } diff --git a/templates/blog/comment_admin/_show.html.twig b/templates/blog/comment_admin/_show.html.twig new file mode 100644 index 0000000..a3f44f5 --- /dev/null +++ b/templates/blog/comment_admin/_show.html.twig @@ -0,0 +1,58 @@ +
+
+ +
+
+
Contenu
+ + {% if entity.createdAt.timestamp > 1538118768 %} {# 28/09/2018 #} + {{- entity.content|markdown('comment') -}} + {% else %} + {{- entity.content|comment -}} + {% endif %} +
+
diff --git a/templates/blog/comment_admin/edit.html.twig b/templates/blog/comment_admin/edit.html.twig deleted file mode 100644 index 26006be..0000000 --- a/templates/blog/comment_admin/edit.html.twig +++ /dev/null @@ -1,57 +0,0 @@ -{% extends '@Core/admin/layout.html.twig' %} - -{% block title %}{{ 'Commentaires'|trans }} - {{ parent() }}{% endblock %} - -{% block body %} -
-
-

{{ entity.author }}

- -
-
- - - Retour à la liste - - - - Voir - - - - - - -
-
-
-
- -
-
-
-
- {{ include('blog/comment_admin/_form.html.twig') }} -
-
-
- - {{ form_rest(form) }} -
- -
- - -
-{% endblock %} diff --git a/templates/blog/comment_admin/field/author.html.twig b/templates/blog/comment_admin/field/author.html.twig new file mode 100644 index 0000000..e54c66c --- /dev/null +++ b/templates/blog/comment_admin/field/author.html.twig @@ -0,0 +1,12 @@ + + {{ entity.author }} + + +Dans {{ entity.post.title }} + +{% if entity.parentComment %} + en réponse à + + {{ entity.parentComment }} + +{% endif %} diff --git a/templates/blog/comment_admin/field/status.html.twig b/templates/blog/comment_admin/field/status.html.twig new file mode 100644 index 0000000..9adc218 --- /dev/null +++ b/templates/blog/comment_admin/field/status.html.twig @@ -0,0 +1,3 @@ + diff --git a/templates/blog/comment_admin/filters.html.twig b/templates/blog/comment_admin/filters.html.twig deleted file mode 100644 index 509b210..0000000 --- a/templates/blog/comment_admin/filters.html.twig +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/templates/blog/comment_admin/index.html.twig b/templates/blog/comment_admin/index.html.twig deleted file mode 100644 index deedbae..0000000 --- a/templates/blog/comment_admin/index.html.twig +++ /dev/null @@ -1,93 +0,0 @@ -{% extends '@Core/admin/layout.html.twig' %} - -{% block title %}{{ 'Commentaires'|trans }} - {{ parent() }}{% endblock %} - -{% block body %} -
-
-

{{ 'Commentaires'|trans }}

-
- -
-
- -
-
- {{ knp_pagination_render(pager) }} -
-
-
- -
- - - - - - - - - - - {% for item in pager %} - {% set edit = path('admin_blog_comment_edit', {entity: item.id}) %} - {% set show = path('admin_blog_comment_show', {entity: item.id}) %} - - - - - - - - {% else %} - - - - {% endfor %} - -
AuteurDateStatutActions
- - {{ item.author }} - - - Dans {{ item.post.title }} - - {% if item.parentComment %} - en réponse à - - {{ item.parentComment }} - - {% endif %} - - - - {{ item.updatedAt|date('d/m/Y H:i') }} - - - - - - - - - -
- - -
-
-
- -
-
- Aucun résultat -
-
-
-{% endblock %} diff --git a/templates/blog/comment_admin/show.html.twig b/templates/blog/comment_admin/show.html.twig deleted file mode 100644 index 002a81f..0000000 --- a/templates/blog/comment_admin/show.html.twig +++ /dev/null @@ -1,95 +0,0 @@ -{% extends '@Core/admin/layout.html.twig' %} - -{% block title %}{{ 'Commentaires'|trans }} - {{ parent() }}{% endblock %} - -{% block body %} -
-
-

{{ entity.author }}

- - -
-
- -
-
- -
-
-
Contenu
- - {% if entity.createdAt.timestamp > 1538118768 %} {# 28/09/2018 #} - {{- entity.content|markdown('comment') -}} - {% else %} - {{- entity.content|comment -}} - {% endif %} -
-
-{% endblock %} - -{% block css %} - {{ parent() }} - - -{% endblock %} diff --git a/templates/blog/post_admin/_show.html.twig b/templates/blog/post_admin/_show.html.twig new file mode 100644 index 0000000..91cb1e6 --- /dev/null +++ b/templates/blog/post_admin/_show.html.twig @@ -0,0 +1,120 @@ +
+
+ + {% if entity.isQuick %} + + {% endif %} +
+
+
Contenu
+ + {% if entity.contentFormat == 'html' %} + {{ entity.content|raw|nl2br }} + {% else %} + {{ entity.content|markdown('post') }} + {% endif %} + + {% if entity.notebook %} +
+ +
Carnet de notes
+ + {{ entity.notebook|markdown('post') }} + {% endif %} +
+
+ +
+
+ + + diff --git a/templates/blog/post_admin/field/status.html.twig b/templates/blog/post_admin/field/status.html.twig new file mode 100644 index 0000000..e9aa29d --- /dev/null +++ b/templates/blog/post_admin/field/status.html.twig @@ -0,0 +1,7 @@ +{% set map = { + 0: ['warning', 'Brouillon'], + 1: ['success', 'Publié'], +} %} + diff --git a/templates/blog/post_admin/field/title.html.twig b/templates/blog/post_admin/field/title.html.twig new file mode 100644 index 0000000..739ca35 --- /dev/null +++ b/templates/blog/post_admin/field/title.html.twig @@ -0,0 +1,20 @@ +{% if entity.image %} + {% set image = asset(entity.image.pathname) %} +{% else %} + {% set image = asset('build/images/no-image.png') %} +{% endif %} + + + + + {{ entity.title }} + + +{% set categories = [] %} + +{% for category in entity.categories %} + {% set url = path('admin_blog_category_show', {entity: category.id}) %} + {% set categories = categories|merge(['' ~ category.title ~ '']) %} +{% endfor %} + +Dans {{ categories|join(', ')|raw }} diff --git a/templates/blog/post_admin/index.html.twig b/templates/blog/post_admin/index.html.twig deleted file mode 100644 index 498dc6f..0000000 --- a/templates/blog/post_admin/index.html.twig +++ /dev/null @@ -1,114 +0,0 @@ -{% extends '@Core/admin/layout.html.twig' %} - -{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %} - -{% block body %} -
-
-

Articles

- - -
- -
-
- -
-
- {{ knp_pagination_render(pager) }} -
-
-
- -
- - - - - - - - - - - {% for item in pager %} - {% set edit = path('admin_blog_post_edit', {entity: item.id}) %} - {% set show = path('admin_blog_post_show', {entity: item.id}) %} - - - - - - - - {% else %} - - - - {% endfor %} - -
TitreMise à jourStatutActions
- {% if item.image %} - {% set image = asset(item.image.pathname) %} - {% else %} - {% set image = asset('build/images/no-image.png') %} - {% endif %} - - - - - {{ item.title }} - - - {% set categories = [] %} - - {% for category in item.categories %} - {% set url = path('admin_blog_category_show', {entity: category.id}) %} - {% set categories = categories|merge(['' ~ category.title ~ '']) %} - {% endfor %} - - Dans {{ categories|join(', ')|raw }} - - - - {{ item.updatedAt|date('d/m/Y H:i') }} - - - {% set map = { - 0: ['warning', 'Brouillon'], - 1: ['success', 'Publié'], - } %} - - - - - - - -
- - -
-
-
- -
-
- Aucun résultat -
-
-
-{% endblock %} diff --git a/templates/blog/post_admin/new.html.twig b/templates/blog/post_admin/new.html.twig deleted file mode 100644 index 71493b4..0000000 --- a/templates/blog/post_admin/new.html.twig +++ /dev/null @@ -1,41 +0,0 @@ -{% extends '@Core/admin/layout.html.twig' %} - -{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %} - -{% block body %} -
-
-

Nouvel article

- -
-
- - - - Retour à la liste - - - -
-
-
-
- -
-
-
-
- {{ include('blog/post_admin/_form.html.twig') }} -
-
-
- -
- {{ form_rest(form) }} -
-
-{% endblock %} diff --git a/templates/blog/post_admin/show.html.twig b/templates/blog/post_admin/show.html.twig deleted file mode 100644 index 2f79b01..0000000 --- a/templates/blog/post_admin/show.html.twig +++ /dev/null @@ -1,150 +0,0 @@ -{% extends '@Core/admin/layout.html.twig' %} - -{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %} - -{% block body %} -
-
-

{{ entity.title }}

- - -
-
- -
-
- - {% if entity.isQuick %} - - {% endif %} -
-
-
Contenu
- - {% if entity.contentFormat == 'html' %} - {{ entity.content|raw|nl2br }} - {% else %} - {{ entity.content|markdown('post') }} - {% endif %} - - {% if entity.notebook %} -
- -
Carnet de notes
- - {{ entity.notebook|markdown('post') }} - {% endif %} -
-
- -
-
-{% endblock %} - -{% block css %} - {{ parent() }} - - -{% endblock %}