You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

layout.html.twig 12KB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!DOCTYPE html>
  2. <html lang="{{ app.request.locale|split('_')|first|default('en') }}" dir="{{ easyadmin_config('design.rtl') ? 'rtl' : 'ltr' }}">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="robots" content="noindex, nofollow, noarchive, nosnippet, noodp, noimageindex, notranslate, nocache" />
  7. <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  8. <meta name="generator" content="EasyAdmin" />
  9. <title>{% block page_title %}{{ block('content_title')|striptags|raw }}{% endblock %}</title>
  10. {% block head_stylesheets %}
  11. <link rel="stylesheet" href="{{ asset('bundles/easyadmin/app.css') }}">
  12. {% endblock %}
  13. {% block head_custom_stylesheets %}
  14. {% for css_asset in easyadmin_config('design.assets.css') %}
  15. <link rel="stylesheet" href="{{ asset(css_asset) }}">
  16. {% endfor %}
  17. {% endblock head_custom_stylesheets %}
  18. {% if easyadmin_config('design.brand_color') != 'hsl(230, 55%, 60%)' %}
  19. <style>
  20. :root { --color-primary: {{ easyadmin_config('design.brand_color') }}; }
  21. </style>
  22. {% endif %}
  23. {% block head_favicon %}
  24. {% set favicon = easyadmin_config('design.assets.favicon') %}
  25. <link rel="icon" type="{{ favicon.mime_type }}" href="{{ asset(favicon.path) }}" />
  26. {% endblock %}
  27. {% block head_javascript %}
  28. <script src="{{ asset('bundles/easyadmin/app.js') }}"></script>
  29. {% endblock head_javascript %}
  30. {% if easyadmin_config('design.rtl') %}
  31. <link rel="stylesheet" href="{{ asset('bundles/easyadmin/app.rtl.css') }}">
  32. <link rel="stylesheet" href="{{ asset('bundles/easyadmin/app-custom-rtl.css') }}">
  33. {% endif %}
  34. </head>
  35. {% block body %}
  36. <body id="{% block body_id %}{% endblock %}" class="easyadmin {% block body_class %}{% endblock %}">
  37. <script>
  38. document.body.classList.add(
  39. 'easyadmin-content-width-' + (localStorage.getItem('easyadmin/content/width') || 'normal'),
  40. 'easyadmin-sidebar-width-' + (localStorage.getItem('easyadmin/sidebar/width') || 'normal')
  41. );
  42. </script>
  43. {% block wrapper_wrapper %}
  44. <div class="wrapper">
  45. {% block wrapper %}
  46. <header class="main-header">
  47. {% block header %}
  48. <nav class="navbar" role="navigation">
  49. <button id="navigation-toggler" type="button" aria-label="Toggle navigation">
  50. <i class="fa fa-fw fa-bars"></i>
  51. </button>
  52. <div id="header-logo">
  53. {% block header_logo %}
  54. <a class="logo {{ easyadmin_config('site_name')|length > 14 ? 'logo-long' }}" title="{{ easyadmin_config('site_name')|striptags }}" href="{{ path('easyadmin') }}">
  55. {{ easyadmin_config('site_name')|raw }}
  56. </a>
  57. {% endblock header_logo %}
  58. </div>
  59. </nav>
  60. <div id="switch-merchant">
  61. {% if is_granted('ROLE_ADMIN') %}
  62. <form action="{{ path('switch_merchant') }}" method="post">
  63. <select class="form-control" name="id_merchant">
  64. {% for merchant in merchants %}
  65. <option value="{{merchant.id}}" {% if current_merchant and current_merchant.id == merchant.id %}selected="selected"{% endif %}>{{merchant.title}}</option>
  66. {% endfor %}
  67. </select>
  68. </form>
  69. {% else %}
  70. {% if current_merchant %}
  71. {{ current_merchant.title }}
  72. {% endif %}
  73. {% endif %}
  74. </div>
  75. {% set _user_name = easyadmin_read_property(app.user, easyadmin_config('user.name_property_path'))|default('user.unnamed'|trans(domain = 'EasyAdminBundle')) %}
  76. {% set _logout_path = easyadmin_logout_path() %}
  77. {% set _user_has_logout = _logout_path is not empty %}
  78. {% set _user_is_impersonated = is_granted('ROLE_PREVIOUS_ADMIN') %}
  79. {% set _user_menu_content %}
  80. <div class="popover-content-section user-details {{ _user_has_logout or _user_is_impersonated ? 'user-has-actions' }}">
  81. <p class="small text-muted mb-0">{{ 'user.logged_in_as'|trans(domain = 'EasyAdminBundle') }}</p>
  82. <p class="user-details-name">
  83. {% if app.user|default(false) == false %}
  84. {{ 'user.anonymous'|trans(domain = 'EasyAdminBundle') }}
  85. {% else %}
  86. {{ _user_name }}
  87. {% endif %}
  88. </p>
  89. </div>
  90. {% block user_menu %}
  91. {% if _user_has_logout or _user_is_impersonated %}
  92. <div class="popover-content-section user-menu">
  93. {% if _user_has_logout %}
  94. <a class="user-action user-action-logout" href="{{ _logout_path }}">{{ 'user.signout'|trans(domain = 'EasyAdminBundle') }}</a>
  95. {% endif %}
  96. {% if _user_is_impersonated %}
  97. <a class="user-action user-action-exit-impersonation" href="?_switch_user=_exit">{{ 'user.exit_impersonation'|trans(domain = 'EasyAdminBundle') }}</a>
  98. {% endif %}
  99. </div>
  100. {% endif %}
  101. {% endblock user_menu %}
  102. {% endset %}
  103. <div class="content-top navbar-custom-menu">
  104. {% block header_custom_menu %}
  105. <div class="user user-menu-wrapper {{ _user_is_impersonated ? 'user-is-impersonated' }}" data-toggle="popover" data-placement="bottom" data-container=".user-menu-wrapper" data-content="{{ _user_menu_content|e('html_attr') }}" data-html="true">
  106. {% if easyadmin_config('user.display_avatar') %}
  107. {% set _avatar_image_path = easyadmin_read_property(app.user, easyadmin_config('user.avatar_property_path')) %}
  108. {% if null == _avatar_image_path %}
  109. <i class="fa fa-fw {{ app.user is not null ? 'fa-user-circle' : 'fa-user-times' }} user-avatar"></i>
  110. {% else %}
  111. <img class="user-avatar" src="{{ _avatar_image_path }}" />
  112. {% endif %}
  113. {% endif %}
  114. {% if easyadmin_config('user.display_name') %}
  115. <span class="user-name">{{ _user_name }}</span>
  116. {% endif %}
  117. </div>
  118. {% endblock header_custom_menu %}
  119. </div>
  120. {% endblock header %}
  121. </header>
  122. <aside class="main-sidebar">
  123. {% block sidebar %}
  124. <section class="sidebar">
  125. {% block main_menu_wrapper %}
  126. {{ include([
  127. _entity_config is defined ? _entity_config.templates.menu,
  128. easyadmin_config('design.templates.menu'),
  129. '@EasyAdmin/default/menu.html.twig'
  130. ]) }}
  131. {% endblock main_menu_wrapper %}
  132. </section>
  133. {% endblock sidebar %}
  134. </aside>
  135. <div class="content-wrapper">
  136. {% block flash_messages %}
  137. {{ include(_entity_config is defined ? _entity_config.templates.flash_messages : '@EasyAdmin/default/flash_messages.html.twig') }}
  138. {% endblock flash_messages %}
  139. <div id="sidebar-resizer-handler" class="resizer-handler resizer-handler-left"></div>
  140. {% block content %}
  141. <div class="content">
  142. {% block content_header_wrapper %}
  143. {% set _has_content_help = _entity_config is defined and _entity_config[app.request.query.get('action')]['help']|default(false) %}
  144. <section class="content-header {{ _has_content_help ? 'has-content-help' }}">
  145. {% block content_header %}
  146. <div class="d-flex flex-row justify-content-between align-content-center w-100">
  147. <div class="content-header-title">
  148. <h1 class="title">{% block content_title %}{% endblock %}</h1>
  149. </div>
  150. {% block global_actions_wrapper %}
  151. <div class="global-actions">{% block global_actions %}{% endblock %}</div>
  152. {% endblock %}
  153. </div>
  154. {% block content_help %}
  155. {% if _entity_config is defined and _entity_config[app.request.query.get('action')]['help']|default(false) %}
  156. <div class="content-header-help">
  157. {{ _entity_config[app.request.query.get('action')]['help']|trans(domain = _entity_config.translation_domain)|raw }}
  158. </div>
  159. {% endif %}
  160. {% endblock content_help %}
  161. {% endblock content_header %}
  162. </section>
  163. {% endblock content_header_wrapper %}
  164. <section id="main" class="content-body">
  165. {% block main %}{% endblock %}
  166. </section>
  167. {% block content_footer_wrapper %}
  168. <section class="content-footer">
  169. {% block content_footer %}{% endblock %}
  170. </section>
  171. {% endblock %}
  172. </div>
  173. {% endblock content %}
  174. <div id="content-resizer-handler" class="resizer-handler resizer-handler-right"></div>
  175. </div>
  176. {% endblock wrapper %}
  177. </div>
  178. {% endblock wrapper_wrapper %}
  179. {% block body_javascript %}{% endblock body_javascript %}
  180. {% block body_custom_javascript %}
  181. {% for js_asset in easyadmin_config('design.assets.js') %}
  182. <script src="{{ asset(js_asset) }}"></script>
  183. {% endfor %}
  184. {% endblock body_custom_javascript %}
  185. </body>
  186. {% endblock body %}
  187. </html>