feat(footer): add commit version in footer

This commit is contained in:
Romain J 2020-05-16 15:57:04 +02:00
parent bbd3eff9dc
commit 4be392e35f
4 changed files with 20 additions and 4 deletions

View file

@ -1,4 +1,5 @@
{% load i18n %}
{% load version %}
<footer class="uk-padding-remove-bottom">
<div class="uk-text-center uk-padding uk-padding-remove-bottom uk-flex">
@ -10,9 +11,10 @@
<a class="uk-text-small uk-button-link" href="https://git.gnous.eu/Romain">Romain J.</a>
<span class="uk-text-small uk-text-muted"> | {% trans "Fait avec" %} </span>
<a href="http://getuikit.com" target="_blank" class="uk-text-small uk-button-link">
<span data-uk-icon="uikit" class="uk-icon"></span>
</a>
<a href="http://getuikit.com" target="_blank" class="uk-text-small uk-button-link"><span data-uk-icon="uikit" class="uk-icon"></span></a>
<span class="uk-text-small uk-text-muted"> | Version: </span>
<a href="https://git.gnous.eu/gnouseu/gnousdoteu/src/commit/{% version 'long' %}" target="_blank" class="uk-text-small uk-button-link">{% version 'short' %}</a>
</div>
<div class="uk-float-right">
<noscript>

View file

View file

@ -0,0 +1,15 @@
from django import template
import subprocess
register = template.Library()
@register.simple_tag
def version(size):
command = ['git', 'rev-parse']
if size == 'short':
command += ['--short', 'HEAD']
else:
command += ['HEAD']
return subprocess.check_output(command).decode()

View file

@ -2,7 +2,6 @@ from django.http import HttpResponse, HttpRequest
from django.shortcuts import render
from django.core.paginator import Paginator
from django.db.models import Q
from django.utils import translation
from apps.gnous_eu.models import Service