From b89c5e3de409e29aeec395b7aa4874ccca2ac34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 6 Nov 2013 17:46:10 +0100 Subject: [PATCH] send rendering of menu to devoted controller --- Controller/DefaultController.php | 13 ------------- Controller/PersonController.php | 2 +- Resources/views/Person/view.html.twig | 3 ++- Resources/views/layout.html.twig | 10 +++++++--- Resources/views/menu.html.twig | 6 +++--- 5 files changed, 13 insertions(+), 21 deletions(-) delete mode 100644 Controller/DefaultController.php diff --git a/Controller/DefaultController.php b/Controller/DefaultController.php deleted file mode 100644 index 223b9c98e..000000000 --- a/Controller/DefaultController.php +++ /dev/null @@ -1,13 +0,0 @@ -render('CLChillPersonBundle:Default:index.html.twig', array('name' => $name)); - } -} diff --git a/Controller/PersonController.php b/Controller/PersonController.php index 719bd56d5..2e12dbca2 100644 --- a/Controller/PersonController.php +++ b/Controller/PersonController.php @@ -16,7 +16,7 @@ class PersonController extends Controller { } return $this->render('CLChillPersonBundle:Person:view.html.twig', - array("person" => $person, 'menu_composer' => $this->get('menu_composer')) + array("person" => $person) ); } diff --git a/Resources/views/Person/view.html.twig b/Resources/views/Person/view.html.twig index 109ff6cb5..6264628df 100644 --- a/Resources/views/Person/view.html.twig +++ b/Resources/views/Person/view.html.twig @@ -1,5 +1,6 @@ -{% extends "CLChillPersonBundle::layout.html.twig" %} +{% extends "CLChillPersonBundle::layout.html.twig" %} +{% set activeRouteKey = 'chill_person_view' %} {# diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig index bc10bbbdf..6a10d99ff 100644 --- a/Resources/views/layout.html.twig +++ b/Resources/views/layout.html.twig @@ -32,9 +32,13 @@
- - {{ include("CLChillPersonBundle::menu.html.twig", - {'person': person, 'menu_composer' : menu_composer, 'route_active': 'chill_person_view' }) }} + {# Note: activeRouteKey should be defined in Controller or child layout #} + {{ render(controller("CLChillMainBundle:Menu:writeMenu", { + 'menu' : 'person', + 'layout': 'CLChillPersonBundle::menu.html.twig', + 'args' : {'id': person.id }, + 'activeRouteKey': activeRouteKey + })) }}
diff --git a/Resources/views/menu.html.twig b/Resources/views/menu.html.twig index 30c871f67..76f93dc58 100644 --- a/Resources/views/menu.html.twig +++ b/Resources/views/menu.html.twig @@ -1,12 +1,12 @@