standard_layout.html.twig 18 KB

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