From 6ac204d43cc408bd010a4256b55847ee2b7a54da Mon Sep 17 00:00:00 2001 From: Toby Qin Date: Wed, 1 Nov 2017 10:54:47 +0800 Subject: [PATCH] show site version. --- testcube/core/api/client_auth.py | 5 ++--- testcube/settings.py | 1 + testcube/static/require-config.js | 8 ++++++++ testcube/templates/base.html | 2 +- testcube/templates/snippets/footer.html | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/testcube/core/api/client_auth.py b/testcube/core/api/client_auth.py index dbbf71c..b1a8ed9 100644 --- a/testcube/core/api/client_auth.py +++ b/testcube/core/api/client_auth.py @@ -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 @@ -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!') diff --git a/testcube/settings.py b/testcube/settings.py index f311b4d..76dd194 100644 --- a/testcube/settings.py +++ b/testcube/settings.py @@ -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/ diff --git a/testcube/static/require-config.js b/testcube/static/require-config.js index 9270a30..30b1e1f 100644 --- a/testcube/static/require-config.js +++ b/testcube/static/require-config.js @@ -103,3 +103,11 @@ window.loadingCompleted = function () { }) }; +window.updateSiteVersion = function () { + require(['jquery'], function ($) { + $('#site-version').append(version); + }) +}; + +updateSiteVersion(); + diff --git a/testcube/templates/base.html b/testcube/templates/base.html index 02c00a1..e1dc0a1 100644 --- a/testcube/templates/base.html +++ b/testcube/templates/base.html @@ -50,7 +50,7 @@ {% block scripts %} {% endblock %} diff --git a/testcube/templates/snippets/footer.html b/testcube/templates/snippets/footer.html index 168f641..ce4f871 100644 --- a/testcube/templates/snippets/footer.html +++ b/testcube/templates/snippets/footer.html @@ -3,7 +3,7 @@