浏览代码

Hide actions if _actions is empty

Added a replace function to check if the list is empty.

Now _actions included a string like '<li></li>' so this was never empty.
NoScopie 11 年之前
父节点
当前提交
1abd7b2926
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Resources/views/standard_layout.html.twig

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

@@ -245,7 +245,7 @@ file that was distributed with this source code.
                                                     {% endif %}
                                                     {% endif %}
                                                 </div>
                                                 </div>
 
 
-                                                {% if _actions is not empty %}
+                                                {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
                                                     <ul class="nav navbar-nav navbar-right">
                                                     <ul class="nav navbar-nav navbar-right">
                                                         <li class="dropdown sonata-actions">
                                                         <li class="dropdown sonata-actions">
                                                             <a href="#" class="dropdown-toggle" data-toggle="dropdown">Actions <b class="caret"></b></a>
                                                             <a href="#" class="dropdown-toggle" data-toggle="dropdown">Actions <b class="caret"></b></a>