فهرست منبع

Merge pull request #2143 from patrickli/expand-active-menu

Expand the group that contains the active menu item
Thomas 11 سال پیش
والد
کامیت
0f9465b573
1فایلهای تغییر یافته به همراه7 افزوده شده و 7 حذف شده
  1. 7 7
      Resources/views/standard_layout.html.twig

+ 7 - 7
Resources/views/standard_layout.html.twig

@@ -193,18 +193,18 @@ file that was distributed with this source code.
                                                 {% endif %}
                                                 {% endif %}
 
 
                                                 {% if display and (item_count > 0) %}
                                                 {% if display and (item_count > 0) %}
-                                                    <li class="treeview">
+                                                    {% set active = false %}
+                                                    {% for admin in group.items %}
+                                                        {% if admin.hasroute('list') and admin.isGranted('LIST') and app.request.get('_sonata_admin') == admin.code %}
+                                                            {% set active = true %}
+                                                        {% endif %}
+                                                    {% endfor %}
+                                                    <li class="treeview{% if active %} active{% endif %}">
                                                         <a href="#">
                                                         <a href="#">
                                                             {% if group.icon|default() %}{{ group.icon|raw }}{% endif %}
                                                             {% if group.icon|default() %}{{ group.icon|raw }}{% endif %}
                                                             <span>{{ group.label|trans({}, group.label_catalogue) }}</span>
                                                             <span>{{ group.label|trans({}, group.label_catalogue) }}</span>
                                                             <i class="fa pull-right fa-angle-left"></i>
                                                             <i class="fa pull-right fa-angle-left"></i>
                                                         </a>
                                                         </a>
-                                                        {% set active = false %}
-                                                        {% for admin in group.items %}
-                                                            {% if admin.hasroute('list') and admin.isGranted('LIST') and app.request.get('_sonata_admin') == admin.code %}
-                                                                {% set active = true %}
-                                                            {% endif %}
-                                                        {% endfor %}
                                                         <ul class="treeview-menu{% if active %} active{% endif %}">
                                                         <ul class="treeview-menu{% if active %} active{% endif %}">
                                                             {% for admin in group.items %}
                                                             {% for admin in group.items %}
                                                                 {% if admin.hasroute('list') and admin.isGranted('LIST') %}
                                                                 {% if admin.hasroute('list') and admin.isGranted('LIST') %}