gurayyarar / AdminBSBMaterialDesign

AdminBSB - Free admin panel that is based on Bootstrap 3.x with Material Design
https://gurayyarar.github.io/AdminBSBMaterialDesign
MIT License
2.74k stars 1.56k forks source link

Can't active menu #178

Open Jasonzhangjs opened 4 years ago

Jasonzhangjs commented 4 years ago

firstse

When the page reloads, the label(li class="active") has been cleared

th
glavrjk commented 4 years ago

try to take a look your backend code i think you have a error or your have 2 or more li active declarations. I use the route page for taking the item correct. like this in Symfony 4

<li {{ (app.request.get('_route')[:10]=='dashboard_' ) ? 'class="active"' : '' }}>
            <a href="javascript:void(0);" class="menu-toggle">
                <i class="material-icons">dashboard</i>
                <span>Dashboards</span>
            </a>
            <ul class="ml-menu">
                <li {{ (app.request.get('_route')=='dashboard_sales' ) ? 'class="active"' : '' }}>
                    <a href="{{ path('dashboard_sales') }}">Ventas</a>
                </li>
                <li {{ (app.request.get('_route')=='dashboard_purchases' ) ? 'class="active"' : '' }}>
                    <a href="{{ path('dashboard_purchases') }}">Compras</a>
                </li> 
            </ul>
        </li>