Refactor nav-bar

This commit is contained in:
2024-02-14 13:32:16 +01:00
parent 4498f5e075
commit ff0b70b380
2 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
{# Easy nav-bar entries. When a page sets the active_page variable, the current entry will be underlined #}
{% macro nav_selector(page='', text='') %}
<a class="nav-link" href="/{{ page }}">{% if active_page == page %}<u>{% endif %} {{ text }} {% if active_page == page %}</u>{% endif %}</a>
{% endmacro %}
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -15,25 +20,27 @@
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg bg-body-tertiary"> <nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/">
<img src="../static/image/f1_logo.svg" alt="Logo" width="120" height="30" <img src="../static/image/f1_logo.svg" alt="Logo" width="120" height="30"
class="d-inline-block align-text-top"> class="d-inline-block align-text-top">
Formula <i>10</i> Formula <i>10</i> - 2024
</a> </a>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup"> <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav"> <div class="navbar-nav">
{# <a class="nav-link {% if page == 'teams' %}active{% endif %}" href="/teams">Teams</a> #} {{ nav_selector("raceguessresults", "Results for Races") }}
{# <a class="nav-link {% if page == 'drivers' %}active{% endif %}" href="/drivers">Drivers</a> #} {{ nav_selector("seasonguessresults", "Results for Season") }}
{{ nav_selector("graphs", "Result Graphs") }}
{{ nav_selector("raceguesses", "Guess a Race") }}
{{ nav_selector("seasonguesses", "Guess the Season") }}
{{ nav_selector("rules", "Rules") }}
</div> </div>
</div> </div>
</div> </div>
</nav> </nav>
{% block body %}{% endblock body %} {% block body %}{% endblock body %}
</body> </body>
</html> </html>

View File

@ -1,4 +1,7 @@
{% extends 'base.jinja' %} {% extends 'base.jinja' %}
{% set active_page = "raceguessresults" %}
{% block title %}Formula 10{% endblock title %} {% block title %}Formula 10{% endblock title %}
{% block body %} {% block body %}