Просмотр исходного кода

Merge pull request #3113 from Storke/master

Don't create dropdown if there is only one action
Sullivan SENECHAL 10 лет назад
Родитель
Сommit
08bc776aad
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      Resources/views/standard_layout.html.twig

+ 4 - 0
Resources/views/standard_layout.html.twig

@@ -261,12 +261,16 @@ file that was distributed with this source code.
 
                                                 {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
                                                     <ul class="nav navbar-nav navbar-right">
+                                                    {% if _actions|split('<li>')|length > 2 %}
                                                         <li class="dropdown sonata-actions">
                                                             <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>
                                                             <ul class="dropdown-menu" role="menu">
                                                                 {{ _actions|raw }}
                                                             </ul>
                                                         </li>
+                                                    {% else %}
+                                                        {{ _actions|raw }}
+                                                    {% endif %}
                                                     </ul>
                                                 {% endif %}