block_admin_list.html.twig 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {#
  2. This file is part of the Sonata package.
  3. (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  4. For the full copyright and license information, please view the LICENSE
  5. file that was distributed with this source code.
  6. #}
  7. {% extends 'SonataBlockBundle:Block:block_base.html.twig' %}
  8. {% block block %}
  9. {% for group in groups %}
  10. <table class="table table-bordered table-striped sonata-ba-list">
  11. <thead>
  12. <tr>
  13. <th colspan="3">{{ group.label|trans({}, group.label_catalogue) }}</th>
  14. </tr>
  15. </thead>
  16. <tbody>
  17. {% for admin in group.items %}
  18. {% if admin.hasroute('create') and admin.isGranted('CREATE') or admin.hasroute('list') and admin.isGranted('LIST') %}
  19. <tr>
  20. <td class="sonata-ba-list-label">{{ admin.label|trans({}, admin.translationdomain) }}</td>
  21. <td>
  22. {% if admin.hasroute('create') and admin.isGranted('CREATE') %}
  23. {% if admin.subClasses is empty %}
  24. <a href="{{ admin.generateUrl('create')}}">
  25. <img src="{{ asset('bundles/sonataadmin/famfamfam/add.png') }}" alt="{%- trans from 'SonataAdminBundle' %}link_add{% endtrans -%}" />
  26. {%- trans from 'SonataAdminBundle' %}link_add{% endtrans -%}
  27. </a>
  28. {% else %}
  29. <div class="btn-group">
  30. <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
  31. <img src="{{ asset('bundles/sonataadmin/famfamfam/add.png') }}" alt="{%- trans from 'SonataAdminBundle' %}link_add{% endtrans -%}" />
  32. {% trans from 'SonataAdminBundle' %}link_add{% endtrans %}
  33. <span class="caret"></span>
  34. </a>
  35. <ul class="dropdown-menu">
  36. {% for subclass in admin.subclasses|keys %}
  37. <li>
  38. <a href="{{ admin.generateUrl('create', {'subclass': subclass}) }}">{{ subclass }}</a>
  39. </li>
  40. {% endfor %}
  41. </ul>
  42. </div>
  43. {% endif %}
  44. {% endif %}
  45. </td>
  46. <td>
  47. {% if admin.hasroute('list') and admin.isGranted('LIST') %}
  48. <a href="{{ admin.generateUrl('list')}}">
  49. <img src="{{ asset('bundles/sonataadmin/famfamfam/application_view_list.png') }}" alt="{%- trans from 'SonataAdminBundle' %}link_list{% endtrans -%}" />
  50. {%- trans from 'SonataAdminBundle' %}link_list{% endtrans -%}
  51. </a>
  52. {% endif %}
  53. </td>
  54. </tr>
  55. {% endif %}
  56. {% endfor %}
  57. </tbody>
  58. </table>
  59. {% endfor %}
  60. {% endblock %}