update cruds using CrudController
This commit is contained in:
parent
aca3b7d676
commit
7ef536defa
|
@ -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 '<strong>'.$count.'</strong> 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"})
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
58
templates/blog/comment_admin/_show.html.twig
Normal file
58
templates/blog/comment_admin/_show.html.twig
Normal file
|
@ -0,0 +1,58 @@
|
|||
<div class="row">
|
||||
<div class="col-md-4 p-3">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Auteur</span>
|
||||
|
||||
{{ entity.author }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Site web</span>
|
||||
|
||||
{{ entity.website }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">E-mail</span>
|
||||
|
||||
{{ entity.email }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Article</span>
|
||||
|
||||
<a href="{{ path('admin_blog_post_show', {entity: entity.post.id}) }}">
|
||||
{{ entity.post.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% if entity.parentComment %}
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">
|
||||
Réponse à
|
||||
<a href="{{ path('admin_blog_comment_show', {entity: entity.parentComment.id}) }}">
|
||||
{{ entity.parentComment.author }} - {{ entity.parentComment.createdAt|date('d/m/Y H:i') }}
|
||||
</a>
|
||||
</span>
|
||||
|
||||
{% if entity.parentComment.createdAt.timestamp > 1538118768 %} {# 28/09/2018 #}
|
||||
{{- entity.parentComment.content|markdown('comment') -}}
|
||||
{% else %}
|
||||
{{- entity.parentComment.content|comment -}}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Status</span>
|
||||
|
||||
{{ entity.isActive ? 'En ligne' : 'Hors ligne' }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-8 p-3">
|
||||
<div class="font-weight-bold pb-2">Contenu</div>
|
||||
|
||||
{% if entity.createdAt.timestamp > 1538118768 %} {# 28/09/2018 #}
|
||||
{{- entity.content|markdown('comment') -}}
|
||||
{% else %}
|
||||
{{- entity.content|comment -}}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
|
@ -1,57 +0,0 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ 'Commentaires'|trans }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
|
||||
<div class="crud-header">
|
||||
<h1 class="crud-header-title">{{ entity.author }}</h1>
|
||||
|
||||
<div class="crud-header-actions">
|
||||
<div class="btn-group">
|
||||
<a href="{{ path('admin_blog_comment_index') }}" class="btn btn-light">
|
||||
<span class="fa fa-list pr-1"></span>
|
||||
Retour à la liste
|
||||
</a>
|
||||
<a href="{{ path('admin_blog_comment_show', {entity: entity.id}) }}" class="btn btn-secondary">
|
||||
<span class="fa fa-eye pr-1"></span>
|
||||
Voir
|
||||
</a>
|
||||
|
||||
<button type="submit" form="form-main" class="btn btn-primary">
|
||||
<span class="fa fa-save pr-1"></span>
|
||||
Enregistrer
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-white dropdown-toggle dropdown-toggle-hide-after" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="font-weight-bold">
|
||||
⋅⋅⋅
|
||||
</span>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<button type="submit" form="form-delete" class="dropdown-item">
|
||||
Supprimer
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form action="{{ app.request.uri }}" method="post" id="form-main" enctype="multipart/form-data">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active">
|
||||
<div class="tab-form">
|
||||
{{ include('blog/comment_admin/_form.html.twig') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_rest(form) }}
|
||||
</form>
|
||||
|
||||
<form method="post" action="{{ path('admin_blog_comment_delete', {entity: entity.id}) }}" id="form-delete" data-form-confirm>
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ entity.id) }}">
|
||||
</form>
|
||||
{% endblock %}
|
12
templates/blog/comment_admin/field/author.html.twig
Normal file
12
templates/blog/comment_admin/field/author.html.twig
Normal file
|
@ -0,0 +1,12 @@
|
|||
<a href="{{ path('admin_blog_comment_show', {entity: entity.id}) }}" class="font-weight-bold text-body d-block">
|
||||
{{ entity.author }}
|
||||
</a>
|
||||
|
||||
Dans <a href="{{ path('admin_blog_post_show', {entity: entity.post.id}) }}">{{ entity.post.title }}</a>
|
||||
|
||||
{% if entity.parentComment %}
|
||||
en réponse à
|
||||
<a href="{{ path('admin_blog_comment_show', {entity: entity.parentComment.id}) }}">
|
||||
{{ entity.parentComment }}
|
||||
</a>
|
||||
{% endif %}
|
3
templates/blog/comment_admin/field/status.html.twig
Normal file
3
templates/blog/comment_admin/field/status.html.twig
Normal file
|
@ -0,0 +1,3 @@
|
|||
<button class="btn btn-sm btn-{{ entity.isActive ? 'success' : 'warning' }}">
|
||||
{{ entity.isActive ? 'En ligne' : 'Hors ligne' }}
|
||||
</button>
|
|
@ -1,21 +0,0 @@
|
|||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
Filtres
|
||||
</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ path('admin_blog_comment_index') }}" id="form-filters" method="GET">
|
||||
{{ form_widget(form) }}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="{{ path('admin_blog_comment_index', {post_filter: 0}) }}" class="btn btn-secondary">{{ 'Vider'|trans }}</a>
|
||||
<button type="submit" form="form-filters" class="btn btn-primary">{{ 'Filter'|trans }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,93 +0,0 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ 'Commentaires'|trans }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5">
|
||||
<div class="crud-header">
|
||||
<h1 class="crud-header-title">{{ 'Commentaires'|trans }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="row pb-3">
|
||||
<div class="col-auto ml-auto {% if pager.getPaginationData.pageCount > 1 %}mr-3{% endif %}">
|
||||
<button data-modal="{{ path('admin_blog_comment_filters') }}" class="btn btn-sm btn-secondary">
|
||||
Filtrer {% if hasFilters %}(oui){% endif %}
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
{{ knp_pagination_render(pager) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th class="col-6 miw-300">Auteur</th>
|
||||
<th class="col-2 miw-200">Date</th>
|
||||
<th class="col-1 miw-100">Statut</th>
|
||||
<th class="col-3 miw-100 text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in pager %}
|
||||
{% set edit = path('admin_blog_comment_edit', {entity: item.id}) %}
|
||||
{% set show = path('admin_blog_comment_show', {entity: item.id}) %}
|
||||
|
||||
<tr>
|
||||
<td class="col-6 miw-300">
|
||||
<a href="{{ show }}" class="font-weight-bold text-body d-block">
|
||||
{{ item.author }}
|
||||
</a>
|
||||
|
||||
Dans <a href="{{ path('admin_blog_post_show', {entity: item.post.id}) }}">{{ item.post.title }}</a>
|
||||
|
||||
{% if item.parentComment %}
|
||||
en réponse à
|
||||
<a href="{{ path('admin_blog_comment_show', {entity: item.parentComment.id}) }}">
|
||||
{{ item.parentComment }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="col-2 miw-200">
|
||||
<span class="btn btn-sm btn-light">
|
||||
<span class="fa fa-calendar-alt text-black-50 mr-1"></span>
|
||||
{{ item.updatedAt|date('d/m/Y H:i') }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="col-1 miw-100">
|
||||
<button class="btn btn-sm btn-{{ item.isActive ? 'success' : 'warning' }}">
|
||||
{{ item.isActive ? 'En ligne' : 'Hors ligne' }}
|
||||
</button>
|
||||
</td>
|
||||
<td class="col-3 miw-100 text-right">
|
||||
<a href="{{ edit }}" class="btn btn-sm btn-primary mr-1">
|
||||
<span class="fa fa-edit"></span>
|
||||
</a>
|
||||
<button type="submit" form="form-delete-{{ item.id }}" class="btn btn-sm btn-danger">
|
||||
<span class="fa fa-trash"></span>
|
||||
</button>
|
||||
|
||||
<form method="post" action="{{ path('admin_blog_comment_delete', {entity: item.id}) }}" id="form-delete-{{ item.id }}" data-form-confirm>
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ item.id) }}">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td class="col-12 text-center p-4 text-black-50">
|
||||
<div class="display-1">
|
||||
<span class="fa fa-search"></span>
|
||||
</div>
|
||||
<div class="display-5 mt-3">
|
||||
Aucun résultat
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,95 +0,0 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ 'Commentaires'|trans }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
|
||||
<div class="crud-header">
|
||||
<h1 class="crud-header-title">{{ entity.author }}</h1>
|
||||
|
||||
<div class="crud-header-actions">
|
||||
<div class="btn-group">
|
||||
<a href="{{ path('admin_blog_comment_index') }}" class="btn btn-secondary">
|
||||
<span class="fa fa-list pr-1"></span>
|
||||
|
||||
Retour à la liste
|
||||
</a>
|
||||
<a href="{{ path('admin_blog_comment_edit', {entity: entity.id}) }}" class="btn btn-primary">
|
||||
<span class="fa fa-edit pr-1"></span>
|
||||
|
||||
Éditer
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 p-3">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Auteur</span>
|
||||
|
||||
{{ entity.author }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Site web</span>
|
||||
|
||||
{{ entity.website }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">E-mail</span>
|
||||
|
||||
{{ entity.email }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Article</span>
|
||||
|
||||
<a href="{{ path('admin_blog_post_show', {entity: entity.post.id}) }}">
|
||||
{{ entity.post.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% if entity.parentComment %}
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">
|
||||
Réponse à
|
||||
<a href="{{ path('admin_blog_comment_show', {entity: entity.parentComment.id}) }}">
|
||||
{{ entity.parentComment.author }} - {{ entity.parentComment.createdAt|date('d/m/Y H:i') }}
|
||||
</a>
|
||||
</span>
|
||||
|
||||
{% if entity.parentComment.createdAt.timestamp > 1538118768 %} {# 28/09/2018 #}
|
||||
{{- entity.parentComment.content|markdown('comment') -}}
|
||||
{% else %}
|
||||
{{- entity.parentComment.content|comment -}}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Status</span>
|
||||
|
||||
{{ entity.isActive ? 'En ligne' : 'Hors ligne' }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-8 p-3">
|
||||
<div class="font-weight-bold pb-2">Contenu</div>
|
||||
|
||||
{% if entity.createdAt.timestamp > 1538118768 %} {# 28/09/2018 #}
|
||||
{{- entity.content|markdown('comment') -}}
|
||||
{% else %}
|
||||
{{- entity.content|comment -}}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
{{ parent() }}
|
||||
|
||||
<style>
|
||||
#post-content img {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
120
templates/blog/post_admin/_show.html.twig
Normal file
120
templates/blog/post_admin/_show.html.twig
Normal file
|
@ -0,0 +1,120 @@
|
|||
<div class="row">
|
||||
<div class="col-md-3 p-3">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Titre</span>
|
||||
|
||||
{{ entity.title }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Catégories</span>
|
||||
|
||||
{% for category in entity.categories %}
|
||||
<a class="d-block" href="{{ path('admin_blog_post_show', {entity: category.id}) }}">{{ category.title }}</a>
|
||||
{% endfor %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Tags</span>
|
||||
|
||||
{% for tag in entity.tags %}
|
||||
<span class="d-block">{{ tag.label }}</span>
|
||||
{% endfor %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Slug</span>
|
||||
|
||||
{{ entity.slug }}
|
||||
</li>
|
||||
</ul>
|
||||
{% if entity.isQuick %}
|
||||
<ul class="list-group mt-3">
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">QUICK</span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">URL</span>
|
||||
|
||||
<a href="{{ entity.quickUrl }}" target="_blank">
|
||||
{{ entity.quickUrl }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Image</span>
|
||||
|
||||
{% if entity.quickImage %}
|
||||
<a href="{{ entity.quickImage }}" target="_blank">
|
||||
<img src="{{ entity.quickImage }}" class="img-fluid">
|
||||
</a>
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Vidéo</span>
|
||||
|
||||
{% if entity.quickVideo %}
|
||||
<a href="{{ entity.quickVideo }}" target="_blank">
|
||||
{{ entity.quickVideo }}
|
||||
</a> ({{ [entity.quickVideoWidth, entity.quickVideoHeight]|join(' x ') }})
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-6 p-3" id="post-content">
|
||||
<div class="font-weight-bold pb-2">Contenu</div>
|
||||
|
||||
{% if entity.contentFormat == 'html' %}
|
||||
{{ entity.content|raw|nl2br }}
|
||||
{% else %}
|
||||
{{ entity.content|markdown('post') }}
|
||||
{% endif %}
|
||||
|
||||
{% if entity.notebook %}
|
||||
<hr>
|
||||
|
||||
<div class="font-weight-bold pb-2">Carnet de notes</div>
|
||||
|
||||
{{ entity.notebook|markdown('post') }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-3 p-3">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-3 d-block">Image</span>
|
||||
|
||||
{% if entity.image %}
|
||||
<figure>
|
||||
<img src="{{ asset(entity.image.pathname) }}" class="img-fluid">
|
||||
</figure>
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Statut</span>
|
||||
|
||||
{% if entity.status == 0 %}
|
||||
Brouillon
|
||||
{% else %}
|
||||
Publié
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Date de publication</span>
|
||||
|
||||
{{ entity.publishedAt ? entity.publishedAt|date('d/m/Y H:i') : '-' }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
#post-content img {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
7
templates/blog/post_admin/field/status.html.twig
Normal file
7
templates/blog/post_admin/field/status.html.twig
Normal file
|
@ -0,0 +1,7 @@
|
|||
{% set map = {
|
||||
0: ['warning', 'Brouillon'],
|
||||
1: ['success', 'Publié'],
|
||||
} %}
|
||||
<button class="btn btn-sm btn-{{ map[entity.status].0 }}">
|
||||
{{ map[entity.status].1 }}
|
||||
</button>
|
20
templates/blog/post_admin/field/title.html.twig
Normal file
20
templates/blog/post_admin/field/title.html.twig
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% if entity.image %}
|
||||
{% set image = asset(entity.image.pathname) %}
|
||||
{% else %}
|
||||
{% set image = asset('build/images/no-image.png') %}
|
||||
{% endif %}
|
||||
|
||||
<img src="{{ asset('build/images/blank.png') }}" style="background: url({{ image }}) center center; background-size: cover" class="rounded float-left mr-2">
|
||||
|
||||
<a href="{{ path('admin_blog_post_show', {entity: entity.id}) }}" class="font-weight-bold text-body d-block">
|
||||
{{ entity.title }}
|
||||
</a>
|
||||
|
||||
{% set categories = [] %}
|
||||
|
||||
{% for category in entity.categories %}
|
||||
{% set url = path('admin_blog_category_show', {entity: category.id}) %}
|
||||
{% set categories = categories|merge(['<a href="' ~ url ~ '">' ~ category.title ~ '</a>']) %}
|
||||
{% endfor %}
|
||||
|
||||
Dans {{ categories|join(', ')|raw }}
|
|
@ -1,114 +0,0 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5">
|
||||
<div class="crud-header">
|
||||
<h1 class="crud-header-title">Articles</h1>
|
||||
|
||||
<div class="crud-header-actions">
|
||||
<div class="btn-group">
|
||||
<a href="{{ path('admin_blog_post_new') }}" class="btn btn-primary">
|
||||
<span class="fa fa-plus pr-1"></span>
|
||||
Nouveau
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row pb-3">
|
||||
<div class="col-auto ml-auto {% if pager.getPaginationData.pageCount > 1 %}mr-3{% endif %}">
|
||||
<button data-modal="{{ path('admin_blog_post_filters') }}" class="btn btn-sm btn-secondary">
|
||||
Filtrer {% if hasFilters %}(oui){% endif %}
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
{{ knp_pagination_render(pager) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th class="col-6 miw-400">Titre</th>
|
||||
<th class="col-2 miw-200">Mise à jour</th>
|
||||
<th class="col-1 miw-100">Statut</th>
|
||||
<th class="col-3 miw-100 text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in pager %}
|
||||
{% set edit = path('admin_blog_post_edit', {entity: item.id}) %}
|
||||
{% set show = path('admin_blog_post_show', {entity: item.id}) %}
|
||||
|
||||
<tr>
|
||||
<td class="col-6 miw-400">
|
||||
{% if item.image %}
|
||||
{% set image = asset(item.image.pathname) %}
|
||||
{% else %}
|
||||
{% set image = asset('build/images/no-image.png') %}
|
||||
{% endif %}
|
||||
|
||||
<img src="{{ asset('build/images/blank.png') }}" style="background: url({{ image }}) center center; background-size: cover" class="rounded float-left mr-2">
|
||||
|
||||
<a href="{{ show }}" class="font-weight-bold text-body d-block">
|
||||
{{ item.title }}
|
||||
</a>
|
||||
|
||||
{% set categories = [] %}
|
||||
|
||||
{% for category in item.categories %}
|
||||
{% set url = path('admin_blog_category_show', {entity: category.id}) %}
|
||||
{% set categories = categories|merge(['<a href="' ~ url ~ '">' ~ category.title ~ '</a>']) %}
|
||||
{% endfor %}
|
||||
|
||||
Dans {{ categories|join(', ')|raw }}
|
||||
</td>
|
||||
<td class="col-2 miw-200">
|
||||
<span class="btn btn-sm btn-light">
|
||||
<span class="fa fa-calendar-alt text-black-50 mr-1"></span>
|
||||
{{ item.updatedAt|date('d/m/Y H:i') }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="col-1 miw-100">
|
||||
{% set map = {
|
||||
0: ['warning', 'Brouillon'],
|
||||
1: ['success', 'Publié'],
|
||||
} %}
|
||||
<button class="btn btn-sm btn-{{ map[item.status].0 }}">
|
||||
{{ map[item.status].1 }}
|
||||
</button>
|
||||
</td>
|
||||
<td class="col-3 miw-100 text-right">
|
||||
<a href="{{ edit }}" class="btn btn-sm btn-primary mr-1">
|
||||
<span class="fa fa-edit"></span>
|
||||
</a>
|
||||
<button type="submit" form="form-delete-{{ item.id }}" class="btn btn-sm btn-danger">
|
||||
<span class="fa fa-trash"></span>
|
||||
</button>
|
||||
|
||||
<form method="post" action="{{ path('admin_blog_post_delete', {entity: item.id}) }}" id="form-delete-{{ item.id }}" data-form-confirm>
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ item.id) }}">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td class="col-12 text-center p-4 text-black-50">
|
||||
<div class="display-1">
|
||||
<span class="fa fa-search"></span>
|
||||
</div>
|
||||
<div class="display-5 mt-3">
|
||||
Aucun résultat
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,41 +0,0 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
|
||||
<div class="crud-header">
|
||||
<h1 class="crud-header-title">Nouvel article</h1>
|
||||
|
||||
<div class="crud-header-actions">
|
||||
<div class="btn-group">
|
||||
<a href="{{ path('admin_blog_post_index') }}" class="btn btn-light">
|
||||
<span class="fa fa-list pr-1"></span>
|
||||
|
||||
Retour à la liste
|
||||
</a>
|
||||
|
||||
<button type="submit" form="form-main" class="btn btn-primary">
|
||||
<span class="fa fa-save pr-1"></span>
|
||||
|
||||
Enregistrer
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form action="{{ app.request.uri }}" method="post" id="form-main" enctype="multipart/form-data">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active">
|
||||
<div class="tab-form">
|
||||
{{ include('blog/post_admin/_form.html.twig') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-none">
|
||||
{{ form_rest(form) }}
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -1,150 +0,0 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ 'Articles'|trans }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
|
||||
<div class="crud-header">
|
||||
<h1 class="crud-header-title">{{ entity.title }}</h1>
|
||||
|
||||
<div class="crud-header-actions">
|
||||
<div class="btn-group">
|
||||
<a href="{{ path('admin_blog_post_index') }}" class="btn btn-secondary">
|
||||
<span class="fa fa-list pr-1"></span>
|
||||
|
||||
Retour à la liste
|
||||
</a>
|
||||
<a href="{{ path('admin_blog_post_edit', {entity: entity.id}) }}" class="btn btn-primary">
|
||||
<span class="fa fa-edit pr-1"></span>
|
||||
|
||||
Éditer
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3 p-3">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Titre</span>
|
||||
|
||||
{{ entity.title }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Catégories</span>
|
||||
|
||||
{% for category in entity.categories %}
|
||||
<a class="d-block" href="{{ path('admin_blog_post_show', {entity: category.id}) }}">{{ category.title }}</a>
|
||||
{% endfor %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Tags</span>
|
||||
|
||||
{% for tag in entity.tags %}
|
||||
<span class="d-block">{{ tag.label }}</span>
|
||||
{% endfor %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Slug</span>
|
||||
|
||||
{{ entity.slug }}
|
||||
</li>
|
||||
</ul>
|
||||
{% if entity.isQuick %}
|
||||
<ul class="list-group mt-3">
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">QUICK</span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">URL</span>
|
||||
|
||||
<a href="{{ entity.quickUrl }}" target="_blank">
|
||||
{{ entity.quickUrl }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Image</span>
|
||||
|
||||
{% if entity.quickImage %}
|
||||
<a href="{{ entity.quickImage }}" target="_blank">
|
||||
<img src="{{ entity.quickImage }}" class="img-fluid">
|
||||
</a>
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Vidéo</span>
|
||||
|
||||
{% if entity.quickVideo %}
|
||||
<a href="{{ entity.quickVideo }}" target="_blank">
|
||||
{{ entity.quickVideo }}
|
||||
</a> ({{ [entity.quickVideoWidth, entity.quickVideoHeight]|join(' x ') }})
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-6 p-3" id="post-content">
|
||||
<div class="font-weight-bold pb-2">Contenu</div>
|
||||
|
||||
{% if entity.contentFormat == 'html' %}
|
||||
{{ entity.content|raw|nl2br }}
|
||||
{% else %}
|
||||
{{ entity.content|markdown('post') }}
|
||||
{% endif %}
|
||||
|
||||
{% if entity.notebook %}
|
||||
<hr>
|
||||
|
||||
<div class="font-weight-bold pb-2">Carnet de notes</div>
|
||||
|
||||
{{ entity.notebook|markdown('post') }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-3 p-3">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-3 d-block">Image</span>
|
||||
|
||||
{% if entity.image %}
|
||||
<figure>
|
||||
<img src="{{ asset(entity.image.pathname) }}" class="img-fluid">
|
||||
</figure>
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Statut</span>
|
||||
|
||||
{% if entity.status == 0 %}
|
||||
Brouillon
|
||||
{% else %}
|
||||
Publié
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<span class="font-weight-bold pb-2 d-block">Date de publication</span>
|
||||
|
||||
{{ entity.publishedAt ? entity.publishedAt|date('d/m/Y H:i') : '-' }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
{{ parent() }}
|
||||
|
||||
<style>
|
||||
#post-content img {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
Loading…
Reference in a new issue