From 7399419287d173fdd12e4dcaaf0a88df66400360 Mon Sep 17 00:00:00 2001
From: nd <git@notandy.de>
Date: Fri, 25 Sep 2020 14:27:32 +0200
Subject: [PATCH] show version in footer, closes #13

---
 uffd/static/style.css    | 2 +-
 uffd/template_helper.py  | 6 +++---
 uffd/templates/base.html | 4 ++++
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/uffd/static/style.css b/uffd/static/style.css
index 8aecff42..dde08a59 100644
--- a/uffd/static/style.css
+++ b/uffd/static/style.css
@@ -1,5 +1,5 @@
 .footer {
-	position: absolute;
+	position: fixed;
 	bottom: 0;
 	width: 100%;
 	height: 2em;
diff --git a/uffd/template_helper.py b/uffd/template_helper.py
index 3dcfbd27..66e1e334 100644
--- a/uffd/template_helper.py
+++ b/uffd/template_helper.py
@@ -8,7 +8,7 @@ def register_template_helper(app):
 		return a == b
 
 	@app.url_defaults
-	def static_version_inject(endpoint, values):
+	def static_version_inject(endpoint, values): #pylint: disable=unused-variable
 		if endpoint == 'static':
 			values['v'] = app.jinja_env.globals['gitversion']['longhash'] #pylint: disable=no-member
 
@@ -23,5 +23,5 @@ def register_template_helper(app):
 	app.add_template_global(equalto, name='equalto')
 
 	# get git commit
-	GITOUTPUT = subprocess.check_output(['git', "log", "-g", "-1", "--pretty=%H#%h#%d#%s"]).decode('UTF-8').split('#', 3)
-	app.jinja_env.globals['gitversion'] = {'hash': GITOUTPUT[1], 'longhash': GITOUTPUT[0], 'branch': GITOUTPUT[2], 'msg': GITOUTPUT[3]} #pylint: disable=no-member
+	git_output = subprocess.check_output(['git', "log", "-g", "-1", "--pretty=%H#%h#%d#%s"]).decode('UTF-8').split('#', 3)
+	app.jinja_env.globals['gitversion'] = {'hash': git_output[1], 'longhash': git_output[0], 'branch': git_output[2], 'msg': git_output[3]} #pylint: disable=no-member
diff --git a/uffd/templates/base.html b/uffd/templates/base.html
index 66f90a7d..22360863 100644
--- a/uffd/templates/base.html
+++ b/uffd/templates/base.html
@@ -102,6 +102,10 @@
 					{% for link in config["FOOTER_LINKS"]%}
 					<li class="list-inline-item"><a href="{{ link.url }}">{{ link.title }}</a></li>
 					{% endfor %}
+					<li class="list-inline-item float-right">
+						<a href="https://git.cccv.de/infra/uffd/uffd/">Sourcecode</a>
+						<a target="_blank" href="https://git.cccv.de/infra/uffd/uffd/-/commit/{{ gitversion.longhash }}"><span title="{{ gitversion.branch }} {{ gitversion.hash }}: {{ gitversion.msg }}" data-toggle="tooltip">Version: {{ gitversion.hash }}</span></a>
+					</li>
 				</ul>
 			</div>
 			{% endblock footer %}
-- 
GitLab