vendor/easycorp/easyadmin-bundle/src/Resources/views/default/show.html.twig line 1

Open in your IDE?
  1. {% set _entity_config = easyadmin_entity(app.request.query.get('entity')) %}
  2. {# the empty string concatenation is needed when the primary key is an object (e.g. an Uuid object) #}
  3. {% set _entity_id = '' ~ attribute(entity, _entity_config.primary_key_field_name) %}
  4. {% trans_default_domain _entity_config.translation_domain %}
  5. {% set _trans_parameters = { '%entity_name%': _entity_config.name|trans, '%entity_label%': _entity_config.label|trans, '%entity_id%': _entity_id } %}
  6. {% extends _entity_config.templates.layout %}
  7. {% block body_id 'easyadmin-show-' ~ _entity_config.name ~ '-' ~ _entity_id %}
  8. {% block body_class 'show show-' ~ _entity_config.name|lower %}
  9. {% block content_title %}
  10.     {% apply spaceless %}
  11.         {% set _default_title = 'show.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
  12.         {{ _entity_config.show.title is defined ? _entity_config.show.title|trans(_trans_parameters) : _default_title }}
  13.     {% endapply %}
  14. {% endblock %}
  15. {% block content_footer_wrapper '' %}
  16. {% block main %}
  17.     <div class="form-horizontal">
  18.         {% block show_fields %}
  19.             {% set _fields_visible_by_user = fields|filter((metadata, field) => easyadmin_is_granted(metadata.permission)) %}
  20.             {% for field, metadata in _fields_visible_by_user %}
  21.                 {% block show_field %}
  22.                     <div class="form-group field-{{ metadata.type|default('default')|lower }} {{ metadata.css_class|default('') }}">
  23.                         <label class="control-label">
  24.                             {{ metadata.label|trans(_trans_parameters)|raw }}
  25.                         </label>
  26.                         <div class="form-widget">
  27.                             <div class="form-control">
  28.                                 {{ easyadmin_render_field_for_show_view(_entity_config.name, entity, metadata) }}
  29.                             </div>
  30.                             {% if metadata.help|default('') != '' %}
  31.                                 <small class="form-help"><i class="fa fa-fw fa-info-circle"></i> {{ metadata.help|trans|raw }}</small>
  32.                             {% endif %}
  33.                         </div>
  34.                     </div>
  35.                 {% endblock %}
  36.             {% endfor %}
  37.         {% endblock %}
  38.     </div>
  39.     <section class="content-footer">
  40.         <div class="form-actions">
  41.             {% block item_actions %}
  42.                 {% set _show_actions = easyadmin_get_actions_for_show_item(_entity_config.name) %}
  43.                 {% set _request_parameters = app.request.query.all %}
  44.                 {{ include('@EasyAdmin/default/includes/_actions.html.twig', {
  45.                     actions: _show_actions,
  46.                     entity_config: _entity_config,
  47.                     request_parameters: _request_parameters,
  48.                     translation_domain: _entity_config.translation_domain,
  49.                     trans_parameters: _trans_parameters,
  50.                     item_id: _entity_id,
  51.                     item: entity
  52.                 }, with_context = false) }}
  53.             {% endblock item_actions %}
  54.         </div>
  55.     </section>
  56.     {% block delete_form %}
  57.         {{ include('@EasyAdmin/default/includes/_delete_form.html.twig', {
  58.             view: 'show',
  59.             referer: app.request.query.get('referer', ''),
  60.             delete_form: delete_form,
  61.             _translation_domain: _entity_config.translation_domain,
  62.             _trans_parameters: _trans_parameters,
  63.             _entity_config: _entity_config,
  64.         }, with_context = false) }}
  65.     {% endblock delete_form %}
  66. {% endblock %}
  67. {% block body_javascript %}
  68.     {{ parent() }}
  69.     <script type="text/javascript">
  70.         $(function() {
  71.             $('a.action-delete').on('click', function(e) {
  72.                 e.preventDefault();
  73.                 $('#modal-delete').modal({ backdrop: true, keyboard: true })
  74.                     .off('click', '#modal-delete-button')
  75.                     .on('click', '#modal-delete-button', function () {
  76.                         $('#delete-form').trigger('submit');
  77.                     });
  78.             });
  79.         });
  80.     </script>
  81. {% endblock %}