Преглед изворни кода

Merge pull request #2108 from ValikDev/fix-crudviews

Fixed the actions list for cases when the create action is unavailable
Thomas пре 10 година
родитељ
комит
ee258da454
1 измењених фајлова са 5 додато и 1 уклоњено
  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 %}