Browse Source

Merge pull request #2108 from ValikDev/fix-crudviews

Fixed the actions list for cases when the create action is unavailable
Thomas 10 năm trước cách đây
mục cha
commit
ee258da454
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      Resources/views/CRUD/base_list.html.twig

+ 5 - 1
Resources/views/CRUD/base_list.html.twig

@@ -12,7 +12,11 @@ file that was distributed with this source code.
 {% extends base_template %}
 
 {% block actions %}
-    <li>{% include 'SonataAdminBundle:Core:create_button.html.twig' %}</li>
+{% spaceless %}
+    {% if admin.hasRoute('create') and admin.isGranted('CREATE')%}
+        <li>{% include 'SonataAdminBundle:Core:create_button.html.twig' %}</li>
+    {% endif %}
+{% endspaceless %}
 {% endblock %}
 
 {% block tab_menu %}{{ knp_menu_render(admin.sidemenu(action), {'currentClass' : 'active', 'template': admin_pool.getTemplate('tab_menu_template')}, 'twig') }}{% endblock %}