test_template_flask/templates/base.html
2026-07-21 17:20:35 +02:00

38 lines
1.2 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}MyApp{% endblock %}</title>
</head>
<body>
<nav class="nav">
<div class="wrap">
<a class="brand" href="{{ url_for('main.index') }}">MyApp</a>
<div class="nav-actions">
{% if current_user.is_authenticated %}
<span class="text-muted">Hi, {{ current_user.username }}</span>
<a class="btn btn-ghost" href="{{ url_for('auth.logout') }}">Log out</a>
{% else %}
<a class="btn btn-ghost" href="{{ url_for('auth.login') }}">Log in</a>
<a class="btn btn-primary" href="{{ url_for('auth.register') }}">Register</a>
{% endif %}
</div>
</div>
</nav>
<div class="wrap">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="flash-message {{ category }}">
<p>{{ message }}</p>
</div>
{% endfor %}
{% endif %}
{% endwith %}
{% block content %}{% endblock %}
</div>
</body>
</html>