Add footer

Closes #9
This commit is contained in:
Gabriel Augendre 2022-11-09 21:25:14 +01:00
parent 6abf6bec8b
commit 0fc839a4e8
5 changed files with 49 additions and 7 deletions

View file

@ -48,4 +48,4 @@ jobs:
max_attempts: 5 max_attempts: 5
retry_wait_seconds: 2 retry_wait_seconds: 2
warning_on_retry: false warning_on_retry: false
command: curl -sSL --fail -m 10 https://charasheet.augendre.info command: curl -sSL --fail -m 10 https://charasheet.augendre.info | grep $GITHUB_SHA > /dev/null

View file

@ -0,0 +1,5 @@
from django.conf import settings
def app(request):
return settings.APP

View file

@ -109,6 +109,7 @@ TEMPLATES = [
"django.template.context_processors.request", "django.template.context_processors.request",
"django.contrib.auth.context_processors.auth", "django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages", "django.contrib.messages.context_processors.messages",
"charasheet.context_processors.app",
], ],
}, },
}, },
@ -223,3 +224,26 @@ SERVER_EMAIL = "charasheet@mg.augendre.info"
if DEBUG: if DEBUG:
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
APP = {
"build": {
"date": "latest-date",
"commit": "latest-commit",
"describe": "latest-describe",
}
}
try:
with open("/app/git/build-date") as f:
APP["build"]["date"] = f.read().strip()
except Exception: # noqa: S110
pass
try:
with open("/app/git/git-commit") as f:
APP["build"]["commit"] = f.read().strip()
except Exception: # noqa: S110
pass
try:
with open("/app/git/git-describe") as f:
APP["build"]["describe"] = f.read().strip()
except Exception: # noqa: S110
pass

View file

@ -23,13 +23,16 @@
{% block head_end %} {% block head_end %}
{% endblock %} {% endblock %}
</head> </head>
<body> <body class="d-flex flex-column min-vh-100 mb-0">
{% include "common/navbar.html" %} {% include "common/navbar.html" %}
<div class="container"> <main>
{% bootstrap_messages %} <div class="container">
{% block content %} {% bootstrap_messages %}
{% endblock %} {% block content %}
</div> {% endblock %}
</div>
</main>
{% include "common/footer.html" %}
<script src="{% static 'vendor/htmx-1.8.2.min.js' %}" defer></script> <script src="{% static 'vendor/htmx-1.8.2.min.js' %}" defer></script>
{% django_htmx_script %} {% django_htmx_script %}

View file

@ -0,0 +1,10 @@
<footer class="bg-light mt-auto">
<div class="container text-muted pt-2 pb-2 d-flex justify-content-between">
<span>
Version : {{ build.describe }} &bull; {{ build.date }}
</span>
<div>
<a href="https://github.com/Crocmagnon/charasheet" class="text-muted"><i class="fa-brands fa-github"></i></a>
</div>
</div>
</footer>