diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 953aa55..baa37f9 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -13,8 +13,6 @@ class AdminController extends AbstractController */ public function index(): Response { - return $this->render('admin/index.html.twig', [ - 'controller_name' => 'AdminController', - ]); + return $this->render('admin/index.html.twig'); } } diff --git a/src/Controller/CategoryController.php b/src/Controller/CategoryController.php index 0d805cc..7c2d2ac 100644 --- a/src/Controller/CategoryController.php +++ b/src/Controller/CategoryController.php @@ -17,7 +17,6 @@ class CategoryController extends AbstractController public function index(): Response { return $this->render('category/categories.html.twig', [ - 'controller_name' => 'CategoryController', 'categories' => $this->getDoctrine()->getRepository(Category::class)->findAll() ]); } @@ -40,7 +39,6 @@ class CategoryController extends AbstractController return $this->redirectToRoute('categories'); } return $this->render('category/categories-form.html.twig', [ - 'controller_name' => 'CategoryController', 'form' => $form->createView(), 'title' => 'Add new category' ]); @@ -67,7 +65,6 @@ class CategoryController extends AbstractController return $this->redirectToRoute('categories'); } return $this->render('category/categories-form.html.twig', [ - 'controller_name' => 'CategoryController', 'form' => $form->createView(), 'title' => 'Edit '.$cat->getName() ]); @@ -93,7 +90,6 @@ class CategoryController extends AbstractController public function categorySummary(): Response { return $this->render('category/category_summary.html.twig', [ - 'controller_name' => 'CategoryController', 'Categories' => array_filter($this->getDoctrine()->getRepository(Category::class)->findAll(), static function ($c) {return count($c->getPosts())>=1;}) ]); } diff --git a/src/Controller/CommentController.php b/src/Controller/CommentController.php index 298130e..fdec3b4 100644 --- a/src/Controller/CommentController.php +++ b/src/Controller/CommentController.php @@ -15,7 +15,6 @@ class CommentController extends AbstractController public function index(): Response { return $this->render('comment/comments.html.twig', [ - 'controller_name' => 'CommentController', 'comments' => $this->getDoctrine()->getRepository(Comment::class)->findAll() ]); } @@ -57,7 +56,6 @@ class CommentController extends AbstractController public function recentComment(): Response { return $this->render('comment/recent_comment.html.twig', [ - 'controller_name' => 'CommentController', 'comments' => $this->getDoctrine()->getRepository(Comment::class)->findBy(array('valid' => true), array('createdAt' => 'DESC'), 5, 0) ]); } diff --git a/src/Controller/PostController.php b/src/Controller/PostController.php index 34ea4e2..ea18891 100644 --- a/src/Controller/PostController.php +++ b/src/Controller/PostController.php @@ -2,7 +2,6 @@ namespace App\Controller; -use App\Entity\Category; use App\Entity\Comment; use App\Entity\Post; use App\Form\CommentType; @@ -25,7 +24,6 @@ class PostController extends AbstractController { $repo = $this->getDoctrine()->getRepository(Post::class); return $this->render('home/index.html.twig', [ - 'controller_name' => 'HomeController', 'posts' => $repo->getPublished($page*5, 5), 'pages' => round(count($repo->getPublished())/5, 0, PHP_ROUND_HALF_UP)-1, 'page' => $page @@ -52,7 +50,6 @@ class PostController extends AbstractController $form = $this->commentFormGenerator($post); } return $this->render('post/index.html.twig', [ - 'controller_name' => 'PostController', 'post' => $post, 'form' => $form->createView() ]); @@ -64,7 +61,6 @@ class PostController extends AbstractController public function posts(): Response { return $this->render('post/posts.html.twig', [ - 'controller_name' => 'PostController', 'posts' => $this->getDoctrine()->getRepository(Post::class)->findBy(array(), array('publishedAt' => 'DESC')) ]); } @@ -88,7 +84,6 @@ class PostController extends AbstractController return $this->redirectToRoute('posts'); } return $this->render('post/posts-form.html.twig', [ - 'controller_name' => 'PostController', 'form' => $form->createView(), 'title' => 'Add new post' ]); @@ -117,7 +112,6 @@ class PostController extends AbstractController return $this->redirectToRoute('posts'); } return $this->render('post/posts-form.html.twig', [ - 'controller_name' => 'PostController', 'form' => $form->createView(), 'title' => 'Edit '.$post->getTitle() ]); diff --git a/templates/admin/base-admin.html.twig b/templates/admin/base-admin.html.twig index 64c4a81..0447e88 100644 --- a/templates/admin/base-admin.html.twig +++ b/templates/admin/base-admin.html.twig @@ -2,7 +2,7 @@ - {% block title %}Welcome!{% endblock %} + {% block title %}Administration{% endblock %} {% block stylesheets %} {{ encore_entry_link_tags('app') }} {% endblock %} diff --git a/templates/admin/index.html.twig b/templates/admin/index.html.twig index 769c702..dbfaf71 100644 --- a/templates/admin/index.html.twig +++ b/templates/admin/index.html.twig @@ -1,6 +1,6 @@ {% extends 'admin/base-admin.html.twig' %} -{% block title %}Hello AdminController!{% endblock %} +{% block title %}Administration - Panel{% endblock %} {% block body %}

Admin panel

diff --git a/templates/base.html.twig b/templates/base.html.twig index 0e0c665..5b97664 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -2,7 +2,7 @@ - {% block title %}Welcome!{% endblock %} + {% block title %}Blog{% endblock %} {% block stylesheets %} {{ encore_entry_link_tags('app') }} {% endblock %} diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index cbf0855..906ff17 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -1,6 +1,6 @@ {% extends 'base.html.twig' %} -{% block title %}Hello HomeController!{% endblock %} +{% block title %}Home - Posts{% endblock %} {% block body %}

Last 5 posts

diff --git a/templates/post/index.html.twig b/templates/post/index.html.twig index aba3793..e28f27a 100644 --- a/templates/post/index.html.twig +++ b/templates/post/index.html.twig @@ -1,6 +1,6 @@ {% extends 'base.html.twig' %} -{% block title %}Hello PostController!{% endblock %} +{% block title %}Post - {{ post.title }}{% endblock %} {% block body %}