Fix title and remove unused controller_name
This commit is contained in:
parent
e399f79d29
commit
e63473e5c7
9 changed files with 6 additions and 20 deletions
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
]);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
<title>{% block title %}Administration{% endblock %}</title>
|
||||
{% block stylesheets %}
|
||||
{{ encore_entry_link_tags('app') }}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends 'admin/base-admin.html.twig' %}
|
||||
|
||||
{% block title %}Hello AdminController!{% endblock %}
|
||||
{% block title %}Administration - Panel{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="text-center">Admin panel</h1>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
<title>{% block title %}Blog{% endblock %}</title>
|
||||
{% block stylesheets %}
|
||||
{{ encore_entry_link_tags('app') }}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Hello HomeController!{% endblock %}
|
||||
{% block title %}Home - Posts{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="text-center">Last 5 posts</h1>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Hello PostController!{% endblock %}
|
||||
{% block title %}Post - {{ post.title }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container justify-content-center">
|
||||
|
|
Reference in a new issue