standard_layout.html.twig 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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. <!DOCTYPE html>
  20. <html {% block html_attributes %}class="no-js"{% endblock %}>
  21. <head>
  22. {% block meta_tags %}
  23. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  24. <meta charset="UTF-8">
  25. <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
  26. {% endblock %}
  27. {% block stylesheets %}
  28. {% for stylesheet in sonata_admin.adminPool.getOption('stylesheets', []) %}
  29. <link rel="stylesheet" href="{{ asset(stylesheet) }}">
  30. {% endfor %}
  31. {% endblock %}
  32. {% block javascripts %}
  33. {% block sonata_javascript_config %}
  34. <script>
  35. window.SONATA_CONFIG = {
  36. CONFIRM_EXIT: {% if sonata_admin.adminPool.getOption('confirm_exit') %}true{% else %}false{% endif %},
  37. USE_SELECT2: {% if sonata_admin.adminPool.getOption('use_select2') %}true{% else %}false{% endif %},
  38. USE_ICHECK: {% if sonata_admin.adminPool.getOption('use_icheck') %}true{% else %}false{% endif %},
  39. USE_STICKYFORMS: {% if sonata_admin.adminPool.getOption('use_stickyforms') %}true{% else %}false{% endif %}
  40. };
  41. window.SONATA_TRANSLATIONS = {
  42. CONFIRM_EXIT: '{{ 'confirm_exit'|trans({}, 'SonataAdminBundle')|escape('js') }}'
  43. };
  44. // http://getbootstrap.com/getting-started/#support-ie10-width
  45. if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
  46. var msViewportStyle = document.createElement('style');
  47. msViewportStyle.appendChild(document.createTextNode('@-ms-viewport{width:auto!important}'));
  48. document.querySelector('head').appendChild(msViewportStyle);
  49. }
  50. </script>
  51. {% endblock %}
  52. {% block sonata_javascript_pool %}
  53. {% for javascript in sonata_admin.adminPool.getOption('javascripts', []) %}
  54. <script src="{{ asset(javascript) }}"></script>
  55. {% endfor %}
  56. {% endblock %}
  57. {% set locale = app.request.locale %}
  58. {# localize moment #}
  59. {% if locale[:2] != 'en' %}
  60. <script src="{{ asset(
  61. 'bundles/sonatacore/vendor/moment/locale/' ~
  62. locale|lower|replace({'_':'-'}) ~
  63. '.js'
  64. ) }}"></script>
  65. {% endif %}
  66. {# localize select2 #}
  67. {% if sonata_admin.adminPool.getOption('use_select2') %}
  68. {% if locale == 'pt' %}{% set locale = 'pt_PT' %}{% endif %}
  69. {# omit default EN locale #}
  70. {% if locale[:2] != 'en' %}
  71. <script src="{{ asset('bundles/sonatacore/vendor/select2/select2_locale_' ~ locale|replace({'_':'-'}) ~ '.js') }}"></script>
  72. {% endif %}
  73. {% endif %}
  74. {% endblock %}
  75. <title>
  76. {% block sonata_head_title %}
  77. {{ 'Admin'|trans({}, 'SonataAdminBundle') }}
  78. {% if _title is not empty %}
  79. {{ _title|striptags|raw }}
  80. {% else %}
  81. {% if action is defined %}
  82. -
  83. {% for menu in breadcrumbs_builder.breadcrumbs(admin, action) %}
  84. {% if not loop.first %}
  85. {% if loop.index != 2 %}
  86. &gt;
  87. {% endif %}
  88. {%- set translation_domain = menu.extra('translation_domain', 'messages') -%}
  89. {%- set label = menu.label -%}
  90. {%- if translation_domain is not same as(false) -%}
  91. {%- set label = label|trans(menu.extra('translation_params', {}), translation_domain) -%}
  92. {%- endif -%}
  93. {{ label }}
  94. {% endif %}
  95. {% endfor %}
  96. {% endif %}
  97. {% endif %}
  98. {% endblock %}
  99. </title>
  100. </head>
  101. <body {% block body_attributes %}class="sonata-bc skin-black fixed"{% endblock %}>
  102. <div class="wrapper">
  103. {% block sonata_header %}
  104. <header class="main-header">
  105. {% block sonata_header_noscript_warning %}
  106. <noscript>
  107. <div class="noscript-warning">
  108. {{ 'noscript_warning'|trans({}, 'SonataAdminBundle') }}
  109. </div>
  110. </noscript>
  111. {% endblock %}
  112. {% block logo %}
  113. {% spaceless %}
  114. <a class="logo" href="{{ path('sonata_admin_dashboard') }}">
  115. {% if 'single_image' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %}
  116. <img src="{{ asset(sonata_admin.adminPool.titlelogo) }}" alt="{{ sonata_admin.adminPool.title }}">
  117. {% endif %}
  118. {% if 'single_text' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %}
  119. <span>{{ sonata_admin.adminPool.title }}</span>
  120. {% endif %}
  121. </a>
  122. {% endspaceless %}
  123. {% endblock %}
  124. {% block sonata_nav %}
  125. <nav class="navbar navbar-static-top" role="navigation">
  126. <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
  127. <span class="sr-only">Toggle navigation</span>
  128. </a>
  129. <div class="navbar-left">
  130. {% block sonata_breadcrumb %}
  131. <div class="hidden-xs">
  132. {% if _breadcrumb is not empty or action is defined %}
  133. <ol class="nav navbar-top-links breadcrumb">
  134. {% if _breadcrumb is empty %}
  135. {% if action is defined %}
  136. {% for menu in breadcrumbs_builder.breadcrumbs(admin, action) %}
  137. {%- set translation_domain = menu.extra('translation_domain', 'messages') -%}
  138. {%- set label = menu.label -%}
  139. {%- if translation_domain is not same as(false) -%}
  140. {%- set label = label|trans(menu.extra('translation_params', {}), translation_domain) -%}
  141. {%- endif -%}
  142. {% if not loop.last %}
  143. <li>
  144. {% if menu.uri is not empty %}
  145. <a href="{{ menu.uri }}">
  146. {% if menu.extra('safe_label', true) %}
  147. {{- label|raw -}}
  148. {% else %}
  149. {{- label -}}
  150. {% endif %}
  151. </a>
  152. {% else %}
  153. <span>{{ label }}</span>
  154. {% endif %}
  155. </li>
  156. {% else %}
  157. <li class="active"><span>{{ label }}</span></li>
  158. {% endif %}
  159. {% endfor %}
  160. {% endif %}
  161. {% else %}
  162. {{ _breadcrumb|raw }}
  163. {% endif %}
  164. </ol>
  165. {% endif %}
  166. </div>
  167. {% endblock sonata_breadcrumb %}
  168. </div>
  169. {% block sonata_top_nav_menu %}
  170. {% if app.user and is_granted('ROLE_SONATA_ADMIN') %}
  171. <div class="navbar-custom-menu">
  172. <ul class="nav navbar-nav">
  173. {% block sonata_top_nav_menu_add_block %}
  174. <li class="dropdown">
  175. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  176. <i class="fa fa-plus-square fa-fw" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
  177. </a>
  178. {% include sonata_admin.adminPool.getTemplate('add_block') %}
  179. </li>
  180. {% endblock %}
  181. {% block sonata_top_nav_menu_user_block %}
  182. <li class="dropdown user-menu">
  183. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  184. <i class="fa fa-user fa-fw" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
  185. </a>
  186. <ul class="dropdown-menu dropdown-user">
  187. {% include sonata_admin.adminPool.getTemplate('user_block') %}
  188. </ul>
  189. </li>
  190. {% endblock %}
  191. </ul>
  192. </div>
  193. {% endif %}
  194. {% endblock %}
  195. </nav>
  196. {% endblock sonata_nav %}
  197. </header>
  198. {% endblock sonata_header %}
  199. {% block sonata_wrapper %}
  200. {% block sonata_left_side %}
  201. <aside class="main-sidebar">
  202. <section class="sidebar">
  203. {% block sonata_side_nav %}
  204. {% block sonata_sidebar_search %}
  205. <form action="{{ path('sonata_admin_search') }}" method="GET" class="sidebar-form" role="search">
  206. <div class="input-group custom-search-form">
  207. <input type="text" name="q" value="{{ app.request.get('q') }}" class="form-control" placeholder="{{ 'search_placeholder'|trans({}, 'SonataAdminBundle') }}">
  208. <span class="input-group-btn">
  209. <button class="btn btn-flat" type="submit">
  210. <i class="fa fa-search" aria-hidden="true"></i>
  211. </button>
  212. </span>
  213. </div>
  214. </form>
  215. {% endblock sonata_sidebar_search %}
  216. {% block side_bar_before_nav %} {% endblock %}
  217. {% block side_bar_nav %}
  218. {{ knp_menu_render('sonata_admin_sidebar', {template: sonata_admin.adminPool.getTemplate('knp_menu_template')}) }}
  219. {% endblock side_bar_nav %}
  220. {% block side_bar_after_nav %}
  221. <p class="text-center small" style="border-top: 1px solid #444444; padding-top: 10px">
  222. {% block side_bar_after_nav_content %}
  223. <a href="https://sonata-project.org" rel="noreferrer" target="_blank">sonata project</a>
  224. {% endblock %}
  225. </p>
  226. {% endblock %}
  227. {% endblock sonata_side_nav %}
  228. </section>
  229. </aside>
  230. {% endblock sonata_left_side %}
  231. <div class="content-wrapper">
  232. {% block sonata_page_content %}
  233. <section class="content-header">
  234. {% block sonata_page_content_header %}
  235. {% block sonata_page_content_nav %}
  236. {% if _tab_menu is not empty or _actions is not empty or _list_filters_actions is not empty %}
  237. <nav class="navbar navbar-default" role="navigation">
  238. <div class="container-fluid">
  239. {% block tab_menu_navbar_header %}
  240. {% if _navbar_title is not empty %}
  241. <div class="navbar-header">
  242. <a class="navbar-brand" href="#">{{ _navbar_title|raw }}</a>
  243. </div>
  244. {% endif %}
  245. {% endblock %}
  246. <div class="navbar-collapse">
  247. {% if _tab_menu is not empty %}
  248. <div class="navbar-left">
  249. {{ _tab_menu|raw }}
  250. </div>
  251. {% endif %}
  252. {% if admin is defined and action is defined and action == 'list' and admin.listModes|length > 1 %}
  253. <div class="nav navbar-right btn-group">
  254. {% for mode, settings in admin.listModes %}
  255. <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 %}"><i class="{{ settings.class }}"></i></a>
  256. {% endfor %}
  257. </div>
  258. {% endif %}
  259. {% block sonata_admin_content_actions_wrappers %}
  260. {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
  261. <ul class="nav navbar-nav navbar-right">
  262. {% if _actions|split('</a>')|length > 2 %}
  263. <li class="dropdown sonata-actions">
  264. <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>
  265. <ul class="dropdown-menu" role="menu">
  266. {{ _actions|raw }}
  267. </ul>
  268. </li>
  269. {% else %}
  270. {{ _actions|raw }}
  271. {% endif %}
  272. </ul>
  273. {% endif %}
  274. {% endblock sonata_admin_content_actions_wrappers %}
  275. {% if _list_filters_actions is not empty %}
  276. {{ _list_filters_actions|raw }}
  277. {% endif %}
  278. </div>
  279. </div>
  280. </nav>
  281. {% endif %}
  282. {% endblock sonata_page_content_nav %}
  283. {% endblock sonata_page_content_header %}
  284. </section>
  285. <section class="content">
  286. {% block sonata_admin_content %}
  287. {% block notice %}
  288. {% include 'SonataCoreBundle:FlashMessage:render.html.twig' %}
  289. {% endblock notice %}
  290. {% if _preview is not empty %}
  291. <div class="sonata-ba-preview">{{ _preview|raw }}</div>
  292. {% endif %}
  293. {% if _content is not empty %}
  294. <div class="sonata-ba-content">{{ _content|raw }}</div>
  295. {% endif %}
  296. {% if _show is not empty %}
  297. <div class="sonata-ba-show">{{ _show|raw }}</div>
  298. {% endif %}
  299. {% if _form is not empty %}
  300. <div class="sonata-ba-form">{{ _form|raw }}</div>
  301. {% endif %}
  302. {% if _list_filters is not empty %}
  303. <div class="row">
  304. {{ _list_filters|raw }}
  305. </div>
  306. {% endif %}
  307. {% if _list_table is not empty %}
  308. <div class="row">
  309. {{ _list_table|raw }}
  310. </div>
  311. {% endif %}
  312. {% endblock sonata_admin_content %}
  313. </section>
  314. {% endblock sonata_page_content %}
  315. </div>
  316. {% endblock sonata_wrapper %}
  317. </div>
  318. {% if sonata_admin.adminPool.getOption('use_bootlint') %}
  319. {% block bootlint %}
  320. {# Bootlint - https://github.com/twbs/bootlint#in-the-browser #}
  321. <script type="text/javascript">
  322. 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)})();
  323. </script>
  324. {% endblock %}
  325. {% endif %}
  326. </body>
  327. </html>