engelsystem/resources/views/layouts/parts/navbar.twig

87 lines
4.0 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.

{% macro toolbar_item(label, link, active_page, icon) %}
<li{% if page() == active_page %} class="active"{% endif %}>
<a href="{{ link }}">
{% if icon %}<span class="{% if 'glyphicon-' in icon %}glyphicon {% endif %}{{ icon }}"></span>{% endif %}
{{ label|raw }}
</a>
</li>
{% endmacro %}
<div class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
{% block navbar %}
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed"
data-toggle="offcanvas" data-target="#navbar-offcanvas">
<span class="sr-only">Toggle navigation</span>
<span class="icon icon-open">☰</span>
<span class="icon icon-close">×</span>
</button>
<a class="navbar-brand" href="{{ url('/') }}">
<span class="icon-icon_angel"></span>
<strong class="visible-lg-inline">{{ config('app_name')|upper }}</strong>
</a>
</div>
{% block menu %}
<div class="collapse navbar-collapse" id="navbar-offcanvas">
{% block menu_items %}
{{ menu() }}
{% if config('header_items') %}
<ul class="nav navbar-nav">
{% for text,link in config('header_items', {}) %}
<li>
<a href="{{ link|replace({'%lang%': session_get('locale')|split('_')[0]})|escape('html_attr') }}">
{{ text }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}
{% block menu_toolbar %}
<ul class="nav navbar-nav navbar-right">
{% if is_user() %}
{{ _self.toolbar_item(menuUserShiftState(user), url('shifts', {'action': 'next'}), '', 'glyphicon-time') }}
{% elseif has_permission_to('register') and config('registration_enabled') %}
{{ _self.toolbar_item(__('Register'), url('register'), 'register', 'glyphicon-plus') }}
{% endif %}
{% if has_permission_to('login') %}
{{ _self.toolbar_item(__('Login'), url('login'), 'login', 'glyphicon-log-in') }}
{% endif %}
{% if is_user() and has_permission_to('user_messages') %}
{{ _self.toolbar_item(menuUserMessages(), url('user-messages'), 'user-messages', 'glyphicon-envelope') }}
{% endif %}
{{ menuUserHints() }}
{% if has_permission_to('user_myshifts') %}
{{ _self.toolbar_item(user.name, url('users', {'action': 'view'}), 'users', 'icon icon-icon_angel') }}
{% endif %}
<li class="hidden-xs">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
{{ menuUserSubmenu()|join(" ")|raw }}
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-mobile hidden-sm hidden-md hidden-lg">
{{ menuUserSubmenu()|join(" ")|raw }}
</ul>
{% endblock %}
</div>
{% endblock %}
{% endblock %}
</div>
</div>