浏览代码

Merge pull request #502 from EmmanuelVella/delete

Fix edit button display in delete template
Thomas 13 年之前
父节点
当前提交
3db4661d22
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      Resources/views/CRUD/delete.html.twig

+ 4 - 2
Resources/views/CRUD/delete.html.twig

@@ -40,9 +40,11 @@ file that was distributed with this source code.
 
                 <input type="submit" class="btn danger" value="{% trans from 'SonataAdminBundle' %}btn_delete{% endtrans %}" />
 
-                {% trans from 'SonataAdminBundle' %}delete_or{% endtrans %}
+                {% if admin.hasRoute('edit') and admin.isGranted('EDIT') %}
+                    {% trans from 'SonataAdminBundle' %}delete_or{% endtrans %}
 
-                <a class="btn success" href="{{ admin.generateObjectUrl('edit', object) }}">{% trans from 'SonataAdminBundle' %}link_action_edit{% endtrans %}</a>
+                    <a class="btn success" href="{{ admin.generateObjectUrl('edit', object) }}">{% trans from 'SonataAdminBundle' %}link_action_edit{% endtrans %}</a>
+                {% endif %}
             </form>
         </div>
     </div>