Skip to content

Commit a447028

Browse files
liam-middlebrookmbillow
authored andcommitted
Add git revision footer to every non-preso page (#92)
* Add git revision footer to every non-preso page * Style Revision Footer
1 parent 86c9f52 commit a447028

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

conditional/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import subprocess
23
from flask import Flask
34
from flask import redirect
45
from flask_sqlalchemy import SQLAlchemy
@@ -13,6 +14,10 @@
1314
app.config.from_pyfile(config)
1415
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
1516

17+
app.config["GIT_REVISION"] = subprocess.check_output(['git',
18+
'rev-parse',
19+
'--short',
20+
'HEAD']).decode('utf-8').rstrip()
1621
db = SQLAlchemy(app)
1722
migrate = Migrate(app, db)
1823
logger = structlog.get_logger()

conditional/templates/base.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
</div>
2929
{% endif %}
3030

31+
<footer>
32+
<a class="footer-version" href="https://github.com/ComputerScienceHouse/conditional/tree/{{config["GIT_REVISION"]}}">Conditional ({{config["GIT_REVISION"]}})</a>
33+
</footer>
3134
<script src="/static/js/app.js"></script>
32-
{% block extraFooter %}
33-
{% endblock %}
3435
</body>
3536
</html>

frontend/stylesheets/partials/_global.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,16 @@ tr {
6464
opacity: .5;
6565
}
6666
}
67+
68+
.footer-version {
69+
display: block;
70+
opacity: .3;
71+
margin: 10px auto 20px;
72+
text-align: center;
73+
color: #000;
74+
font-size: .9em;
75+
&:hover {
76+
text-decoration: none;
77+
color: #000;
78+
}
79+
}

0 commit comments

Comments
 (0)