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