templates/bundles/EasyAdminBundle/layout.html.twig line 1

Open in your IDE?
  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {% trans_default_domain ea.i18n.translationDomain %}
  3. <!DOCTYPE html>
  4. <html lang="{{ ea.i18n.htmlLocale }}" dir="{{ ea.i18n.textDirection }}">
  5. <head>
  6.     {% block head_metas %}
  7.         <meta charset="utf-8">
  8.         <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9.         <meta name="robots" content="noindex, nofollow, noarchive, nosnippet, noodp, noimageindex, notranslate, nocache" />
  10.         <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  11.         <meta name="generator" content="EasyAdmin" />
  12.     {% endblock head_metas %}
  13.     {% set page_title_block_output %}{% block page_title %}{{ block('content_title') }}{% endblock %}{% endset %}
  14.     <title>{{ page_title_block_output|striptags|raw }}</title>
  15.     {% block head_stylesheets %}
  16.         <link rel="stylesheet" href="{{ asset('bundles/easyadmin/app.css') }}">
  17.         <link rel="stylesheet" href="{{ asset('omall/style.css') }}">
  18.     {% endblock %}
  19.     {% block configured_stylesheets %}
  20.         {{ include('@EasyAdmin/includes/_css_assets.html.twig', { assets: ea.assets.cssAssets ?? [] }, with_context = false) }}
  21.         {{ include('@EasyAdmin/includes/_encore_link_tags.html.twig', { assets: ea.assets.webpackEncoreAssets ?? [] }, with_context = false) }}
  22.     {% endblock %}
  23.     {% block head_favicon %}
  24.         <link rel="shortcut icon" href="{{ asset(ea.dashboardFaviconPath) }}">
  25.     {% endblock %}
  26.     {% block head_javascript %}
  27.         <script src="{{ asset('bundles/easyadmin/app.js') }}"></script>
  28.     {% endblock head_javascript %}
  29.     {% block configured_javascripts %}
  30.         {{ include('@EasyAdmin/includes/_js_assets.html.twig', { assets: ea.assets.jsAssets ?? [] }, with_context = false) }}
  31.         {{ include('@EasyAdmin/includes/_encore_script_tags.html.twig', { assets: ea.assets.webpackEncoreAssets ?? [] }, with_context = false) }}
  32.     {% endblock %}
  33.     {% if 'rtl' == ea.i18n.textDirection %}
  34.         <link rel="stylesheet" href="{{ asset('bundles/easyadmin/app.rtl.css') }}">
  35.     {% endif %}
  36.     {% block configured_head_contents %}
  37.         {% for htmlContent in ea.assets.headContents ?? [] %}
  38.             {{ htmlContent|raw }}
  39.         {% endfor %}
  40.     {% endblock %}
  41. </head>
  42. {% block body %}
  43.     <body id="{% block body_id %}{% endblock %}" class="ea {% block body_class %}{% endblock %}">
  44.     {% block javascript_page_layout %}
  45.         <script>
  46.             document.body.classList.add(
  47.                 'ea-content-width-' + (localStorage.getItem('ea/content/width') || '{{ ea.crud.contentWidth ?? ea.dashboardContentWidth ?? 'normal' }}'),
  48.                 'ea-sidebar-width-' + (localStorage.getItem('ea/sidebar/width') || '{{ ea.crud.sidebarWidth ?? ea.dashboardSidebarWidth ?? 'normal' }}')
  49.             );
  50.         </script>
  51.     {% endblock javascript_page_layout %}
  52.     {% block wrapper_wrapper %}
  53.         {% block flash_messages %}
  54.             {{ include(ea.templatePath('flash_messages')) }}
  55.         {% endblock flash_messages %}
  56.         {% set user_menu_avatar %}
  57.             {% if null == ea.userMenu.avatarUrl %}
  58.                 <span class="user-avatar">
  59.                     <span class="fa-stack">
  60.                         <i class="user-avatar-icon-background fas fa-square fa-stack-2x"></i>
  61.                         <i class="user-avatar-icon-foreground {{ ea.user is not null ? 'fa fa-user' : 'fas fa-user-slash' }} fa-stack-1x fa-inverse"></i>
  62.                     </span>
  63.                 </span>
  64.             {% else %}
  65.                 <img class="user-avatar" src="{{ ea.userMenu.avatarUrl }}" />
  66.             {% endif %}
  67.         {% endset %}
  68.         {% set impersonator_permission = constant('Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AuthenticatedVoter::IS_IMPERSONATOR') is defined ? 'IS_IMPERSONATOR' : 'ROLE_PREVIOUS_ADMIN' %}
  69.         {% set user_menu_dropdown %}
  70.             <ul class="dropdown-menu dropdown-menu-end">
  71.                 <li class="dropdown-user-details">
  72.                     <div>{{ user_menu_avatar }}</div>
  73.                     <div>
  74.                         <span class="user-label">{{ 'user.logged_in_as'|trans(domain = 'EasyAdminBundle') }}</span>
  75.                         <span class="user-name">{{ ea.user is null ? 'user.anonymous'|trans(domain = 'EasyAdminBundle') : ea.userMenu.name }}</span>
  76.                     </div>
  77.                 </li>
  78.                 <li><hr class="dropdown-divider"></li>
  79.                 {% block user_menu %}
  80.                     {% if ea.userMenu.items|length > 0 %}
  81.                         {% for item in ea.userMenu.items %}
  82.                             <li>
  83.                                 {% if item.isMenuSection and not loop.first %}
  84.                                     <hr class="dropdown-divider">
  85.                                 {% elseif not item.isMenuSection %}
  86.                                     <a href="{{ item.linkUrl }}" class="dropdown-item user-action {{ item.cssClass }}"
  87.                                        target="{{ item.linkTarget }}" rel="{{ item.linkRel }}"
  88.                                        referrerpolicy="origin-when-cross-origin">
  89.                                         {% if item.icon is not empty %}<i class="fa fa-fw {{ item.icon }}"></i>{% endif %}
  90.                                         <span>{{ item.label }}</span>
  91.                                     </a>
  92.                                 {% endif %}
  93.                             </li>
  94.                         {% endfor %}
  95.                     {% endif %}
  96.                 {% endblock user_menu %}
  97.             </ul>
  98.         {% endset %}
  99.         <div class="wrapper">
  100.             {% block wrapper %}
  101.                 <div class="responsive-header">
  102.                     {% block responsive_header %}
  103.                         <button id="navigation-toggler" type="button" aria-label="Toggle navigation">
  104.                             <i class="fa fa-fw fa-bars"></i>
  105.                         </button>
  106.                         <div id="responsive-header-logo" class="text-truncate">
  107.                             {% block responsive_header_logo %}
  108.                                 <a class="responsive-logo" title="{{ ea.dashboardTitle|striptags }}" href="{{ path(ea.dashboardRouteName) }}">
  109.                                     <{{ ea.dashboardTitle|raw }}>
  110.                                 </a>
  111.                             {% endblock responsive_header_logo %}
  112.                         </div>
  113.                         <div class="dropdown user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }}">
  114.                             <a class="user-details" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
  115.                                 {# to make the site design consistent, always display the user avatar in responsive header
  116.                                    and hide the user name (because there's no space left) regardless of the user config #}
  117.                                 {% if ea.userMenu.avatarDisplayed %}
  118.                                     {{ user_menu_avatar }}
  119.                                 {% else %}
  120.                                     <i class="user-avatar fa fa-fw {{ ea.user is not null ? 'fa-user' : 'fa-user-times' }}"></i>
  121.                                 {% endif %}
  122.                             </a>
  123.                             {{ user_menu_dropdown }}
  124.                         </div>
  125.                     {% endblock responsive_header %}
  126.                 </div>
  127.                 <div class="sidebar-wrapper">
  128.                     <aside class="sidebar">
  129.                         {% block sidebar %}
  130.                             <header class="main-header">
  131.                                 {% block header %}
  132.                                 <nav class="navbar" role="navigation">
  133.                                     {% block header_navbar %}
  134.                                         <div id="header-logo">
  135.                                             {% block header_logo %}
  136.                                                 <a class="logo" title="{{ ea.dashboardTitle|striptags }}" href="{{ path(ea.dashboardRouteName) }}">
  137.                                                     <span class="logo-custom">{{ ea.dashboardTitle|raw }}</span>
  138.                                                     <span class="logo-compact"><i class="fas fa-home"></i></span>
  139.                                                 </a>
  140.                                             {% endblock header_logo %}
  141.                                         </div>
  142.                                     {% endblock header_navbar %}
  143.                                 </nav>
  144.                                 {% endblock header %}
  145.                             </header>
  146.                             {% block main_menu_wrapper %}
  147.                                 {{ include(ea.templatePath('main_menu')) }}
  148.                             {% endblock main_menu_wrapper %}
  149.                         {% endblock sidebar %}
  150.                         <div id="sidebar-resizer-handler" class="resizer-handler resizer-handler-left"></div>
  151.                     </aside>
  152.                 </div>
  153.                 <section class="main-content">
  154.                     {% set has_search = ea.crud is not null and ea.crud.isSearchEnabled %}
  155.                     <aside class="content-top {{ has_search ? 'ea-search-enabled' : 'ea-search-disabled' }}">
  156.                         {% block content_top_header %}
  157.                             <div class="content-search">
  158.                                 {% if has_search %}
  159.                                     {% block search %}
  160.                                         <form class="form-action-search" method="get">
  161.                                             {% block search_form %}
  162.                                                 {% block search_form_filters %}
  163.                                                     {% for field, array in ea.search.appliedFilters %}
  164.                                                         {% for key, value in array %}
  165.                                                             {# This code re-applies your filters on searches, an iterable check is needed in cases we have more than one object for a filter #}
  166.                                                             {% if value is iterable %}
  167.                                                                 {% for index, iterValue in value %}
  168.                                                                     <input type="hidden" name="filters[{{ field }}][{{ key }}][{{ index }}]" value="{{ iterValue }}">
  169.                                                                 {% endfor %}
  170.                                                             {% else %}
  171.                                                                 <input type="hidden" name="filters[{{ field }}][{{ key }}]" value="{{ value }}">
  172.                                                             {% endif %}
  173.                                                         {% endfor %}
  174.                                                     {% endfor %}
  175.                                                 {% endblock %}
  176.                                                 <input type="hidden" name="crudAction" value="index">
  177.                                                 <input type="hidden" name="crudControllerFqcn" value="{{ ea.request.query.get('crudControllerFqcn') }}">
  178.                                                 <input type="hidden" name="menuIndex" value="{{ ea.request.query.get('menuIndex') }}">
  179.                                                 <input type="hidden" name="submenuIndex" value="{{ ea.request.query.get('submenuIndex') }}">
  180.                                                 <input type="hidden" name="page" value="1">
  181.                                                 <input type="hidden" name="signature" value="{{ ea_url().unsetAll().setAction('index').setController(ea.request.query.get('crudControllerFqcn')).getSignature() }}">
  182.                                                 <div class="form-group">
  183.                                                     <div class="form-widget">
  184.                                                         <i class="fas fa-search content-search-icon"></i>
  185.                                                         <label class="content-search-label" data-value="{{ app.request.get('query') }}">
  186.                                                             <input class="form-control {{ app.request.get('query') is null ? 'is-blank' }}" type="search" name="query" value="{{ app.request.get('query') ?? '' }}" placeholder="{{ 'action.search'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}" spellcheck="false" autocorrect="false" onInput="this.parentNode.dataset.value=this.value">
  187.                                                         </label>
  188.                                                         {% if app.request.get('query') %}
  189.                                                             <a href="{{ ea_url().unset('query') }}" class="content-search-reset">
  190.                                                                 <i class="fas fa-fw fa-times"></i>
  191.                                                             </a>
  192.                                                         {% endif %}
  193.                                                     </div>
  194.                                                 </div>
  195.                                             {% endblock %}
  196.                                         </form>
  197.                                     {% endblock search %}
  198.                                 {% endif %}
  199.                             </div>
  200.                             <div class="navbar-custom-menu">
  201.                                 {% block header_custom_menu %}
  202.                                     <div class="dropdown user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }}">
  203.                                         <a class="user-details" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
  204.                                             {{ user_menu_avatar }}
  205.                                             {% if ea.userMenu.isNameDisplayed %}
  206.                                                 <span class="user-name">{{ ea.userMenu.name }}</span>
  207.                                             {% endif %}
  208.                                         </a>
  209.                                         {{ user_menu_dropdown }}
  210.                                     </div>
  211.                                 {% endblock header_custom_menu %}
  212.                             </div>
  213.                         {% endblock content_top_header %}
  214.                     </aside>
  215.                     <div class="content-wrapper">
  216.                         {% block content %}
  217.                             <article class="content">
  218.                                 {% block content_header_wrapper %}
  219.                                     {% set has_help_message = (ea.crud.helpMessage ?? '') is not empty %}
  220.                                     <section class="content-header">
  221.                                         {% block content_header %}
  222.                                             <div class="content-header-title">
  223.                                                 <h1 class="title">
  224.                                                     {% block content_title %}{% endblock %}
  225.                                                     {% block content_help %}
  226.                                                         {% if has_help_message %}
  227.                                                             <span class="content-header-help">
  228.                                                             <i class="far fa-question-circle" data-bs-toggle="tooltip" title="{{ ea.crud.helpMessage|e('html_attr') }}"></i>
  229.                                                         </span>
  230.                                                         {% endif %}
  231.                                                     {% endblock %}
  232.                                                 </h1>
  233.                                             </div>
  234.                                             {% block page_actions_wrapper %}
  235.                                                 <div class="page-actions">{% block page_actions %}{% endblock %}</div>
  236.                                             {% endblock %}
  237.                                         {% endblock content_header %}
  238.                                     </section>
  239.                                 {% endblock content_header_wrapper %}
  240.                                 <section id="main" class="content-body">
  241.                                     {% block main %}{% endblock %}
  242.                                 </section>
  243.                                 {% block content_footer_wrapper %}
  244.                                     {% set content_footer = block('content_footer') is defined ? block('content_footer') : '' %}
  245.                                     {% if content_footer is not empty %}
  246.                                         <section class="content-footer">
  247.                                             {{ content_footer }}
  248.                                         </section>
  249.                                     {% endif %}
  250.                                 {% endblock %}
  251.                             </article>
  252.                         {% endblock content %}
  253.                         <div id="content-resizer-handler" class="resizer-handler resizer-handler-right"></div>
  254.                     </div>
  255.                 </section>
  256.             {% endblock wrapper %}
  257.         </div>
  258.     {% endblock wrapper_wrapper %}
  259.     {% block body_javascript %}{% endblock body_javascript %}
  260.     {% block configured_body_contents %}
  261.         {% for htmlContent in ea.assets.bodyContents ?? [] %}
  262.             {{ htmlContent|raw }}
  263.         {% endfor %}
  264.     {% endblock %}
  265.     </body>
  266. {% endblock body %}
  267. </html>