vendor/eckinox/admin-ui-bundle/templates/base.html.twig line 1

Open in your IDE?
  1. {%- if app.user.preferedColorScheme|default('auto') == 'auto' -%}
  2.     {% set preferred_color_scheme = "auto" %}
  3. {%- elseif app.user.preferedColorScheme == 'dark' -%}
  4.     {% set preferred_color_scheme = "dark" %}
  5. {%- else -%}
  6.     {% set preferred_color_scheme = "light" %}
  7. {%- endif -%}
  8. <!DOCTYPE html>
  9. <html lang="{{ app.request.locale|replace({'_': '-'}) }}" data-color-scheme="{{ preferred_color_scheme }}">
  10.     <head>
  11.         <title>{% block title %}{{ ('titles.' ~ app.request.get('_route'))|trans }}{% endblock %} - {{ 'eckinox_admin_ui.app.name'|trans }}</title>
  12.         {% include '@EckinoxAdminUi/base/_head.html.twig' %}
  13.         {% block head %}{% endblock %}
  14.         {{ generate_stacked_css() }}
  15.         {% block stylesheets %}{% endblock %}
  16.         {%- if preferred_color_scheme == "auto" -%}
  17.             <script type="module">
  18.                 const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
  19.                 document.documentElement.setAttribute("data-color-scheme", prefersDark ? "dark" : "light");
  20.                 
  21.                 window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
  22.                     document.documentElement.setAttribute("data-color-scheme", event.matches ? "dark" : "light");
  23.                 });
  24.             </script>
  25.         {%- endif -%}
  26.     </head>
  27.     <body data-theme="default" data-layout="fluid" data-sidebar-position="left" data-sidebar-behavior="sticky">
  28.         {% block body %}
  29.             {% set is_app_user = (app.user is defined ? (app.user is instance_of('App\\Entity\\Security\\AppUser') ? true : false) : false) %}
  30.             <div class="wrapper">
  31.                 {% include '@EckinoxAdminUi/base/_sidebar.html.twig' with {'is_app_user' : is_app_user } %}
  32.                 <div class="main">
  33.                     {% include '@EckinoxAdminUi/base/_navbar.html.twig' with {'is_app_user' : is_app_user } %}
  34.                     <main class="content">
  35.                         {% block body_content %}
  36.                             <div class="container-fluid p-0">
  37.                                 <div class="actions float-end mt-n1">
  38.                                     {% block actions %}{% endblock %}
  39.                                 </div>
  40.                                 <h1 class="h3 mb-3">
  41.                                     {% block page_name %}{{ block('title') }}{% endblock %}
  42.                                 </h1>
  43.                                 {% block content %}
  44.                                     <div class="row">
  45.                                         <div class="col-12">
  46.                                             <div class="card">
  47.                                                 <div class="card-header">
  48.                                                     <h5 class="card-title mb-0">Section name</h5>
  49.                                                 </div>
  50.                                                 <div class="card-body">
  51.                                                     <p>Section content</p>
  52.                                                 </div>
  53.                                             </div>
  54.                                         </div>
  55.                                     </div>
  56.                                 {% endblock %}
  57.                             </div>
  58.                         {% endblock %}
  59.                     </main>
  60.                     {% include '@EckinoxAdminUi/base/_footer.html.twig' %}
  61.                 </div>
  62.             </div>
  63.         {% endblock %}
  64.         {# FOSJsRoutingBundle #}
  65.         <script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
  66.         <script src="{{ path('fos_js_routing_js', {callback: 'fos.Router.setData'}) }}"></script>
  67.         {# BazingaJsTranslationBundle #}
  68.         {% if app.user and is_granted('IS_AUTHENTICATED_REMEMBERED') %}
  69.             {% set locales = [app.request.locale] %}
  70.             {% if '_' in app.request.locale %}
  71.                 {% set locales = locales|merge([app.request.locale|split('_')|first]) %}
  72.             {% endif %}
  73.             <script src="{{ asset('bundles/bazingajstranslation/js/translator.min.js') }}"></script>
  74.             <script src="{{ url('bazinga_jstranslation_js', {'locales': locales|join(',')}) }}"></script>
  75.             <script>Translator.locale = '{{ app.request.locale }}';</script>
  76.         {% endif %}
  77.         {# JQuery #}
  78.         <script src="{{ asset('bundles/eckinoxadminui/js/library/jquery.min.js') }}"></script>
  79.         {# DropZone #}
  80.         <script src="{{ asset('bundles/eckinoxadminui/js/library/dropzone-amd-module.min.js') }}"></script>
  81.         {# Bootstrap AdminUI Modules #}
  82.         <script src="{{ asset('bundles/eckinoxadminui/js/app.js') }}"></script>
  83.         {# Bootstrap multiselect #}
  84.         <script src="{{ asset('bundles/eckinoxadminui/js/modules/bootstrap-multiselect.min.js') }}"></script>
  85.         <script src="{{ asset('bundles/eckinoxadminui/js/form.js') }}"></script>
  86.         {# Tab consistency #}
  87.         <script src="{{ asset('bundles/eckinoxadminui/js/tabs.js') }}" type="module"></script>
  88.         {# Widgets #}
  89.         <script src="{{ asset('bundles/eckinoxadminui/js/widgets/list.js') }}"></script>
  90.         <script src="{{ asset('bundles/eckinoxadminui/js/widgets/collection.js') }}"></script>
  91.         <script src="{{ asset('bundles/eckinoxadminui/js/library/dom.js') }}"></script>
  92.         <script src="{{ asset('bundles/eckinoxadminui/js/widgets/confirm.js') }}"></script>
  93.         <script src="{{ asset('bundles/eckinoxadminui/js/widgets/datatable.js') }}"></script>
  94.         <script src="{{ asset('bundles/eckinoxadminui/js/widgets/dropzone.js') }}"></script>
  95.         <script src="{{ asset('bundles/eckinoxadminui/js/widgets/modal.js') }}"></script>
  96.         <script src="{{ asset('bundles/eckinoxadminui/js/widgets/form-validate.js') }}"></script>
  97.         <script src="{{ asset('bundles/eckinoxadminui/js/modules/form-validate/additional-methods.js') }}"></script>
  98.         {% if 'fr' in app.request.locale %}
  99.             <script src="{{ asset('bundles/eckinoxadminui/js/modules/form-validate/language-fr.js') }}"></script>
  100.         {% endif %}
  101.         <script src="{{ asset('bundles/eckinoxadminui/js/main.js') }}"></script>
  102.         <script>
  103.             // Notyf
  104.             document.addEventListener("DOMContentLoaded", function() {
  105.                 {% for type, flashes in app.session.flashbag.all %}
  106.                     {% for flash in flashes %}
  107.                         {% if flash is iterable %}
  108.                             window.notyf.open({{ flash|json_encode()|raw }});
  109.                         {% else %}
  110.                         window.notyf.open({
  111.                             type: '{{ type }}',
  112.                             message: "{{ flash }}",
  113.                             duration: 10000,
  114.                             ripple: true,
  115.                             dismissible: true,
  116.                             position: {
  117.                                 x: 'right',
  118.                                 y: 'top'
  119.                             }
  120.                         });
  121.                         {% endif %}
  122.                     {% endfor %}
  123.                 {% endfor %}
  124.             });
  125.         </script>
  126.         {{ generate_stacked_js() }}
  127.         {% block javascripts %}{% endblock %}
  128.     </body>
  129. </html>