summaryrefslogtreecommitdiff
path: root/resources/views/layouts/parts/navbar.twig
blob: 9045601bb8252c29d4bcb2347a5d497bca1597eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{% 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="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>
                </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() %}
                                {{ _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="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>

                        </ul>
                    {% endblock %}
                </div>
            {% endblock %}
        {% endblock %}
    </div>
</div>