Tweak navbar collapse as guest and fix language dropdown position (#1128)

* Fix language switcher position
* Tweak navbar collapse as guest
This commit is contained in:
Michael Weimann 2023-04-19 21:19:22 +02:00 committed by GitHub
parent 16632706e0
commit 3901cdbf2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 12 deletions

View File

@ -0,0 +1,12 @@
{% import 'macros/base.twig' as m %}
{% if config('locales')|length > 1 %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ m.icon('translate') }}
</a>
<ul class="dropdown-menu dropdown-menu-end">
{{ menuLanguages()|join(" ")|raw }}
</ul>
</li>
{% endif %}

View File

@ -22,7 +22,14 @@
</li> </li>
{% endmacro %} {% endmacro %}
<nav class="navbar fixed-top navbar-expand-xxl border-bottom {{ theme['navbar_classes'] }}">
{% if is_guest() %}
{% set navbar_expand_class = 'navbar-expand-md' %}
{% else %}
{% set navbar_expand_class = 'navbar-expand-xxl' %}
{% endif %}
<nav class="navbar fixed-top {{ navbar_expand_class }} border-bottom {{ theme['navbar_classes'] }}">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="{{ url('/') }}"> <a class="navbar-brand" href="{{ url('/') }}">
{{ m.angel() }} {{ m.angel() }}
@ -49,6 +56,8 @@
{% endif %} {% endif %}
<ul class="navbar-nav ms-auto mb-2 mb-lg-0"> <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
{% if is_guest() %} {% if is_guest() %}
{% include "layouts/parts/language_dropdown.twig" %}
{% if has_permission_to('register') and config('registration_enabled') %} {% if has_permission_to('register') and config('registration_enabled') %}
{{ _self.toolbar_item(__('Register'), url('register'), 'register', 'plus') }} {{ _self.toolbar_item(__('Register'), url('register'), 'register', 'plus') }}
{% endif %} {% endif %}
@ -72,6 +81,7 @@
{{ menuUserHints() }} {{ menuUserHints() }}
{% include "layouts/parts/language_dropdown.twig" %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ m.angel() }} {{ user.displayName }} {{ m.angel() }} {{ user.displayName }}
@ -91,17 +101,6 @@
</ul> </ul>
</li> </li>
{% endif %} {% endif %}
{% if config('locales')|length > 1 %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ m.icon('translate') }}
</a>
<ul class="dropdown-menu dropdown-menu-end">
{{ menuLanguages()|join(" ")|raw }}
</ul>
</li>
{% endif %}
</ul> </ul>
</div> </div>
</div> </div>