Menu control

1

I have a menu in a bundle and I want to add to that menu a part that is in another menu, but I want these menus to appear both on all pages.

The main menu is this:

{# src/RoqSys/BaseBundle/Resources/views/Default/base.html.twig #}
{% extends '::base.html.twig' %}
<div class="row">
    <div class="col-md-2 column">
        {% block menu %}
            <div class="panel-group" id="accordion">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            Início
                        </h4>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#accordionTwo">Configuração</a>
                        </h4>
                    </div>
                    <div id="accordionTwo" class="panel-collapse collapse">
                        <div class="panel-body">
                            <ul>
                                <li><a href="{{ path('gestaoutilizadores') }}">Utilizadores</a></li>
                                <li><a href="{{ path('gestaoparque') }}">Postos</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#accordionThree">Encomendas</a>
                        </h4>
                    </div>
                    <div id="accordionThree" class="panel-collapse collapse">
                        <div class="panel-body">
                            <ul>
                                <li><a href="{{ path('registonova') }}">Registo de nova</a></li>
                                <li><a href="{{ path('encomendasabertas') }}">Encomendas em produção</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#accordionFour">Produção</a>
                        </h4>
                    </div>
                    <div id="accordionFour" class="panel-collapse collapse">
                        <div class="panel-body">
                            <ul> 
                                <li><a href="{{ path('parqueinstalado') }}">Postos</a></li>
                                <li>Workflow
                                    <ul>
                                        <li><a href="{{ path('registolote') }}">Nova Ordem de Fabrico</a></li>
                                        <li><a href="{{ path('resistooperacao') }}">Registo de Operação</a></li>
                                    </ul>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        {% endblock %}
    </div>
    <div class="col-md-10 column">
    {% block content %}{% endblock %}
</div>

And the other part of the menu is:

{# src/RoqSys/ManutencoaBundle/Resources/views/Default/index.html.twig #}
{% extends 'RoqSysBaseBundle:Default:base.html.twig' %}

{% block menu %}
{{ parent() }}
<div class="panel-group" id="accordiontwo">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title">Vista</h4>
        </div>
        <div class="panel-heading">
            <h4 class="panel-title">
                <a data-toggle="collapse" data-parent="#accordiontwo" href="#accordionSix">Intervenção</a>
            </h4>
        </div>
        <div id="accordionSix" class="panel-collapse collapse">
            <div class="panel-body">
                <ul>
                    <li><a href="{{ path('manutencao_intervencao') }}">Lista das Intervenções</a></li>
                    <li><a href="{{ path('manutencao_intervencao_new') }}">Nova Intervenção</a></li>
                </ul>
            </div>
        </div>
        <div class="panel-heading">
            <h4 class="panel-title">
                <a data-toggle="collapse" data-parent="#accordiontwo" href="#accordionSeven">Previsões</a>
            </h4>
        </div>
        <div id="accordionSeven" class="panel-collapse collapse">
            <div class="panel-body">
                <ul>
                    <li><a href="{{ path('manutencao_prevista') }}">Lista das Previsões</a></li>
                    <li><a href="{{ path('manutencao_prevista_new') }}">Nova Previsão</a></li>
                </ul>
            </div>
        </div>
                <div class="panel-heading">
            <h4 class="panel-title">
                <a data-toggle="collapse" data-parent="#accordiontwo" href="#accordionEight">Avarias</a>
            </h4>
        </div>
        <div id="accordionEight" class="panel-collapse collapse">
            <div class="panel-body">
                <ul>
                    <li><a href="{{ path('manutencao_avaria') }}">Lista das Avarias</a></li>
                    <li><a href="{{ path('manutencao_avaria_new') }}">Avaria</a></li>
                </ul>
            </div>
        </div>
        <div class="panel-heading">
            <h4 class="panel-title">Consulta</h4>
        </div>
    </div>
</div>
<div class="col-md-10 column">
    {% block content %}{% endblock %}
</div>
{% endblock %}

Only the second part of the menu only looks like when I put the address bar maintenance, and I wanted it to always appear.

I want you to stay like this

Butitappearslikethis

    
asked by anonymous 13.02.2015 / 13:00

1 answer

0

If the file index.html.twig extends the file base.html.twig , just put the block you want in the parent block.

base.html.twig :

{# src/RoqSys/BaseBundle/Resources/views/Default/base.html.twig #}
{% extends '::base.html.twig' %}
<div class="row">
    <div class="col-md-2 column">
        {% block menu %}
            <div class="panel-group" id="accordion">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            Início
                        </h4>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#accordionTwo">Configuração</a>
                        </h4>
                    </div>
                    <div id="accordionTwo" class="panel-collapse collapse">
                        <div class="panel-body">
                            <ul>
                                <li><a href="{{ path('gestaoutilizadores') }}">Utilizadores</a></li>
                                <li><a href="{{ path('gestaoparque') }}">Postos</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#accordionThree">Encomendas</a>
                        </h4>
                    </div>
                    <div id="accordionThree" class="panel-collapse collapse">
                        <div class="panel-body">
                            <ul>
                                <li><a href="{{ path('registonova') }}">Registo de nova</a></li>
                                <li><a href="{{ path('encomendasabertas') }}">Encomendas em produção</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#accordionFour">Produção</a>
                        </h4>
                    </div>
                    <div id="accordionFour" class="panel-collapse collapse">
                        <div class="panel-body">
                            <ul> 
                                <li><a href="{{ path('parqueinstalado') }}">Postos</a></li>
                                <li>Workflow
                                    <ul>
                                        <li><a href="{{ path('registolote') }}">Nova Ordem de Fabrico</a></li>
                                        <li><a href="{{ path('resistooperacao') }}">Registo de Operação</a></li>
                                    </ul>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel-group" id="accordiontwo">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">Vista</h4>
                    </div>
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordiontwo" href="#accordionSix">Intervenção</a>
                        </h4>
                    </div>
                    <div id="accordionSix" class="panel-collapse collapse">
                        <div class="panel-body">
                            <ul>
                                <li><a href="{{ path('manutencao_intervencao') }}">Lista das Intervenções</a></li>
                                <li><a href="{{ path('manutencao_intervencao_new') }}">Nova Intervenção</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordiontwo" href="#accordionSeven">Previsões</a>
                        </h4>
                    </div>
                    <div id="accordionSeven" class="panel-collapse collapse">
                        <div class="panel-body">
                            <ul>
                                <li><a href="{{ path('manutencao_prevista') }}">Lista das Previsões</a></li>
                                <li><a href="{{ path('manutencao_prevista_new') }}">Nova Previsão</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordiontwo" href="#accordionEight">Avarias</a>
                        </h4>
                    </div>
                    <div id="accordionEight" class="panel-collapse collapse">
                        <div class="panel-body">
                            <ul>
                                <li><a href="{{ path('manutencao_avaria') }}">Lista das Avarias</a></li>
                                <li><a href="{{ path('manutencao_avaria_new') }}">Avaria</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="panel-heading">
                        <h4 class="panel-title">Consulta</h4>
                    </div>
                </div>
            </div>
        {% endblock %}
    </div>
    <div class="col-md-10 column">
        {% block content %}{% endblock %}
    </div>
</div>

index.html.twig :

{# src/RoqSys/ManutencoaBundle/Resources/views/Default/index.html.twig #}
{% extends 'RoqSysBaseBundle:Default:base.html.twig' %}

{% block content %}{% endblock %}
    
13.02.2015 / 13:07