Skip to content

Commit

Permalink
show site version.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyqin committed Nov 1, 2017
1 parent 076a49b commit 6ac204d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
5 changes: 2 additions & 3 deletions testcube/core/api/client_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from ipware.ip import get_ip

from testcube.core.models import TestClient

version = '1.3'
from testcube.settings import VERSION


@csrf_exempt
Expand Down Expand Up @@ -54,6 +53,6 @@ def register(request):
'first_time_register': created})

else:
return HttpResponse(content=version)
return HttpResponse(content=VERSION)

return HttpResponseBadRequest('Failed to register testcube!')
1 change: 1 addition & 0 deletions testcube/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

SETTINGS_DIR = dirname(abspath(__file__))
BASE_DIR = dirname(SETTINGS_DIR)
VERSION = '1.8'

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
Expand Down
8 changes: 8 additions & 0 deletions testcube/static/require-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,11 @@ window.loadingCompleted = function () {
})
};

window.updateSiteVersion = function () {
require(['jquery'], function ($) {
$('#site-version').append(version);
})
};

updateSiteVersion();

2 changes: 1 addition & 1 deletion testcube/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{% block scripts %}
<script>
require(['/static/require-config.js'], function () {
console.log('config initialized.')
updateSiteVersion();
});
</script>
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion testcube/templates/snippets/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<footer>
<p>
&copy; Powered by <a class="ui link active" href="https://github.com/tobyqin/testcube">
TestCube</a> - <a class="item" href="/api"> API </a> -
TestCube <span id="site-version"></span></a> - <a class="item" href="/api"> API </a> -
<a class="item" href="https://github.com/tobyqin/testcube/issues"> Report Issue </a>
</p>
</footer>
Expand Down

0 comments on commit 6ac204d

Please sign in to comment.