Skip to content

Commit

Permalink
Add the version number of the platform to the top navbar
Browse files Browse the repository at this point in the history
Currently, the version number must be updated manually in the file
`aplus/__init__.py`.
  • Loading branch information
markkuriekkinen committed Oct 27, 2021
1 parent 6a9f707 commit 40a6580
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions aplus/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__version__ = '1.11.0'
"""The version of the A-plus platform."""
VERSION = __version__
1 change: 1 addition & 0 deletions aplus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.contrib.messages.context_processors.messages",
"lib.context_processors.aplus_version",
],
},
},
Expand Down
6 changes: 6 additions & 0 deletions assets/sass/layout/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
}
}

.navbar-brand + .navbar-text {
float: left;
font-size: $font-size-small;
color: $gray-lighter;
}

.navbar-toggle .badge {
position: absolute;
right: -10px;
Expand Down
9 changes: 9 additions & 0 deletions lib/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Django template context processors that may be enabled in settings.py (TEMPLATES)."""

from aplus import VERSION


def aplus_version(request):
return {
'APLUS_VERSION': 'v' + VERSION,
}
1 change: 1 addition & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{% url 'home' %}">{% brand_name %}</a>
<p class="navbar-text">{{ APLUS_VERSION }}</p>
<ul class="nav navbar-dropdown">
<li role="separator" class="divider"></li>
<li role="presentation" class="dropdown">
Expand Down

0 comments on commit 40a6580

Please sign in to comment.