Files
core/templates/_base/layout.html.twig
T
2019-11-04 14:44:11 +01:00

127 lines
4.2 KiB
Twig
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{# Check if aside has value and set hasAside variable #}
{% set hasAside = block('aside')|trim is not empty ? true : false %}
<!DOCTYPE html>
<html {% if block('html_id') %}id="{% block html_id %}{% endblock %}"{% endif %}>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ block('title')|striptags }}</title>
{% block stylesheets %}
{% set theme = 'theme-' ~ app.user.backendTheme|default('default') %}
{{ encore_entry_link_tags('bolt') }}
{{ encore_entry_link_tags(theme) }}
{% endblock %}
{{ include('_partials/favicon.html.twig') }}
</head>
<body>
<div class="admin">
{% set admin_menu_json = admin_menu()|json_encode %}
<!-- Admin Toolbar -->
<nav class="admin__toolbar" id="toolbar">
{% set user_display_name = app.user.displayName|default('Unknown user') %}
{# Setting the labels and their localisations that are used in the sidebar-menu. #}
{% set labels = {
'about.bolt_documentation': 'about.bolt_documentation'|trans,
'action.view_site': 'action.view'|trans ~ ' website',
'action.create_new': 'action.create_new'|trans,
'general.greeting': 'general.greeting'|trans({'%name%': user_display_name}),
'action.logout': 'action.logout'|trans,
'action.edit_profile': 'action.edit_profile'|trans,
'about.visit_bolt': 'about.visit_bolt'|trans
}|json_encode %}
<admin-toolbar
site-name="{{ config.get('general/sitename') }}"
:menu="{{ admin_menu_json }}"
:labels="{{ labels }}"
:backend-prefix="{{ path('bolt_dashboard') }}"
></admin-toolbar>
</nav>
<!-- End Admin Toolbar -->
<!-- Admin Header -->
<header class="admin__header">
<div class="admin__header--topbar">
<h1 class="admin__header--title">
{% if block('shoulder') %}
<span class="admin__header--title__prefix">
{% block shoulder %}{% endblock shoulder %} »
</span>
{% endif %}
{{ block('title') }}
</h1>
<button class="admin-sidebar-toggler btn btn-md">
<span class="admin-sidebar-toggler_icon"></span>{{ 'admin_sidebar_toggler.toggle'|trans|raw }}
</button>
</div>
</header>
<!-- End Admin Header -->
<!-- Admin Sidebar -->
<div class="admin__sidebar">
<div class="sidebar sidebar--sticky" id="sidebar">
<admin-sidebar
:menu="{{ admin_menu_json }}"
:version="'{{ constant('Bolt\\Version::VERSION')|replace({'alpha': 'α', 'beta': 'β'}) }}'"
:about-link="{{ path('bolt_about')|json_encode }}"
:labels="{{ { 'toggler': 'admin_sidebar.toggler'|trans }|json_encode }}"
></admin-sidebar >
</div>
</div>
<!-- End Admin Sidebar -->
<!-- Admin Main -->
<div class="admin__body">
{% block topsection %}
{# insert stuff here that should _not_ be part of the
Vue components, like `{{ dump() }}` statements #}
{% endblock %}
<div class="admin__body--container{% if hasAside %} admin__body--container--has-sidebar{% endif%}"
id="{% block vue_id %}{% endblock %}">
<main class="admin__body--main">
{% block main %}
{% endblock %}
</main>
{% if hasAside %}
<aside class="admin__body--aside">
{% block aside %}
{% endblock %}
</aside>
{% endif %}
</div>
<div class="admin__notifications">
{{ include('@bolt/_partials/_flash_messages.html.twig') }}
</div>
</div>
<!-- End Admin Main -->
</div>
{% block javascripts %}
<script>
var admin = document.querySelector('.admin');
var slim = JSON.parse(localStorage.getItem('slim-sidebar'));
if (slim){
admin.classList.add('is-slim');
}
</script>
{{ encore_entry_script_tags('bolt') }}
{% endblock %}
</body>
</html>