send rendering of menu to devoted controller

This commit is contained in:
2013-11-06 17:46:10 +01:00
parent 3baf7acfb5
commit b89c5e3de4
5 changed files with 13 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
{% extends "CLChillPersonBundle::layout.html.twig" %}
{% extends "CLChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = 'chill_person_view' %}
{#

View File

@@ -32,9 +32,13 @@
<section class="tabs vertical">
{{ 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
})) }}
<div class="tab-content active columns height">

View File

@@ -1,12 +1,12 @@
<div class="columns four">
<ul class="tab-nav follow-href-path">
{% for menu in menu_composer.getRoutesFor('person') %}
{% for menu in menu_composer.getRoutesFor(menu) %}
<li class="{% spaceless %}
{% if menu.route == route_active %}
{% if menu.route == activeRouteKey %}
active
{% endif %}
{% endspaceless %} ">
<a href="{{ path(menu.route, {'id': person.id}) }}" >{{ menu.label|trans }}</a>
<a href="{{ path(menu.route, args) }}" >{{ menu.label|trans }}</a>
</li>
{% endfor %}