base_show.html.twig 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 base_template %}
  8. {% block actions %}
  9. <div class="sonata-actions">
  10. <ul>
  11. {% if admin.hasRoute('edit') and admin.isGranted('EDIT', object)%}
  12. <li class="btn sonata-action-element"><a href="{{ admin.generateObjectUrl('edit', object) }}">{% trans from 'SonataAdminBundle' %}link_action_edit{% endtrans %}</a></li>
  13. {% endif %}
  14. {% if admin.hasroute('history') and admin.id(object) and admin.isGranted('EDIT', object) %}
  15. <li class="btn sonata-action-element"><a href="{{ admin.generateObjectUrl('history', object) }}">{% trans from 'SonataAdminBundle' %}link_action_history{% endtrans %}</a></li>
  16. {% endif %}
  17. {% if admin.hasRoute('create') and admin.isGranted('CREATE')%}
  18. <li class="btn sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans from 'SonataAdminBundle' %}link_action_create{% endtrans %}</a></li>
  19. {% endif %}
  20. </ul>
  21. </div>
  22. {% endblock %}
  23. {% block side_menu %}{{ knp_menu_render(admin.sidemenu(action), {}, 'list') }}{% endblock %}
  24. {% block show %}
  25. <div class="sonata-ba-view">
  26. {% for name, view_group in admin.showgroups %}
  27. <table class="bordered-table">
  28. {% if name %}
  29. <tr class="sonata-ba-view-title">
  30. <td colspan="2">
  31. {{ admin.trans(name) }}
  32. </td>
  33. </tr>
  34. {% endif %}
  35. {% for field_name in view_group.fields %}
  36. <tr class="sonata-ba-view-container">
  37. {% if admin.show[field_name] is defined %}
  38. {{ admin.show[field_name]|render_view_element(object) }}
  39. {% endif %}
  40. </tr>
  41. {% endfor %}
  42. </table>
  43. {% endfor %}
  44. </div>
  45. {% endblock %}