base_show.html.twig 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 title %}
  9. {{ "title_show"|trans({'%name%': admin.toString(object)|truncate(15) }, 'SonataAdminBundle') }}
  10. {% endblock %}
  11. {% block navbar_title %}
  12. {{ block('title') }}
  13. {% endblock %}
  14. {%- block actions -%}
  15. {% include 'SonataAdminBundle:CRUD:action_buttons.html.twig' %}
  16. {%- endblock -%}
  17. {% block tab_menu %}
  18. {{ knp_menu_render(admin.sidemenu(action), {
  19. 'currentClass' : 'active',
  20. 'template': sonata_admin.adminPool.getTemplate('tab_menu_template')
  21. }, 'twig') }}
  22. {% endblock %}
  23. {% block show %}
  24. <div class="sonata-ba-view">
  25. {{ sonata_block_render_event('sonata.admin.show.top', { 'admin': admin, 'object': object }) }}
  26. {% set has_tab = (admin.showtabs|length == 1 and admin.showtabs|keys[0] != 'default') or admin.showtabs|length > 1 %}
  27. {% if has_tab %}
  28. <div class="nav-tabs-custom">
  29. <ul class="nav nav-tabs" role="tablist">
  30. {% for name, show_tab in admin.showtabs %}
  31. <li{% if loop.first %} class="active"{% endif %}>
  32. <a href="#tab_{{ admin.uniqid }}_{{ loop.index }}" data-toggle="tab">
  33. <i class="fa fa-exclamation-circle has-errors hide" aria-hidden="true"></i>
  34. {{ show_tab.label|trans({}, show_tab.translation_domain ?: admin.translationDomain) }}
  35. </a>
  36. </li>
  37. {% endfor %}
  38. </ul>
  39. <div class="tab-content">
  40. {% for code, show_tab in admin.showtabs %}
  41. <div
  42. class="tab-pane fade{% if loop.first %} in active{% endif %}"
  43. id="tab_{{ admin.uniqid }}_{{ loop.index }}"
  44. >
  45. <div class="box-body container-fluid">
  46. <div class="sonata-ba-collapsed-fields">
  47. {% if show_tab.description != false %}
  48. <p>{{ show_tab.description|raw }}</p>
  49. {% endif %}
  50. {% set groups = show_tab.groups %}
  51. {{ block('show_groups') }}
  52. </div>
  53. </div>
  54. </div>
  55. {% endfor %}
  56. </div>
  57. </div>
  58. {% elseif admin.showtabs is iterable %}
  59. {% set groups = admin.showtabs.default.groups %}
  60. {{ block('show_groups') }}
  61. {% endif %}
  62. </div>
  63. {{ sonata_block_render_event('sonata.admin.show.bottom', { 'admin': admin, 'object': object }) }}
  64. {% endblock %}
  65. {% block show_groups %}
  66. <div class="row">
  67. {% block field_row %}
  68. {% for code in groups %}
  69. {% set show_group = admin.showgroups[code] %}
  70. <div class="{{ show_group.class|default('col-md-12') }} {{ no_padding|default(false) ? 'nopadding' }}">
  71. <div class="{{ show_group.box_class }}">
  72. <div class="box-header">
  73. <h4 class="box-title">
  74. {% block show_title %}
  75. {{ show_group.label|trans({}, show_group.translation_domain|default(admin.translationDomain)) }}
  76. {% endblock %}
  77. </h4>
  78. </div>
  79. <div class="box-body table-responsive no-padding">
  80. <table class="table">
  81. <tbody>
  82. {% for field_name in show_group.fields %}
  83. {% block show_field %}
  84. <tr class="sonata-ba-view-container">
  85. {% if elements[field_name] is defined %}
  86. {{ elements[field_name]|render_view_element(object)}}
  87. {% endif %}
  88. </tr>
  89. {% endblock %}
  90. {% endfor %}
  91. </tbody>
  92. </table>
  93. </div>
  94. </div>
  95. </div>
  96. {% endfor %}
  97. {% endblock %}
  98. </div>
  99. {% endblock %}