Browse Source

Merge pull request #1935 from jbinfo/master

Set menu to active in nav && Hide the filter section if is empty in ajax template
Thomas 11 years ago
parent
commit
d467766c43

+ 8 - 7
Resources/views/ajax_layout.html.twig

@@ -10,8 +10,8 @@ file that was distributed with this source code.
 #}
 
 {% block content %}
-    {% set _list_table   = block('list_table') %}
-    {% set _list_filters = block('list_filters') %}
+    {% set _list_table   = block('list_table')|trim %}
+    {% set _list_filters = block('list_filters')|trim %}
 
     {% block preview %}{% endblock %}
     {% block form %}{% endblock %}
@@ -20,13 +20,14 @@ file that was distributed with this source code.
 
     {% if _list_table|length > 0 or _list_filters|length > 0 %}
         <div class="row-fluid">
-            <div class="sonata-ba-list span10">
+            <div class="sonata-ba-list {% if _list_filters %}span10{% else %}span12{% endif %}">
                 {{ _list_table|raw }}
             </div>
-
-            <div class="sonata-ba-filter span2">
-                {{ _list_filters|raw }}
-            </div>
+            {% if _list_filters %}
+                <div class="sonata-ba-filter span2">
+                    {{ _list_filters|raw }}
+                </div>
+            {% endif %}
         </div>
     {% endif %}
 

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

@@ -151,7 +151,7 @@ file that was distributed with this source code.
                                                         <ul class="dropdown-menu">
                                                             {% for admin in group.items %}
                                                                 {% if admin.hasroute('list') and admin.isGranted('LIST') %}
-                                                                    <li><a href="{{ admin.generateUrl('list')}}">{{ admin.label|trans({}, admin.translationdomain) }}</a></li>
+                                                                    <li{% if app.request.get('_sonata_admin') == admin.code %} class="active"{% endif %}><a href="{{ admin.generateUrl('list')}}">{{ admin.label|trans({}, admin.translationdomain) }}</a></li>
                                                                 {% endif %}
                                                             {% endfor %}
                                                         </ul>