From 6642edb3e90941f42c662f57e5942e1c774c611c Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Tue, 11 Nov 2014 16:56:20 +0100 Subject: [PATCH] Improving navigation --- Controller/DefaultController.php | 18 +------ Resources/config/routing.yml | 14 +++--- Resources/views/Default/index.html.twig | 1 - Resources/views/layout.html.twig | 66 +++++++++++++------------ 4 files changed, 43 insertions(+), 56 deletions(-) delete mode 100644 Resources/views/Default/index.html.twig diff --git a/Controller/DefaultController.php b/Controller/DefaultController.php index bd9deaa42..726a0a4e1 100644 --- a/Controller/DefaultController.php +++ b/Controller/DefaultController.php @@ -7,23 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { public function indexAction() - { - $a = array( - array('success', "Message de succès (success)! "), - array('success',"Un autre message de succès ! "), - array('danger' , "(danger)Avert lorem ipsum dolor sit amet spiritur"), - array('danger' ,"Avertum ipsut est amet amergitur tatouari"), - array('info' , "(info) Un message d'information s'affiche."), - array('info' , "Info informitur escept asolitur amet. Sit Roberetur astot.") - ); - - if ($this->getRequest()->query->get('addMessages', 1)) { - foreach ($a as $array) { - $this->get('session')->getFlashBag()->add($array[0], $array[1]); - } - } - - + { return $this->render('ChillMainBundle::layout.html.twig'); } } diff --git a/Resources/config/routing.yml b/Resources/config/routing.yml index 3ced09503..c280ee308 100644 --- a/Resources/config/routing.yml +++ b/Resources/config/routing.yml @@ -2,18 +2,18 @@ root: pattern: / defaults: _controller: FrameworkBundle:Redirect:urlRedirect - path: /hello + path: /welcome permanent: true options: menus: main: order: 10 - label: homepage + label: Homepage cl_chill_main_homepage: - pattern: /hello + pattern: /welcome defaults: { _controller: ChillMainBundle:Default:index } - + chill_main_admin_central: pattern: /admin defaults: { _controller: ChillMainBundle:Admin:index } @@ -21,14 +21,14 @@ chill_main_admin_central: menus: main: order: 20 - label: homepage + label: Admin Menu login: path: /login defaults: { _controller: ChillMainBundle:Login:login } - + login_check: path: /login_check - + logout: path: /logout diff --git a/Resources/views/Default/index.html.twig b/Resources/views/Default/index.html.twig deleted file mode 100644 index 4ce626e9b..000000000 --- a/Resources/views/Default/index.html.twig +++ /dev/null @@ -1 +0,0 @@ -Hello {{ name }}! diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig index 4031e881a..bb318ca6f 100644 --- a/Resources/views/layout.html.twig +++ b/Resources/views/layout.html.twig @@ -65,41 +65,45 @@ - {# Flash messages ! #}
- {% for flashMessage in app.session.flashbag.get('success') %} -
- - {{ flashMessage|raw }} - + {% block layout_content %} + {# Flash messages ! #} +
+ {% for flashMessage in app.session.flashbag.get('success') %} +
+ + {{ flashMessage|raw }} + +
+ {% endfor %} + + {% for flashMessage in app.session.flashbag.get('danger') %} +
+ + {{ flashMessage|raw }} + +
+ {% endfor %} + + {% for flashMessage in app.session.flashbag.get('info') %} +
+ + {{ flashMessage|raw }} + +
+ {% endfor %}
- {% endfor %} - - {% for flashMessage in app.session.flashbag.get('danger') %} -
- - {{ flashMessage|raw }} - -
- {% endfor %} - - {% for flashMessage in app.session.flashbag.get('info') %} -
- - {{ flashMessage|raw }} - -
- {% endfor %} -
- -
- {% block content %} -

Title

-

Hello !

-
- Primary + {{ chill_menu('main', { + 'layout': 'ChillPersonBundle::menu.html.twig', + }) }} + + {% block content %} +
+

Welcome to Chill

+ {% endblock %} + {% endblock %}