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.

338 lines
18 KiB

  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. {# localize moment #}
  58. {% set localeForMoment = canonicalize_locale_for_moment() %}
  59. {% if localeForMoment %}
  60. <script src="{{ asset('bundles/sonataadmin/moment-locale/' ~ localeForMoment ~ '.js') }}"></script>
  61. {% endif %}
  62. {# localize select2 #}
  63. {% if sonata_config.getOption('use_select2') %}
  64. {% set localeForSelect2 = canonicalize_locale_for_select2() %}
  65. {% if localeForSelect2 %}
  66. <script src="{{ asset('bundles/sonataadmin/select2-locale/' ~ localeForSelect2 ~ '.js') }}"></script>
  67. {% endif %}
  68. {% endif %}
  69. {% endblock %}
  70. <title>
  71. {% block sonata_head_title %}
  72. {{ 'Admin'|trans({}, 'SonataAdminBundle') }}
  73. {% if _title is not empty %}
  74. {{ _title|striptags|raw }}
  75. {% else %}
  76. {% if action is defined %}
  77. -
  78. {{ render_breadcrumbs_for_title(admin, action) }}
  79. {% endif %}
  80. {% endif %}
  81. {% endblock %}
  82. </title>
  83. </head>
  84. <body
  85. {% block body_attributes -%}
  86. class="sonata-bc {% block admin_lte_skin_class %}{{ _skin }}{% endblock %} fixed
  87. {% if _use_select2 %}sonata-select2{% endif %}
  88. {% if _use_icheck %}sonata-icheck{% endif %}
  89. {% if app.request.cookies.get('sonata_sidebar_hide') -%}
  90. sidebar-collapse
  91. {%- endif -%}"
  92. {%- endblock -%}
  93. >
  94. <div class="wrapper">
  95. {% block sonata_header %}
  96. <header class="main-header">
  97. {% block sonata_header_noscript_warning %}
  98. <noscript>
  99. <div class="noscript-warning">
  100. {{ 'noscript_warning'|trans({}, 'SonataAdminBundle') }}
  101. </div>
  102. </noscript>
  103. {% endblock %}
  104. {% block logo %}
  105. {% apply spaceless %}
  106. <a class="logo" href="{{ path('sonata_admin_dashboard') }}">
  107. {% if 'single_image' == sonata_config.getOption('title_mode') or 'both' == sonata_config.getOption('title_mode') %}
  108. <img src="{{ asset(sonata_config.logo) }}" alt="{{ sonata_config.title }}">
  109. {% endif %}
  110. {% if 'single_text' == sonata_config.getOption('title_mode') or 'both' == sonata_config.getOption('title_mode') %}
  111. <span>{{ sonata_config.title }}</span>
  112. {% endif %}
  113. </a>
  114. {% endapply %}
  115. {% endblock %}
  116. {% block sonata_nav %}
  117. <nav class="navbar navbar-static-top">
  118. <a href="#" class="sidebar-toggle fa5" data-toggle="push-menu"
  119. role="button" title="{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}">
  120. <span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span>
  121. </a>
  122. <div class="navbar-left">
  123. {% block sonata_breadcrumb %}
  124. <div class="hidden-xs">
  125. {% if _breadcrumb is not empty or action is defined %}
  126. <ol class="nav navbar-top-links breadcrumb">
  127. {% if _breadcrumb is empty %}
  128. {% if action is defined %}
  129. {{ render_breadcrumbs(admin, action) }}
  130. {% endif %}
  131. {% else %}
  132. {{ _breadcrumb|raw }}
  133. {% endif %}
  134. </ol>
  135. {% endif %}
  136. </div>
  137. {% endblock sonata_breadcrumb %}
  138. </div>
  139. {% block sonata_top_nav_menu %}
  140. {% if app.user and is_granted(sonata_config.getOption('role_admin')) %}
  141. <div class="navbar-custom-menu">
  142. <ul class="nav navbar-nav">
  143. {% block sonata_top_nav_menu_add_block %}
  144. <li class="dropdown">
  145. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  146. <i class="fas fa-plus-square fa-fw" aria-hidden="true"></i> <i class="fas fa-caret-down" aria-hidden="true"></i>
  147. </a>
  148. {% include get_global_template('add_block') %}
  149. </li>
  150. {% endblock %}
  151. {% block sonata_top_nav_menu_user_block %}
  152. <li class="dropdown user-menu">
  153. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  154. <i class="fas fa-user fa-fw" aria-hidden="true"></i> <i class="fas fa-caret-down" aria-hidden="true"></i>
  155. </a>
  156. <ul class="dropdown-menu dropdown-user">
  157. {% include get_global_template('user_block') %}
  158. </ul>
  159. </li>
  160. {% endblock %}
  161. </ul>
  162. </div>
  163. {% endif %}
  164. {% endblock %}
  165. </nav>
  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 sonata_config.getOption('search') %}
  176. <form action="{{ path('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="fas fa-search" aria-hidden="true"></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. {{ knp_menu_render('sonata_admin_sidebar', {template: get_global_template('knp_menu_template')}) }}
  191. {% endblock side_bar_nav %}
  192. {% block side_bar_after_nav %}
  193. <p class="text-center small" style="border-top: 1px solid #444444; padding-top: 10px">
  194. {% block side_bar_after_nav_content %}
  195. {% endblock %}
  196. </p>
  197. {% endblock %}
  198. {% endblock sonata_side_nav %}
  199. </section>
  200. </aside>
  201. {% endblock sonata_left_side %}
  202. <div class="content-wrapper">
  203. {% block sonata_page_content %}
  204. <section class="content-header">
  205. {% block sonata_page_content_header %}
  206. {% block sonata_page_content_nav %}
  207. {% if _navbar_title is not empty
  208. or _tab_menu is not empty
  209. or _actions is not empty
  210. or _list_filters_actions is not empty
  211. %}
  212. <nav class="navbar navbar-default" role="navigation">
  213. <div class="container-fluid">
  214. {% block tab_menu_navbar_header %}
  215. {% if _navbar_title is not empty %}
  216. <div class="navbar-header">
  217. <a class="navbar-brand" href="#">{{ _navbar_title|raw }}</a>
  218. </div>
  219. {% endif %}
  220. {% endblock %}
  221. <div class="navbar-collapse">
  222. {% if _tab_menu is not empty %}
  223. <div class="navbar-left">
  224. {{ _tab_menu|raw }}
  225. </div>
  226. {% endif %}
  227. {% if admin is defined and action is defined and action == 'list' and admin.listModes|length > 1 %}
  228. <div class="nav navbar-right btn-group">
  229. {% for mode, settings in admin.listModes %}
  230. <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>
  231. {% endfor %}
  232. </div>
  233. {% endif %}
  234. {% block sonata_admin_content_actions_wrappers %}
  235. {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
  236. <ul class="nav navbar-nav navbar-right">
  237. {% if _actions|split('</a>')|length > 2 %}
  238. <li class="dropdown sonata-actions">
  239. <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>
  240. <ul class="dropdown-menu" role="menu">
  241. {{ _actions|raw }}
  242. </ul>
  243. </li>
  244. {% else %}
  245. {{ _actions|raw }}
  246. {% endif %}
  247. </ul>
  248. {% endif %}
  249. {% endblock sonata_admin_content_actions_wrappers %}
  250. {% if _list_filters_actions is not empty %}
  251. {{ _list_filters_actions|raw }}
  252. {% endif %}
  253. </div>
  254. </div>
  255. </nav>
  256. {% endif %}
  257. {% endblock sonata_page_content_nav %}
  258. {% endblock sonata_page_content_header %}
  259. </section>
  260. <section class="content">
  261. {% block sonata_admin_content %}
  262. {% block notice %}
  263. {% include '@SonataTwig/FlashMessage/render.html.twig' %}
  264. {% endblock notice %}
  265. {% if _preview is not empty %}
  266. <div class="sonata-ba-preview">{{ _preview|raw }}</div>
  267. {% endif %}
  268. {% if _content is not empty %}
  269. <div class="sonata-ba-content">{{ _content|raw }}</div>
  270. {% endif %}
  271. {% if _show is not empty %}
  272. <div class="sonata-ba-show">{{ _show|raw }}</div>
  273. {% endif %}
  274. {% if _form is not empty %}
  275. <div class="sonata-ba-form">{{ _form|raw }}</div>
  276. {% endif %}
  277. {% if _list_filters is not empty %}
  278. <div class="row">
  279. {{ _list_filters|raw }}
  280. </div>
  281. {% endif %}
  282. {% if _list_table is not empty %}
  283. <div class="row">
  284. {{ _list_table|raw }}
  285. </div>
  286. {% endif %}
  287. {% endblock sonata_admin_content %}
  288. </section>
  289. {% endblock sonata_page_content %}
  290. </div>
  291. {% endblock sonata_wrapper %}
  292. </div>
  293. {% if sonata_config.getOption('use_bootlint') %}
  294. {% block bootlint %}
  295. {# Bootlint - https://github.com/twbs/bootlint#in-the-browser #}
  296. <script type="text/javascript">
  297. 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)})();
  298. </script>
  299. {% endblock %}
  300. {% endif %}
  301. </body>
  302. </html>