vendor/sonata-project/admin-bundle/src/Resources/views/standard_layout.html.twig line 1

Open in your IDE?
  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. {%- set _preview = block('preview') is defined ? block('preview')|trim : null %}
  8. {% set _form = block('form') is defined ? block('form')|trim : null %}
  9. {% set _show = block('show') is defined ? block('show')|trim : null %}
  10. {% set _list_table = block('list_table') is defined ? block('list_table')|trim : null %}
  11. {% set _list_filters = block('list_filters') is defined ? block('list_filters')|trim : null %}
  12. {% set _tab_menu = block('tab_menu') is defined ? block('tab_menu')|trim : null %}
  13. {% set _content = block('content') is defined ? block('content')|trim : null %}
  14. {% set _title = block('title') is defined ? block('title')|trim : null %}
  15. {% set _breadcrumb = block('breadcrumb') is defined ? block('breadcrumb')|trim : null %}
  16. {% set _actions = block('actions') is defined ? block('actions')|trim : null %}
  17. {% set _navbar_title = block('navbar_title') is defined ? block('navbar_title')|trim : null %}
  18. {% set _list_filters_actions = block('list_filters_actions') is defined ? block('list_filters_actions')|trim : null -%}
  19. {% set _skin = sonata_config.getOption('skin') %}
  20. {% set _use_select2 = sonata_config.getOption('use_select2') %}
  21. {% set _use_icheck = sonata_config.getOption('use_icheck') %}
  22. <!DOCTYPE html>
  23. <html {% block html_attributes %}class="no-js"{% endblock %}>
  24. <head>
  25. {% block meta_tags %}
  26. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  27. <meta charset="UTF-8">
  28. <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
  29. {% endblock %}
  30. <meta data-sonata-admin='{{ {
  31. config: {
  32. SKIN: _skin,
  33. CONFIRM_EXIT: sonata_config.getOption('confirm_exit'),
  34. USE_SELECT2: _use_select2,
  35. USE_ICHECK: _use_icheck,
  36. USE_STICKYFORMS: sonata_config.getOption('use_stickyforms'),
  37. DEBUG: sonata_config.getOption('js_debug'),
  38. },
  39. translations: {
  40. CONFIRM_EXIT: 'confirm_exit'|trans({}, 'SonataAdminBundle'),
  41. },
  42. }|json_encode()|raw }}'
  43. >
  44. {% block stylesheets %}
  45. {% for stylesheet in sonata_config.getOption('stylesheets', []) %}
  46. <link rel="stylesheet" href="{{ asset(stylesheet) }}">
  47. {% endfor %}
  48. {% endblock %}
  49. {% block javascripts %}
  50. {% block sonata_javascript_config %}
  51. {% endblock %}
  52. {% block sonata_javascript_pool %}
  53. {% for javascript in sonata_config.getOption('javascripts', []) %}
  54. <script src="{{ asset(javascript) }}"></script>
  55. {% endfor %}
  56. {% endblock %}
  57. {# TODO: Drop locale for moment calls when dropping support for `sonata-project/form-extensions` 1.x #}
  58. {# localize moment #}
  59. {% set localeForMoment = canonicalize_locale_for_moment() %}
  60. {% if localeForMoment %}
  61. <script src="{{ asset('bundles/sonataform/moment-locale/' ~ localeForMoment ~ '.js') }}"></script>
  62. {% endif %}
  63. {# localize select2 #}
  64. {% if sonata_config.getOption('use_select2') %}
  65. {% set localeForSelect2 = canonicalize_locale_for_select2() %}
  66. {% if localeForSelect2 %}
  67. <script src="{{ asset('bundles/sonataadmin/select2-locale/' ~ localeForSelect2 ~ '.js') }}"></script>
  68. {% endif %}
  69. {% endif %}
  70. {% endblock %}
  71. <title>
  72. {% block sonata_head_title %}
  73. {{ 'Admin'|trans({}, 'SonataAdminBundle') }}
  74. {% if _title is not empty %}
  75. {{ _title|striptags|raw }}
  76. {% else %}
  77. {% if action is defined %}
  78. -
  79. {{ render_breadcrumbs_for_title(admin, action) }}
  80. {% endif %}
  81. {% endif %}
  82. {% endblock %}
  83. </title>
  84. </head>
  85. <body
  86. {% block body_attributes -%}
  87. class="sonata-bc {% block admin_lte_skin_class %}{{ _skin }}{% endblock %} fixed
  88. {% if _use_select2 %}sonata-select2{% endif %}
  89. {% if _use_icheck %}sonata-icheck{% endif %}
  90. {% if app.request.cookies.get('sonata_sidebar_hide') -%}
  91. sidebar-collapse
  92. {%- endif -%}"
  93. {%- endblock -%}
  94. >
  95. <div class="wrapper">
  96. {% block sonata_header %}
  97. <header class="main-header">
  98. {% block sonata_header_noscript_warning %}
  99. <noscript>
  100. <div class="noscript-warning">
  101. {{ 'noscript_warning'|trans({}, 'SonataAdminBundle') }}
  102. </div>
  103. </noscript>
  104. {% endblock %}
  105. {% block logo %}
  106. {% apply spaceless %}
  107. <a class="logo" href="{{ path('sonata_admin_dashboard') }}">
  108. {% if 'icon' == sonata_config.getOption('logo_content') or 'all' == sonata_config.getOption('logo_content') %}
  109. <img src="{{ asset(sonata_config.logo) }}" alt="{{ sonata_config.title }}">
  110. {% endif %}
  111. {% if 'text' == sonata_config.getOption('logo_content') or 'all' == sonata_config.getOption('logo_content') %}
  112. <span>{{ sonata_config.title }}</span>
  113. {% endif %}
  114. </a>
  115. {% endapply %}
  116. {% endblock %}
  117. {% block sonata_nav %}
  118. <nav class="navbar navbar-static-top">
  119. <a href="#" class="sidebar-toggle fa5" data-toggle="push-menu"
  120. role="button" title="{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}">
  121. <span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span>
  122. </a>
  123. <div class="navbar-left">
  124. {% block sonata_breadcrumb %}
  125. <div class="hidden-xs">
  126. {% if _breadcrumb is not empty or action is defined %}
  127. <ol class="nav navbar-top-links breadcrumb">
  128. {% if _breadcrumb is empty %}
  129. {% if action is defined %}
  130. {{ render_breadcrumbs(admin, action) }}
  131. {% endif %}
  132. {% else %}
  133. {{ _breadcrumb|raw }}
  134. {% endif %}
  135. </ol>
  136. {% endif %}
  137. </div>
  138. {% endblock sonata_breadcrumb %}
  139. </div>
  140. {% block sonata_top_nav_menu %}
  141. <div class="navbar-custom-menu">
  142. <ul class="nav navbar-nav">
  143. {% block sonata_top_nav_menu_add_block %}
  144. {% set addBlock = include(get_global_template('add_block')) %}
  145. {% if addBlock|spaceless is not empty %}
  146. <li class="dropdown">
  147. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  148. <i class="fas fa-plus-square fa-fw" aria-hidden="true"></i> <i class="fas fa-caret-down" aria-hidden="true"></i>
  149. </a>
  150. {{ addBlock|raw }}
  151. </li>
  152. {% endif %}
  153. {% endblock %}
  154. {% if app.user %}
  155. {% block sonata_top_nav_menu_user_block %}
  156. {% set userBlock = include(get_global_template('user_block')) %}
  157. {% if userBlock|spaceless is not empty %}
  158. <li class="dropdown user-menu">
  159. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  160. <i class="fas fa-user fa-fw" aria-hidden="true"></i> <i class="fas fa-caret-down" aria-hidden="true"></i>
  161. </a>
  162. <ul class="dropdown-menu dropdown-user">
  163. {{ userBlock|raw }}
  164. </ul>
  165. </li>
  166. {% endif %}
  167. {% endblock %}
  168. {% endif %}
  169. </ul>
  170. </div>
  171. {% endblock %}
  172. </nav>
  173. {% endblock sonata_nav %}
  174. </header>
  175. {% endblock sonata_header %}
  176. {% block sonata_wrapper %}
  177. {% block sonata_left_side %}
  178. <aside class="main-sidebar">
  179. <section class="sidebar">
  180. {% block sonata_side_nav %}
  181. {% block sonata_sidebar_search %}
  182. {% if sonata_config.getOption('search') %}
  183. <form action="{{ path('sonata_admin_search') }}" method="GET" class="sidebar-form" role="search">
  184. <div class="input-group custom-search-form">
  185. <input type="text" name="q" value="{{ app.request.get('q') }}" class="form-control" placeholder="{{ 'search_placeholder'|trans({}, 'SonataAdminBundle') }}">
  186. <span class="input-group-btn">
  187. <button class="btn btn-flat" type="submit">
  188. <i class="fas fa-search" aria-hidden="true"></i>
  189. </button>
  190. </span>
  191. </div>
  192. </form>
  193. {% endif %}
  194. {% endblock sonata_sidebar_search %}
  195. {% block side_bar_before_nav %} {% endblock %}
  196. {% block side_bar_nav %}
  197. {{ knp_menu_render('sonata_admin_sidebar', {template: get_global_template('knp_menu_template')}) }}
  198. {% endblock side_bar_nav %}
  199. {% block side_bar_after_nav %}
  200. <p class="text-center small" style="border-top: 1px solid #444444; padding-top: 10px">
  201. {% block side_bar_after_nav_content %}
  202. {% endblock %}
  203. </p>
  204. {% endblock %}
  205. {% endblock sonata_side_nav %}
  206. </section>
  207. </aside>
  208. {% endblock sonata_left_side %}
  209. <div class="content-wrapper">
  210. {% block sonata_page_content %}
  211. <section class="content-header">
  212. {% block sonata_page_content_header %}
  213. {% block sonata_page_content_nav %}
  214. {% if _navbar_title is not empty
  215. or _tab_menu is not empty
  216. or _actions is not empty
  217. or _list_filters_actions is not empty
  218. %}
  219. <nav class="navbar navbar-default" role="navigation">
  220. <div class="container-fluid">
  221. {% block tab_menu_navbar_header %}
  222. {% if _navbar_title is not empty %}
  223. <div class="navbar-header">
  224. <a class="navbar-brand" href="#">{{ _navbar_title|raw }}</a>
  225. </div>
  226. {% endif %}
  227. {% endblock %}
  228. <div class="navbar-collapse">
  229. {% if _tab_menu is not empty %}
  230. <div class="navbar-left">
  231. {{ _tab_menu|raw }}
  232. </div>
  233. {% endif %}
  234. {% if admin is defined and action is defined and action == 'list' and admin.listModes|length > 1 %}
  235. <div class="nav navbar-right btn-group">
  236. {% for mode, settings in admin.listModes %}
  237. <a href="{{ admin.generateUrl('list', app.request.query.all|merge({_list_mode: mode})) }}" class="btn btn-default navbar-btn btn-sm{% if admin.getListMode() == mode %} active{% endif %}">
  238. {# NEXT_MAJOR: Remove the if and keep the else part #}
  239. {% if settings.icon is not defined and settings.class is defined %}
  240. {% deprecated 'Relying on the "class" setting is deprecated since sonata-project/admin-bundle 4.9, use the "icon" setting instead' %}
  241. <i class="{{ settings.class }}" aria-hidden="true"></i>
  242. {% else %}
  243. {{ settings.icon|default('')|parse_icon }}
  244. {% endif %}
  245. </a>
  246. {% endfor %}
  247. </div>
  248. {% endif %}
  249. {% block sonata_admin_content_actions_wrappers %}
  250. {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
  251. <ul class="nav navbar-nav navbar-right">
  252. {% if _actions|split('</a>')|length > 2 %}
  253. <li class="dropdown sonata-actions">
  254. <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>
  255. <ul class="dropdown-menu" role="menu">
  256. {{ _actions|raw }}
  257. </ul>
  258. </li>
  259. {% else %}
  260. {{ _actions|raw }}
  261. {% endif %}
  262. </ul>
  263. {% endif %}
  264. {% endblock sonata_admin_content_actions_wrappers %}
  265. {% if _list_filters_actions is not empty %}
  266. {{ _list_filters_actions|raw }}
  267. {% endif %}
  268. </div>
  269. </div>
  270. </nav>
  271. {% endif %}
  272. {% endblock sonata_page_content_nav %}
  273. {% endblock sonata_page_content_header %}
  274. </section>
  275. <section class="content">
  276. {% block sonata_admin_content %}
  277. {% block notice %}
  278. {% include '@SonataTwig/FlashMessage/render.html.twig' %}
  279. {% endblock notice %}
  280. {% if _preview is not empty %}
  281. <div class="sonata-ba-preview">{{ _preview|raw }}</div>
  282. {% endif %}
  283. {% if _content is not empty %}
  284. <div class="sonata-ba-content">{{ _content|raw }}</div>
  285. {% endif %}
  286. {% if _show is not empty %}
  287. <div class="sonata-ba-show">{{ _show|raw }}</div>
  288. {% endif %}
  289. {% if _form is not empty %}
  290. <div class="sonata-ba-form">{{ _form|raw }}</div>
  291. {% endif %}
  292. {% if _list_filters is not empty %}
  293. <div class="row">
  294. {{ _list_filters|raw }}
  295. </div>
  296. {% endif %}
  297. {% if _list_table is not empty %}
  298. <div class="row">
  299. {{ _list_table|raw }}
  300. </div>
  301. {% endif %}
  302. {% endblock sonata_admin_content %}
  303. </section>
  304. {% endblock sonata_page_content %}
  305. </div>
  306. {% endblock sonata_wrapper %}
  307. </div>
  308. {% if sonata_config.getOption('use_bootlint') %}
  309. {% block bootlint %}
  310. {# Bootlint - https://github.com/twbs/bootlint#in-the-browser #}
  311. <script type="text/javascript">
  312. javascript:(function(){var s=document.createElement("script");s.onload=function(){bootlint.showLintReportForCurrentDocument([], {hasProblems: false, problemFree: false});};s.src="https://maxcdn.bootstrapcdn.com/bootlint/latest/bootlint.min.js";document.body.appendChild(s)})();
  313. </script>
  314. {% endblock %}
  315. {% endif %}
  316. </body>
  317. </html>