mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
more flexible navbar code in base template
This commit is contained in:
parent
4a29a52f2a
commit
c68286e010
@ -1,44 +0,0 @@
|
|||||||
<div class="navbar-fixed">
|
|
||||||
<nav>
|
|
||||||
<div class="nav-wrapper primary-color">
|
|
||||||
{% if current_user.is_authenticated %}
|
|
||||||
<!-- menu icon -->
|
|
||||||
<!-- small/medium devices -->
|
|
||||||
<a href="#!" class="sidenav-trigger" data-target="sidenav"><i class="material-icons">menu</i></a>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<!-- nopaque logo+wordmark -->
|
|
||||||
<!-- small/medium devices -->
|
|
||||||
<a href="{{ url_for('main.index') }}" class="brand-logo center hide-on-large-only" style="height: 100%;">
|
|
||||||
<img src="{{ url_for('static', filename='images/nopaque_-_logo+wordmark.png') }}" alt="" class="py-3" style="height: 100%;">
|
|
||||||
</a>
|
|
||||||
<!-- large devices -->
|
|
||||||
<a href="{{ url_for('main.index') }}" class="brand-logo hide-on-med-and-down" style="height: 100%;">
|
|
||||||
<img src="{{ url_for('static', filename='images/nopaque_-_logo+wordmark.png') }}" alt="" class="p-3" style="height: 100%;">
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- right aligned navigation links -->
|
|
||||||
<!-- large devices -->
|
|
||||||
<ul class="right hide-on-med-and-down" style="height: 100%;">
|
|
||||||
{% if current_user.is_authenticated %}
|
|
||||||
<!-- avatar, username and email -->
|
|
||||||
<li style="height: 100%;">
|
|
||||||
<a href="#!" class="dropdown-trigger no-autoinit" data-target="nav-account-dropdown-content" id="nav-account-dropdown-trigger" style="height: 100%;">
|
|
||||||
<img src="{{ url_for('users.user_avatar', user_id=current_user.id) }}" alt="" class="left circle py-3" style="height: 100%;">
|
|
||||||
<span class="ml-1">{{ current_user.username }} ({{ current_user.email }})</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% else %}
|
|
||||||
<!-- log in -->
|
|
||||||
<li {% if request.path == url_for('auth.login') %}class="active"{% endif %}>
|
|
||||||
<a href="{{ url_for('auth.login') }}"><i class="material-icons left">login</i>Log in</a>
|
|
||||||
</li>
|
|
||||||
<!-- register -->
|
|
||||||
<li {% if request.path == url_for('auth.register') %}class="active"{% endif %}>
|
|
||||||
<a href="{{ url_for('auth.register') }}"><i class="material-icons left">assignment</i>Register</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
38
app/templates/_base/navbar_primary_content.html.j2
Normal file
38
app/templates/_base/navbar_primary_content.html.j2
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{% if current_user.is_authenticated %}
|
||||||
|
<!-- menu icon -->
|
||||||
|
<!-- small/medium devices -->
|
||||||
|
<a href="#!" class="sidenav-trigger" data-target="sidenav"><i class="material-icons">menu</i></a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- nopaque logo+wordmark -->
|
||||||
|
<!-- small/medium devices -->
|
||||||
|
<a href="{{ url_for('main.index') }}" class="brand-logo center hide-on-large-only" style="height: 100%;">
|
||||||
|
<img src="{{ url_for('static', filename='images/nopaque_-_logo+wordmark.png') }}" alt="" class="py-3" style="height: 100%;">
|
||||||
|
</a>
|
||||||
|
<!-- large devices -->
|
||||||
|
<a href="{{ url_for('main.index') }}" class="brand-logo hide-on-med-and-down ml-2" style="height: 100%;">
|
||||||
|
<img src="{{ url_for('static', filename='images/nopaque_-_logo+wordmark.png') }}" alt="" class="py-3" style="height: 100%;">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- right aligned navigation links -->
|
||||||
|
<!-- large devices -->
|
||||||
|
<ul class="right hide-on-med-and-down" style="height: 64px;">
|
||||||
|
{% if current_user.is_authenticated %}
|
||||||
|
<!-- avatar, username and email -->
|
||||||
|
<li style="height: 100%;">
|
||||||
|
<a href="#!" class="dropdown-trigger no-autoinit" data-target="nav-account-dropdown-content" id="nav-account-dropdown-trigger" style="height: 100%;">
|
||||||
|
<img src="{{ url_for('users.user_avatar', user_id=current_user.id) }}" alt="" class="left circle py-3" style="height: 100%;">
|
||||||
|
<span class="ml-2">{{ current_user.username }} ({{ current_user.email }})</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<!-- log in -->
|
||||||
|
<li {% if request.path == url_for('auth.login') %}class="active"{% endif %}>
|
||||||
|
<a href="{{ url_for('auth.login') }}"><i class="material-icons left">login</i>Log in</a>
|
||||||
|
</li>
|
||||||
|
<!-- register -->
|
||||||
|
<li {% if request.path == url_for('auth.register') %}class="active"{% endif %}>
|
||||||
|
<a href="{{ url_for('auth.register') }}"><i class="material-icons left">assignment</i>Register</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
@ -1,10 +1,10 @@
|
|||||||
<link href="{{ url_for('static', filename='external/material-design-icons/css/material-icons.css') }}" rel="stylesheet">
|
<link href="{{ url_for('static', filename='external/material-design-icons/css/material-icons.css') }}" rel="stylesheet">
|
||||||
<link href="{{ url_for('static', filename='external/materialize/css/materialize.min.css') }}" rel="stylesheet">
|
<link href="{{ url_for('static', filename='external/materialize/css/materialize.min.css') }}" rel="stylesheet">
|
||||||
{% if current_user.is_authenticated -%}
|
{% if current_user.is_authenticated -%}
|
||||||
<link href="{{ url_for('static', filename='materialize/css/sidenav-fixed.css') }}" rel="stylesheet">
|
<link href="{{ url_for('static', filename='css/materialize/sidenav-fixed.css') }}" rel="stylesheet">
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
<link href="{{ url_for('static', filename='materialize/css/sticky-footer.css') }}" rel="stylesheet">
|
<link href="{{ url_for('static', filename='css/materialize/sticky-footer.css') }}" rel="stylesheet">
|
||||||
<link href="{{ url_for('static', filename='materialize/css/fixes.css') }}" rel="stylesheet">
|
<link href="{{ url_for('static', filename='css/materialize/fixes.css') }}" rel="stylesheet">
|
||||||
<link href="{{ url_for('static', filename='nopaque-icons/css/nopaque-icons.css') }}" rel="stylesheet">
|
<link href="{{ url_for('static', filename='nopaque-icons/css/nopaque-icons.css') }}" rel="stylesheet">
|
||||||
<link href="{{ url_for('static', filename='css/queryBuilder.css') }}" rel="stylesheet">
|
<link href="{{ url_for('static', filename='css/queryBuilder.css') }}" rel="stylesheet">
|
||||||
{% assets
|
{% assets
|
||||||
|
@ -2,6 +2,14 @@
|
|||||||
{% set title = 'nopaque' %}
|
{% set title = 'nopaque' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if navbar_fixed is not defined %}
|
||||||
|
{% set navbar_fixed = true %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if navbar_extended is not defined %}
|
||||||
|
{% set navbar_extended = false %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block doc %}
|
{% block doc %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html {% block html_attribs %}lang="en"{% endblock html_attribs %}>
|
<html {% block html_attribs %}lang="en"{% endblock html_attribs %}>
|
||||||
@ -27,9 +35,27 @@
|
|||||||
{% block body %}
|
{% block body %}
|
||||||
<header {% block header_attribs %}{% endblock header_attribs %}>
|
<header {% block header_attribs %}{% endblock header_attribs %}>
|
||||||
{% block header %}
|
{% block header %}
|
||||||
|
{% if navbar_fixed %}
|
||||||
|
<div class="navbar-fixed">
|
||||||
|
{% endif %}
|
||||||
|
<nav {% block navbar_attribs %}{% if navbar_extended %}class="nav-extended"{% endif %}{% endblock navbar_attribs %}>
|
||||||
{% block navbar %}
|
{% block navbar %}
|
||||||
{% include "_base/navbar.html.j2" %}
|
<div {% block navbar_primary_content_attribs %}class="nav-wrapper primary-color"{% endblock navbar_primary_content_attribs %}>
|
||||||
|
{% block navbar_primary_content %}
|
||||||
|
{% include "_base/navbar_primary_content.html.j2" %}
|
||||||
|
{% endblock navbar_primary_content %}
|
||||||
|
</div>
|
||||||
|
{% if navbar_extended %}
|
||||||
|
<div {% block navbar_secondary_content_attribs %}class="nav-content primary-variant-color"{% endblock navbar_secondary_content_attribs %}>
|
||||||
|
{% block navbar_secondary_content %}
|
||||||
|
{% endblock navbar_secondary_content %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock navbar %}
|
{% endblock navbar %}
|
||||||
|
</nav>
|
||||||
|
{% if navbar_fixed %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% block sidenav %}
|
{% block sidenav %}
|
||||||
{% if current_user.is_authenticated %}
|
{% if current_user.is_authenticated %}
|
||||||
{% include "_base/sidenav.html.j2" %}
|
{% include "_base/sidenav.html.j2" %}
|
||||||
@ -41,6 +67,7 @@
|
|||||||
<main {% block main_attribs %}class="background-color"{% endblock main_attribs %}>
|
<main {% block main_attribs %}class="background-color"{% endblock main_attribs %}>
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{% block page_content %}{% endblock page_content %}
|
{% block page_content %}{% endblock page_content %}
|
||||||
|
{% endblock main %}
|
||||||
|
|
||||||
<div id="dropdowns">
|
<div id="dropdowns">
|
||||||
{% block dropdowns %}
|
{% block dropdowns %}
|
||||||
@ -53,7 +80,6 @@
|
|||||||
{% include "_base/modals.html.j2" %}
|
{% include "_base/modals.html.j2" %}
|
||||||
{% endblock modals %}
|
{% endblock modals %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock main %}
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer {% block footer_attribs %}class="page-footer primary-variant-color"{% endblock footer_attribs %}>
|
<footer {% block footer_attribs %}class="page-footer primary-variant-color"{% endblock footer_attribs %}>
|
||||||
@ -62,9 +88,11 @@
|
|||||||
{% endblock footer %}
|
{% endblock footer %}
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<div id="scripts">
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% include "_base/scripts.html.j2" %}
|
{% include "_base/scripts.html.j2" %}
|
||||||
{% endblock scripts %}
|
{% endblock scripts %}
|
||||||
|
</div>
|
||||||
{% endblock body %}
|
{% endblock body %}
|
||||||
</body>
|
</body>
|
||||||
{% endblock html %}
|
{% endblock html %}
|
||||||
|
Loading…
Reference in New Issue
Block a user