diff --git a/matemat/webserver/responses.py b/matemat/webserver/responses.py index f1e7f90..6f0308f 100644 --- a/matemat/webserver/responses.py +++ b/matemat/webserver/responses.py @@ -1,6 +1,8 @@ from jinja2 import Environment, Template +from matemat import __version__ + class PageletResponse: """ @@ -60,4 +62,4 @@ class TemplateResponse(PageletResponse): :return: An UTF-8 encoded bytes object containing the template rendering result. """ template: Template = jinja_env.get_template(self.name) - return template.render(**self.kwargs).encode('utf-8') + return template.render(**self.kwargs, __version__=__version__).encode('utf-8') diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..1ddd113 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,17 @@ + + + + Matemat + + + +

Matemat {{__version__}}

+ {% block main %} + {% endblock %} + + diff --git a/templates/login.html b/templates/login.html index bdb7168..13c5dca 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,20 +1,9 @@ - - - - Matemat - - - -

Matemat

+{% extends "base.html" %} + +{% block main %}
Username:
Password:
- - +{% endblock%} diff --git a/templates/main.html b/templates/main.html index d9a6d45..6aa5887 100644 --- a/templates/main.html +++ b/templates/main.html @@ -1,16 +1,6 @@ - - - - Matemat - - - -

Matemat

+{% extends "base.html" %} + +{% block main %} {{ user|default("") }} - - +{% endblock %} diff --git a/templates/touchkey.html b/templates/touchkey.html index ab12308..bb0a5b9 100644 --- a/templates/touchkey.html +++ b/templates/touchkey.html @@ -1,20 +1,9 @@ - - - - Matemat - - - -

Matemat

+{% extends "base.html" %} + +{% block main %}

Touchkey:
- - +{% endblock %}