-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
base.html.twig
141 lines (129 loc) · 7.49 KB
/
base.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{#
This is the base template used as the application layout which contains the
common elements and decorates all the other templates.
See https://symfony.com/doc/current/templates.html#template-inheritance-and-layouts
#}
<!DOCTYPE html>
<html lang="{{ app.request.locale }}">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="view-transition" content="same-origin" />
<title>{% block title %}Symfony Demo application{% endblock %}</title>
<link rel="alternate" type="application/rss+xml" title="{{ 'rss.title'|trans }}" href="{{ path('blog_rss') }}">
{#
Those two blocks defines frontend entrypoint for CSS and JavaScript assets
See https://symfony.com/doc/current/frontend.html
#}
{% block stylesheets %}{% endblock %}
{% block javascripts %}
{% block importmap %}{{ importmap('app') }}{% endblock %}
{% endblock %}
<link rel="shortcut icon" type="image/svg+xml" href="{{ asset('favicon.svg') }}">
</head>
<body id="{% block body_id %}{% endblock %}">
{% block header %}
{% set _route = app.request.get('_route') %}
<header>
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="{{ path('homepage') }}">
Symfony Demo
</a>
<button class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#appNavbar" aria-controls="appNavbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse" id="appNavbar">
<ul class="navbar-nav ml-auto">
{% block header_navigation_links %}
<li class="nav-item{{ _route == 'blog_index' ? ' active' : '' }}">
<a class="nav-link" href="{{ path('blog_index') }}">
<twig:ux:icon name="tabler:home"/> {{ 'menu.homepage'|trans }}
</a>
</li>
{% if is_granted('ROLE_ADMIN') %}
<li class="nav-item">
<a class="nav-link" href="{{ path('admin_post_index') }}">
<twig:ux:icon name="tabler:lock"/> {{ 'menu.admin'|trans }}
</a>
</li>
{% endif %}
{% endblock %}
<li class="nav-item{{ _route == 'blog_search' ? ' active' : '' }}">
<a class="nav-link" href="{{ path('blog_search') }}"> <twig:ux:icon name="tabler:search"/> {{ 'menu.search'|trans }}</a>
</li>
{% if app.user %}
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" id="user">
<twig:ux:icon name="tabler:user"/>
<span class="caret"></span>
<span class="sr-only">{{ app.user.fullname }}</span>
</a>
<div class="dropdown-menu user" role="menu" aria-labelledby="user">
<a class="dropdown-item" href="{{ path('user_edit') }}">
<twig:ux:icon name="tabler:id-badge-2"/> {{ 'menu.user'|trans }}
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ logout_path() }}">
<twig:ux:icon name="tabler:logout"/> {{ 'menu.logout'|trans }}
</a>
</div>
</li>
{% endif %}
<li class="nav-item dropdown">
{% from 'default/_language_selector.html.twig' import render_language_selector %}
{{ render_language_selector() }}
</li>
</ul>
</div>
</div>
</nav>
</header>
{% endblock %}
<div class="container body-container">
{% block body %}
<div class="row">
<div id="main" class="col-sm-9">
{{ include('default/_flash_messages.html.twig') }}
{% block main %}{% endblock %}
</div>
<div id="sidebar" class="col-sm-3">
{% block sidebar %}
{{ render_esi(controller('Symfony\\Bundle\\FrameworkBundle\\Controller\\TemplateController::templateAction', {
'template': 'blog/about.html.twig',
'sharedAge': 600,
'_locale': app.request.locale
})) }}
{% endblock %}
</div>
</div>
{% endblock %}
</div>
{% block footer %}
<footer>
<div class="container">
<div class="row">
<div id="footer-copyright" class="col-md-6">
<p>© {{ 'now'|date('Y') }} - The Symfony Project</p>
<p>{{ 'mit_license'|trans }}</p>
</div>
<div id="footer-resources" class="col-md-6">
<p>
<a rel="noopener noreferrer" target="_blank" href="https://twitter.com/symfony" title="Symfony on X (formerly Twitter)">
<twig:ux:icon name="tabler:brand-x" font-size="28px" /> <span class="sr-only">X/Twitter</span>
</a>
<a target="_blank" href="https://symfony.com/blog/" title="Symfony Blog">
<twig:ux:icon name="tabler:rss" font-size="28px" /> <span class="sr-only">RSS feed</span>
</a>
</p>
</div>
</div>
</div>
</footer>
{% endblock %}
{# it's not mandatory to set the timezone in localizeddate(). This is done to
avoid errors when the 'intl' PHP extension is not available and the application
is forced to use the limited "intl polyfill", which only supports UTC and GMT #}
<!-- Page rendered on {{ 'now'|format_datetime('long', 'long', '', 'UTC') }} -->
</body>
</html>