1
0
Fork 0
mirror of https://github.com/Findus23/RPGnotes.git synced 2024-09-19 15:43:45 +02:00

add proper footer

This commit is contained in:
Lukas Winkler 2021-09-07 17:05:03 +02:00
parent de3146e5db
commit 45ba9484b3
Signed by: lukas
GPG key ID: 54DE4D798D244853
6 changed files with 76 additions and 5 deletions

View file

@ -0,0 +1,16 @@
from subprocess import run
from django import template
from django.core.cache import cache
register = template.Library()
@register.simple_tag
def commit_id():
commit = cache.get("commit")
if not commit:
sp = run(["git", "rev-parse", "--verify", "HEAD"], capture_output=True)
commit = sp.stdout.decode().strip()
cache.set("commit", commit)
return commit

View file

@ -3,12 +3,12 @@ from django.views.decorators.cache import cache_page
from utils.assets import get_css
@cache_page(60 * 15)
# @cache_page(60 * 15)
def debug_css(request):
css, source_map = get_css(debug=True)
return HttpResponse(css, content_type="text/css")
@cache_page(60 * 15)
# @cache_page(60 * 15)
def debug_css_sourcemap(request):
css, source_map = get_css(debug=True)
return HttpResponse(source_map, content_type="application/json")

View file

@ -1,3 +1,21 @@
html {
height: 100%;
}
body {
display: flex;
flex-direction: column;
height: 100%;
> .container {
flex: 1 0 auto;
}
}
.collapse-cell {
padding: 0 !important;
border: none !important;
@ -70,3 +88,17 @@ tr.collapse-button:not(.collapsed) {
margin: 0 5px;
}
}
footer {
margin-top: 1rem;
.navbar-nav {
justify-content: space-between;
width: 100%;
@include media-breakpoint-down(sm) {
flex-direction: column !important;
text-align: center;
}
}
}

View file

@ -5,3 +5,5 @@
@import "misc";
@import "avatar";

View file

@ -1,3 +1,4 @@
{% load version %}
{% load django_bootstrap5 %}
{% load static %}
<!DOCTYPE html>
@ -22,6 +23,28 @@
{% bootstrap_messages %}
{% block mainpage %}{% endblock %}
</div>
<footer>
<nav class="navbar navbar-dark bg-dark navbar-expand">
<div class="container-fluid">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://github.com/Findus23/RPGnotes/tree/{% commit_id %}"
target="_blank" rel="noopener" title="{% commit_id %}">
Source
</a>
</li>
<li class="nav-item">
{% if user.is_authenticated %}
<a class="nav-link" href="{% url "logout" %}">Logout</a>
{% else %}
<a class="nav-link" href="{% url "login" %}">Login</a>
{% endif %}
</ul>
</div>
</nav>
</footer>
<script src="{% static "libs/bootstrap.min.js" %}"></script>
{% block extra_js %}{% endblock %}
</body>

View file

@ -1,4 +1,5 @@
{% extends "base.html" %}
{% load version %}
{% block mainpage %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
@ -32,7 +33,4 @@
{% block content %}
{% endblock %}
<footer>
<a href="{% url "logout" %}">Logout</a>
</footer>
{% endblock %}