From e25d5c9fc9262862e4b26d9d6893c387d31e7474 Mon Sep 17 00:00:00 2001 From: Maxim Stewart Date: Thu, 5 Nov 2020 12:50:45 -0600 Subject: [PATCH] Structural changes --- src/core/routes/Routes.py | 6 +++--- src/core/routes/pages/Flask_Login.py | 2 +- src/core/routes/pages/Flask_Register.py | 2 +- src/core/routes/pages/OIDC_Register.py | 2 +- src/core/templates/error.html | 16 +++++++--------- src/core/templates/layout.html | 7 +++++-- src/core/templates/{ => pages}/about.html | 12 +++++------- src/core/templates/{ => pages}/index.html | 0 src/core/templates/{ => pages}/login.html | 6 ++---- src/core/templates/{ => pages}/protected.html | 12 +++++------- src/core/templates/{ => pages}/react-page.html | 0 src/core/templates/{ => pages}/register.html | 6 ++---- 12 files changed, 32 insertions(+), 39 deletions(-) rename src/core/templates/{ => pages}/about.html (72%) rename src/core/templates/{ => pages}/index.html (100%) rename src/core/templates/{ => pages}/login.html (96%) rename src/core/templates/{ => pages}/protected.html (72%) rename src/core/templates/{ => pages}/react-page.html (100%) rename src/core/templates/{ => pages}/register.html (97%) diff --git a/src/core/routes/Routes.py b/src/core/routes/Routes.py index 0a2991f..1f05fbc 100644 --- a/src/core/routes/Routes.py +++ b/src/core/routes/Routes.py @@ -16,7 +16,7 @@ msgHandler = MessageHandler() @app.route('/', methods=['GET', 'POST']) def home(): if request.method == 'GET': - return render_template('index.html') + return render_template('pages/index.html') return render_template('error.html', title='Error!', @@ -26,7 +26,7 @@ def home(): @app.route('/about', methods=['GET', 'POST']) def about(): if request.method == 'GET': - return render_template('about.html') + return render_template('pages/about.html') return render_template('error.html', title = 'Error!', message = 'Must use GET request type...') @@ -39,7 +39,7 @@ def protected_zone(): if current_user.is_authenticated or oidc.user_loggedin: msg = "There is no secret! It was all a lie!" - return render_template('protected.html', secret = msg) + return render_template('pages/protected.html', secret = msg) return render_template('error.html', title = 'Error!', message = 'Must use GET request type...') diff --git a/src/core/routes/pages/Flask_Login.py b/src/core/routes/pages/Flask_Login.py index 8ca8b78..855b8d6 100644 --- a/src/core/routes/pages/Flask_Login.py +++ b/src/core/routes/pages/Flask_Login.py @@ -28,7 +28,7 @@ def app_login(): flash("Username or password incorrect! Please try again...", "danger") - return render_template('login.html', title=TITLE, form=_form) + return render_template('pages/login.html', title=TITLE, form=_form) @app.route('/app-logout') diff --git a/src/core/routes/pages/Flask_Register.py b/src/core/routes/pages/Flask_Register.py index 39f9c12..d972ecb 100644 --- a/src/core/routes/pages/Flask_Register.py +++ b/src/core/routes/pages/Flask_Register.py @@ -26,6 +26,6 @@ def app_register(): flash("Account created successfully!", "success") return redirect(url_for("login")) - return render_template('register.html', + return render_template('pages/register.html', title = TITLE, form = _form) diff --git a/src/core/routes/pages/OIDC_Register.py b/src/core/routes/pages/OIDC_Register.py index 9ac912b..0b24ebc 100644 --- a/src/core/routes/pages/OIDC_Register.py +++ b/src/core/routes/pages/OIDC_Register.py @@ -27,6 +27,6 @@ def oidc_register(): flash("Account created successfully!", "success") return redirect("/login") - return render_template('register.html', + return render_template('pages/register.html', title = TITLE, form = _form) diff --git a/src/core/templates/error.html b/src/core/templates/error.html index 9e45501..73b9d43 100644 --- a/src/core/templates/error.html +++ b/src/core/templates/error.html @@ -1,15 +1,13 @@ {% extends "layout.html" %} -{% block content %} -
-
-
- -

{{title}}

-

{{message}}

-
+{% block body_content_additional %} +
+
+ +

{{title}}

+

{{message}}

-{% endblock content %} +{% endblock body_content_additional %} {% block scripts %} diff --git a/src/core/templates/layout.html b/src/core/templates/layout.html index 5d675e8..a34ee8f 100644 --- a/src/core/templates/layout.html +++ b/src/core/templates/layout.html @@ -58,10 +58,13 @@ {% endif %} {% endwith %} + +
{% block body_content %} - {% block body_content_additional %} - {% endblock body_content_additional%} + {% block body_content_additional %} + {% endblock body_content_additional%} {% endblock %} +
{% block body_footer %} diff --git a/src/core/templates/about.html b/src/core/templates/pages/about.html similarity index 72% rename from src/core/templates/about.html rename to src/core/templates/pages/about.html index 963c79a..b03db9c 100644 --- a/src/core/templates/about.html +++ b/src/core/templates/pages/about.html @@ -3,15 +3,13 @@ {% block body_header_additional %} {% endblock body_header_additional %} -{% block body_content %} -
-
-
-

Login stub...

-
+{% block body_content_additional %} +
+
+

Login stub...

-{% endblock body_content %} +{% endblock body_content_additional %} {% block body_footer_additional %} diff --git a/src/core/templates/index.html b/src/core/templates/pages/index.html similarity index 100% rename from src/core/templates/index.html rename to src/core/templates/pages/index.html diff --git a/src/core/templates/login.html b/src/core/templates/pages/login.html similarity index 96% rename from src/core/templates/login.html rename to src/core/templates/pages/login.html index 253bb65..5afcda1 100644 --- a/src/core/templates/login.html +++ b/src/core/templates/pages/login.html @@ -3,8 +3,7 @@ {% block body_header_additional %} {% endblock body_header_additional %} -{% block body_content %} -
+{% block body_content_additional %}
@@ -47,8 +46,7 @@
-
-{% endblock body_content %} +{% endblock body_content_additional %} {% block body_footer_additional %} diff --git a/src/core/templates/protected.html b/src/core/templates/pages/protected.html similarity index 72% rename from src/core/templates/protected.html rename to src/core/templates/pages/protected.html index 1d76387..8aa12f5 100644 --- a/src/core/templates/protected.html +++ b/src/core/templates/pages/protected.html @@ -3,15 +3,13 @@ {% block body_header_additional %} {% endblock body_header_additional %} -{% block body_content %} -
-
-
-

{{secret}}

-
+{% block body_content_additional %} +
+
+

{{secret}}

-{% endblock body_content %} +{% endblock body_content_additional %} {% block body_footer_additional %} diff --git a/src/core/templates/react-page.html b/src/core/templates/pages/react-page.html similarity index 100% rename from src/core/templates/react-page.html rename to src/core/templates/pages/react-page.html diff --git a/src/core/templates/register.html b/src/core/templates/pages/register.html similarity index 97% rename from src/core/templates/register.html rename to src/core/templates/pages/register.html index 58f8bbb..3ed65a2 100644 --- a/src/core/templates/register.html +++ b/src/core/templates/pages/register.html @@ -3,8 +3,7 @@ {% block body_header_additional %} {% endblock body_header_additional %} -{% block body_content %} -
+{% block body_content_additional %}
@@ -75,8 +74,7 @@
-
-{% endblock body_content %} +{% endblock body_content_additional %} {% block body_footer_additional %}