Jelajahi Sumber

Merge pull request #1701 from pulzarraider/patch-2

standard_layout.html.twig: Do not display the group label if no item in group is available
Thomas 11 tahun lalu
induk
melakukan
2e9d4406a6
1 mengubah file dengan 11 tambahan dan 1 penghapusan
  1. 11 1
      Resources/views/standard_layout.html.twig

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

@@ -126,10 +126,20 @@ file that was distributed with this source code.
                                             {% for group in admin_pool.dashboardgroups %}
                                                 {% set display = (group.roles is empty or is_granted('ROLE_SUPER_ADMIN') ) %}
                                                 {% for role in group.roles if not display %}
-                                                    {% set display = is_granted(role)%}
+                                                    {% set display = is_granted(role) %}
                                                 {% endfor %}
 
+                                                {# Do not display the group label if no item in group is available #}
+                                                {% set item_count = 0 %}
                                                 {% if display %}
+                                                    {% for admin in group.items if item_count == 0 %}
+                                                        {% if admin.hasroute('list') and admin.isGranted('LIST') %}
+                                                            {% set item_count = item_count+1 %}
+                                                        {% endif %}
+                                                    {% endfor %}
+                                                {% endif %}
+
+                                                {% if display and (item_count > 0) %}
                                                 <li class="dropdown">
                                                     <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ group.label|trans({}, group.label_catalogue) }} <span class="caret"></span></a>
                                                     <ul class="dropdown-menu">