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

75 lines
3.5 KiB
Twig
Raw Normal View History

2018-09-23 19:13:19 +02:00
{% import _self as elements %}
{% macro toolbar_item(label, link, active_page, icon) %}
<li{% if page() == active_page %} class="active"{% endif %}>
<a href="{{ link }}">
2018-10-03 09:23:30 +02:00
{% if icon %}<span class="{% if 'glyphicon-' in icon %}glyphicon {% endif %}{{ icon }}"></span>{% endif %}
2018-09-23 19:13:19 +02:00
{{ 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="collapse" data-target="#navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ url('/') }}">
<span class="icon-icon_angel"></span> <strong class="visible-lg-inline">{{ config('app_name')|upper }}</strong>
2018-09-23 19:13:19 +02:00
</a>
</div>
{% block menu %}
<div class="collapse navbar-collapse" id="navbar-collapse-1">
{% block menu_items %}
{{ menu() }}
{% endblock %}
{% block menu_toolbar %}
<ul class="nav navbar-nav navbar-right">
{% if is_user() %}
{{ elements.toolbar_item(menuUserShiftState(user), url('shifts', {'action': 'next'}), '', 'glyphicon-time') }}
{% elseif has_permission_to('register') and config('registration_enabled') %}
{{ elements.toolbar_item(__('Register'), url('register'), 'register', 'glyphicon-plus') }}
{% endif %}
{% if has_permission_to('login') %}
{{ elements.toolbar_item(__('Login'), url('login'), 'login', 'glyphicon-log-in') }}
{% endif %}
{% if is_user() and has_permission_to('user_messages') %}
{{ elements.toolbar_item(menuUserMessages(), url('user-messages'), 'user-messages', 'glyphicon-envelope') }}
{% endif %}
{{ menuUserHints() }}
{% if has_permission_to('user_myshifts') %}
2018-10-03 09:23:30 +02:00
{{ elements.toolbar_item(user.Nick, url('users', {'action': 'view'}), 'users', 'icon icon-icon_angel') }}
2018-09-23 19:13:19 +02:00
{% endif %}
{% if has_permission_to('user_settings') or has_permission_to('logout') %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
{{ menuUserSubmenu()|join(" ")|raw }}
</ul>
</li>
{% endif %}
</ul>
{% endblock %}
</div>
{% endblock %}
{% endblock %}
</div>
</div>