summaryrefslogtreecommitdiff
path: root/templates/layouts/parts/navbar.twig
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-09-23 19:13:19 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-09-23 20:11:37 +0200
commit66038eda14d5d4e624b6636a6156570e3e940e49 (patch)
tree6e4b7557b7d91786ef47f22f7ddef85eed1dfb42 /templates/layouts/parts/navbar.twig
parent590adffa9316b98544cb8d67b03b80e44ba9c8b7 (diff)
parent9d34f371cb9c5ab0d60bd3158678b9cc9da6cc80 (diff)
Merge branch 'twig-templates'
Diffstat (limited to 'templates/layouts/parts/navbar.twig')
-rw-r--r--templates/layouts/parts/navbar.twig74
1 files changed, 74 insertions, 0 deletions
diff --git a/templates/layouts/parts/navbar.twig b/templates/layouts/parts/navbar.twig
new file mode 100644
index 00000000..a718fc48
--- /dev/null
+++ b/templates/layouts/parts/navbar.twig
@@ -0,0 +1,74 @@
+{% import _self as elements %}
+
+{% macro toolbar_item(label, link, active_page, icon) %}
+ <li{% if page() == active_page %} class="active"{% endif %}>
+ <a href="{{ link }}">
+ {% if icon %}<span class="glyphicon {{ 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">ENGELSYSTEM</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() %}
+ {{ 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') %}
+ {{ elements.toolbar_item(user.Nick, url('users', {'action': 'view'}), 'users', 'icon-icon_angel') }}
+ {% 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>