44 lines
1.8 KiB
HTML
44 lines
1.8 KiB
HTML
{% macro nav_item(name, label) %}
|
|
<li class="nav-item{% if name == active %} active{% endif %}">
|
|
<a class="nav-link" href="{{ url_for(name) }}">{{ label }}{% if name == active %} <span class="visually-hidden">(current)</span>{% endif %}</a>
|
|
</li>
|
|
{% endmacro %}
|
|
|
|
{% macro navbar_inner(name) %}
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand" href="{{ url_for('browse_page') }}">Wikidata Art Depiction Explorer</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
|
<ul class="navbar-nav me-auto">
|
|
{{ nav_item('browse_page', 'Browse') }}
|
|
{{ nav_item('list_edits', 'Recent changes') }}
|
|
{{ nav_item('random_artwork', 'Random artwork') }}
|
|
</ul>
|
|
<ul class="navbar-nav">
|
|
<li class="nav-item">
|
|
{% if g.user %}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ url_for('user_page', username=g.user) }}">{{ g.user }}</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ url_for('oauth_disconnect', next=request.script_root + request.full_path) }}">switch user</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="nav-item">
|
|
{% set login_url = url_for('start_oauth', next=request.script_root + request.full_path) %}
|
|
<a class="nav-link" href="{{ login_url }}">connect with Wikidata</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{% macro navbar() %}
|
|
<nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
|
|
{{ navbar_inner() }}
|
|
</nav>
|
|
{% endmacro %}
|