base_show_compare.html.twig 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 'SonataAdminBundle:CRUD:base_show.html.twig' %}
  8. {% block show %}
  9. <div class="sonata-ba-view">
  10. {{ sonata_block_render_event('sonata.admin.show.top', { 'admin': admin, 'object': object }) }}
  11. {% for name, view_group in admin.showgroups %}
  12. <table class="table table-bordered">
  13. {% if name %}
  14. <thead>
  15. <tr class="sonata-ba-view-title">
  16. <th colspan="3">
  17. {{ admin.trans(name) }}
  18. </th>
  19. </tr>
  20. </thead>
  21. {% endif %}
  22. <tbody>
  23. {% for field_name, compare in comparison %}
  24. {% set old_value = (compare.same == '' ? compare.old : compare.same) %}
  25. {% set new_value = (compare.same == '' ? compare.new : compare.same) %}
  26. <tr class="sonata-ba-view-container history-audit-compare{% if(old_value|raw != new_value|raw) %} diff{% endif %}">
  27. {% if elements[field_name] is defined %}
  28. {{ elements[field_name]|render_view_element_compare(old_value, new_value) }}
  29. {% endif %}
  30. </tr>
  31. {% endfor %}
  32. </tbody>
  33. </table>
  34. {% endfor %}
  35. {{ sonata_block_render_event('sonata.admin.show.bottom', { 'admin': admin, 'object': object }) }}
  36. </div>
  37. {% endblock %}