Separate base page into partials

This commit is contained in:
Cyril 2019-10-30 12:19:42 +01:00
parent c14ed97ddd
commit 65076748a9
3 changed files with 40 additions and 18 deletions

View File

@ -0,0 +1,18 @@
<div aria-live="polite" aria-atomic="true" class="flashes">
<div class="inner">
{% for label, messages in app.flashes %}
{% for message in messages %}
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-delay="3000">
<div class="toast-header">
<span class="badge badge-pill badge-{{ label }} mr-2">&nbsp;</span>
<strong class="mr-auto">{{ ("label." ~ label)|trans }}</strong>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="{{ "close"|trans }}">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body">{{ message }}</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>

View File

@ -0,0 +1,20 @@
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">
<img src="/images/logo.png" width="30" height="30" alt=""> Davis
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="{{ "toggle.navigation"|trans }}">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item{% if menu == "dashboard" %} active{% endif %}">
<a class="nav-link" href="{{ path('dashboard') }}">{{ "title.dashboard"|trans }}</a>
</li>
<li class="nav-item{% if menu == "resources" %} active{% endif %}">
<a class="nav-link" href="{{ path('users') }}">{{ "title.users_and_resources"|trans }}</a>
</li>
</ul>
</div>
</div>
</nav>

View File

@ -7,24 +7,8 @@
<link rel="stylesheet" type="text/css" href="/css/style.css"> <link rel="stylesheet" type="text/css" href="/css/style.css">
</head> </head>
<body> <body>
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light"> {% include '_partials/navigation.html.twig' %}
<a class="navbar-brand" href="#"> {% include '_partials/flashes.html.twig' %}
<img src="/images/logo.png" width="30" height="30" alt=""> Davis
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item{% if menu == "dashboard" %} active{% endif %}">
<a class="nav-link" href="{{ path('dashboard') }}">Dashboard</a>
</li>
<li class="nav-item{% if menu == "resources" %} active{% endif %}">
<a class="nav-link" href="{{ path('users') }}">Users and resources</a>
</li>
</ul>
</div>
</nav>
<div class="container"> <div class="container">
{% block body %}{% endblock %} {% block body %}{% endblock %}
</div> </div>