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
|
public function index(): Response
|
||||||
{
|
{
|
||||||
return $this->render('admin/index.html.twig', [
|
return $this->render('admin/index.html.twig');
|
||||||
'controller_name' => 'AdminController',
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ class CategoryController extends AbstractController
|
||||||
public function index(): Response
|
public function index(): Response
|
||||||
{
|
{
|
||||||
return $this->render('category/categories.html.twig', [
|
return $this->render('category/categories.html.twig', [
|
||||||
'controller_name' => 'CategoryController',
|
|
||||||
'categories' => $this->getDoctrine()->getRepository(Category::class)->findAll()
|
'categories' => $this->getDoctrine()->getRepository(Category::class)->findAll()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +39,6 @@ class CategoryController extends AbstractController
|
||||||
return $this->redirectToRoute('categories');
|
return $this->redirectToRoute('categories');
|
||||||
}
|
}
|
||||||
return $this->render('category/categories-form.html.twig', [
|
return $this->render('category/categories-form.html.twig', [
|
||||||
'controller_name' => 'CategoryController',
|
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'title' => 'Add new category'
|
'title' => 'Add new category'
|
||||||
]);
|
]);
|
||||||
|
@ -67,7 +65,6 @@ class CategoryController extends AbstractController
|
||||||
return $this->redirectToRoute('categories');
|
return $this->redirectToRoute('categories');
|
||||||
}
|
}
|
||||||
return $this->render('category/categories-form.html.twig', [
|
return $this->render('category/categories-form.html.twig', [
|
||||||
'controller_name' => 'CategoryController',
|
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'title' => 'Edit '.$cat->getName()
|
'title' => 'Edit '.$cat->getName()
|
||||||
]);
|
]);
|
||||||
|
@ -93,7 +90,6 @@ class CategoryController extends AbstractController
|
||||||
public function categorySummary(): Response
|
public function categorySummary(): Response
|
||||||
{
|
{
|
||||||
return $this->render('category/category_summary.html.twig', [
|
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;})
|
'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
|
public function index(): Response
|
||||||
{
|
{
|
||||||
return $this->render('comment/comments.html.twig', [
|
return $this->render('comment/comments.html.twig', [
|
||||||
'controller_name' => 'CommentController',
|
|
||||||
'comments' => $this->getDoctrine()->getRepository(Comment::class)->findAll()
|
'comments' => $this->getDoctrine()->getRepository(Comment::class)->findAll()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +56,6 @@ class CommentController extends AbstractController
|
||||||
public function recentComment(): Response
|
public function recentComment(): Response
|
||||||
{
|
{
|
||||||
return $this->render('comment/recent_comment.html.twig', [
|
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)
|
'comments' => $this->getDoctrine()->getRepository(Comment::class)->findBy(array('valid' => true), array('createdAt' => 'DESC'), 5, 0)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\Entity\Category;
|
|
||||||
use App\Entity\Comment;
|
use App\Entity\Comment;
|
||||||
use App\Entity\Post;
|
use App\Entity\Post;
|
||||||
use App\Form\CommentType;
|
use App\Form\CommentType;
|
||||||
|
@ -25,7 +24,6 @@ class PostController extends AbstractController
|
||||||
{
|
{
|
||||||
$repo = $this->getDoctrine()->getRepository(Post::class);
|
$repo = $this->getDoctrine()->getRepository(Post::class);
|
||||||
return $this->render('home/index.html.twig', [
|
return $this->render('home/index.html.twig', [
|
||||||
'controller_name' => 'HomeController',
|
|
||||||
'posts' => $repo->getPublished($page*5, 5),
|
'posts' => $repo->getPublished($page*5, 5),
|
||||||
'pages' => round(count($repo->getPublished())/5, 0, PHP_ROUND_HALF_UP)-1,
|
'pages' => round(count($repo->getPublished())/5, 0, PHP_ROUND_HALF_UP)-1,
|
||||||
'page' => $page
|
'page' => $page
|
||||||
|
@ -52,7 +50,6 @@ class PostController extends AbstractController
|
||||||
$form = $this->commentFormGenerator($post);
|
$form = $this->commentFormGenerator($post);
|
||||||
}
|
}
|
||||||
return $this->render('post/index.html.twig', [
|
return $this->render('post/index.html.twig', [
|
||||||
'controller_name' => 'PostController',
|
|
||||||
'post' => $post,
|
'post' => $post,
|
||||||
'form' => $form->createView()
|
'form' => $form->createView()
|
||||||
]);
|
]);
|
||||||
|
@ -64,7 +61,6 @@ class PostController extends AbstractController
|
||||||
public function posts(): Response
|
public function posts(): Response
|
||||||
{
|
{
|
||||||
return $this->render('post/posts.html.twig', [
|
return $this->render('post/posts.html.twig', [
|
||||||
'controller_name' => 'PostController',
|
|
||||||
'posts' => $this->getDoctrine()->getRepository(Post::class)->findBy(array(), array('publishedAt' => 'DESC'))
|
'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->redirectToRoute('posts');
|
||||||
}
|
}
|
||||||
return $this->render('post/posts-form.html.twig', [
|
return $this->render('post/posts-form.html.twig', [
|
||||||
'controller_name' => 'PostController',
|
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'title' => 'Add new post'
|
'title' => 'Add new post'
|
||||||
]);
|
]);
|
||||||
|
@ -117,7 +112,6 @@ class PostController extends AbstractController
|
||||||
return $this->redirectToRoute('posts');
|
return $this->redirectToRoute('posts');
|
||||||
}
|
}
|
||||||
return $this->render('post/posts-form.html.twig', [
|
return $this->render('post/posts-form.html.twig', [
|
||||||
'controller_name' => 'PostController',
|
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'title' => 'Edit '.$post->getTitle()
|
'title' => 'Edit '.$post->getTitle()
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
<title>{% block title %}Administration{% endblock %}</title>
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
{{ encore_entry_link_tags('app') }}
|
{{ encore_entry_link_tags('app') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends 'admin/base-admin.html.twig' %}
|
{% extends 'admin/base-admin.html.twig' %}
|
||||||
|
|
||||||
{% block title %}Hello AdminController!{% endblock %}
|
{% block title %}Administration - Panel{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1 class="text-center">Admin panel</h1>
|
<h1 class="text-center">Admin panel</h1>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
<title>{% block title %}Blog{% endblock %}</title>
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
{{ encore_entry_link_tags('app') }}
|
{{ encore_entry_link_tags('app') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block title %}Hello HomeController!{% endblock %}
|
{% block title %}Home - Posts{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1 class="text-center">Last 5 posts</h1>
|
<h1 class="text-center">Last 5 posts</h1>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block title %}Hello PostController!{% endblock %}
|
{% block title %}Post - {{ post.title }}{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container justify-content-center">
|
<div class="container justify-content-center">
|
||||||
|
|
Reference in a new issue