Add nav menu with Characters, NPC's and Storyline pages
Navbar (collapsible) with active-state highlighting driven by a nav list in base.html.twig. Three routed, auth-gated controllers each rendering a shared placeholder partial - data models still to be designed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,9 +18,32 @@
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="{{ path('app_home') }}">🎲 dmtools</a>
|
||||
{% if app.user %}
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<span class="navbar-text small">{{ app.user.userIdentifier }}</span>
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{{ path('app_logout') }}">Log out</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#mainnav" aria-controls="mainnav" aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="mainnav">
|
||||
{% set route = app.request.attributes.get('_route') %}
|
||||
{% set nav = [
|
||||
{ route: 'app_home', label: 'Overview' },
|
||||
{ route: 'app_characters', label: 'Characters' },
|
||||
{ route: 'app_npcs', label: "NPC's" },
|
||||
{ route: 'app_storyline', label: 'Storyline' },
|
||||
] %}
|
||||
<ul class="navbar-nav me-auto">
|
||||
{% for item in nav %}
|
||||
{% set active = route is not null and route starts with item.route %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{{ active ? ' active' }}"{{ active ? ' aria-current="page"' }}
|
||||
href="{{ path(item.route) }}">{{ item.label }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<span class="navbar-text small">{{ app.user.userIdentifier }}</span>
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{{ path('app_logout') }}">Log out</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user