Skip to content

Commit

Permalink
Merge pull request #115 from luftdaten-at/112-optimise-template-heade…
Browse files Browse the repository at this point in the history
…r-and-footer-for-mobile-browsers

optimize header and footer for mobile view
  • Loading branch information
silvioheinze authored Jan 13, 2025
2 parents 35a9618 + 6b3cca7 commit 1ff7557
Showing 1 changed file with 74 additions and 32 deletions.
106 changes: 74 additions & 32 deletions app/templates/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<html lang="{{ LANGUAGE_CODE }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
{% block title %}
{% if host == "arbeitsplatz.luftdaten.at" %}
Expand All @@ -15,9 +16,9 @@
</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
<!-- CSS -->
<!-- Base CSS -->
<link rel="stylesheet" href="{% static 'css/base.css' %}">
{% comment %} <link rel="stylesheet" href="{% static 'css/bootstrap-icons/font/bootstrap-icons.css' %}"> {% endcomment %}
<!-- Bootstrap Icons via CDN -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
{% block styles %}{% endblock styles %}
</head>
Expand All @@ -26,54 +27,95 @@
<nav class="navbar navbar-expand-md navbar-light fixed-top bg-light">
<div class="container-fluid">
{% if host == "arbeitsplatz.luftdaten.at" %}
<a class="navbar-brand" href="{% url 'home' %}">{% trans "Clean air at the workplace" %}</a>
<a class="navbar-brand" href="{% url 'home' %}">
{% trans "Clean air at the workplace" %}
</a>
{% else %}
<a class="navbar-brand" href="{% url 'home' %}">{% trans "Luftdaten.at Datahub" %}</a>
{% endif %}
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="{% trans 'Toggle navigation' %}">
<a class="navbar-brand" href="{% url 'home' %}">
{% trans "Luftdaten.at Datahub" %}
</a>
{% endif %}
<!-- Navbar Toggler: this button appears on mobile -->
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse"
aria-controls="navbarCollapse" aria-expanded="false" aria-label="{% trans 'Toggle navigation' %}">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
{% if host != "arbeitsplatz.luftdaten.at" %}
<li class="nav-item"><a class="nav-link" href="{% url 'workshops-list' %}">{% trans "Workshops" %}</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'stations-list' %}">{% trans "Stations" %}</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'cities-list' %}">{% trans "Cities" %}</a></li>
<li class="nav-item">
<a class="nav-link" href="{% url 'workshops-list' %}">{% trans "Workshops" %}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'stations-list' %}">{% trans "Stations" %}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'cities-list' %}">{% trans "Cities" %}</a>
</li>
{% if user.is_authenticated and user.is_superuser %}
<li class="nav-item"><a class="nav-link" href="{% url 'device-list' %}">{% trans "Devices" %}</a></li>
<li class="nav-item">
<a class="nav-link" href="{% url 'device-list' %}">{% trans "Devices" %}</a>
</li>
{% endif %}
{% endif %}
{% endif %}
</ul>
<ul class="navbar-nav d-flex flex-row ms-auto me-3">
<!-- Right-side Navigation Items -->
<ul class="navbar-nav d-flex flex-row ms-auto mb-2 mb-md-0">
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
{{ user.username }}
</a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item" href="{% url 'organizations-my' %}">{% trans "My Organizations" %}</a></li>
<li><a class="dropdown-item" href="{% url 'campaigns-my' %}">{% trans "My Campaigns" %}</a></li>
<li>
<a class="dropdown-item" href="{% url 'organizations-my' %}">
{% trans "My Organizations" %}
</a>
</li>
<li>
<a class="dropdown-item" href="{% url 'campaigns-my' %}">
{% trans "My Campaigns" %}
</a>
</li>
{% if host != "arbeitsplatz.luftdaten.at" %}
<li><a class="dropdown-item" href="{% url 'workshops-my' %}">{% trans "My Workshops" %}</a></li>
<li>
<a class="dropdown-item" href="{% url 'workshops-my' %}">
{% trans "My Workshops" %}
</a>
</li>
{% endif %}
<li><a class="dropdown-item" href="{% url 'account_change_password' %}">{% trans "Change Password" %}</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{% url 'account_logout' %}">{% trans "Log Out" %}</a></li>
<li>
<a class="dropdown-item" href="{% url 'account_change_password' %}">
{% trans "Change Password" %}
</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item" href="{% url 'account_logout' %}">
{% trans "Log Out" %}
</a>
</li>
</ul>
</li>
{% else %}
<li class="nav-item"><a class="nav-link" href="{% url 'account_login' %}">{% trans "Log In" %}</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a></li>
<li class="nav-item">
<a class="nav-link" href="{% url 'account_login' %}">{% trans "Log In" %}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
</li>
{% endif %}
</ul>
</div>
</div>
</nav>

<!-- Hauptinhalt -->
<div class="content-wrapper">
<!-- Optional Map Block -->
{% block map %}{% endblock map %}
<!-- Main Content -->
<div class="content-wrapper" style="padding-top: 50px;"> {# Added top padding to avoid fixed navbar overlap #}
{% block map %}{% endblock map %}
<div class="container">
{% block content %}
{% endblock content %}
Expand All @@ -84,9 +126,9 @@
<footer class="footer bg-dark text-white py-3">
<div class="container">
<nav aria-label="Footer navigation">
<div class="row">
<div class="col">
<ul class="list-unstyled list-inline">
<div class="row align-items-center">
<div class="col-12 col-md-6">
<ul class="list-unstyled list-inline mb-0">
<li class="list-inline-item">
<a href="https://luftdaten.at/datenschutz/" class="text-white">{% trans "Privacy" %}</a>
</li>
Expand All @@ -95,8 +137,8 @@
</li>
</ul>
</div>
<div class="col text-end">
<form action="{% url 'set_language' %}" method="post" class="d-flex align-items-center justify-content-end">
<div class="col-12 col-md-6 text-md-end mt-2 mt-md-0">
<form action="{% url 'set_language' %}" method="post" class="d-flex justify-content-md-end">
{% csrf_token %}
<input name="next" type="hidden" value="{{ request.path }}">
<select name="language" onchange="this.form.submit()" class="form-select w-auto">
Expand All @@ -115,9 +157,9 @@
</div>
</footer>

<!-- Bootstrap JavaScript -->
<!-- Bootstrap JavaScript (Bundle includes Popper) -->
<script src="{% static 'js/bootstrap.bundle.min.js' %}"></script>
<!-- JavaScript -->
<!-- Custom JavaScript -->
<script src="{% static 'js/base.js' %}"></script>
</body>
</html>

0 comments on commit 1ff7557

Please sign in to comment.