From e06b472d62f23a35be46b36abbed08d006adfd2a Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Tue, 18 Mar 2025 11:56:02 +0100 Subject: [PATCH 1/2] Reduce template code duplication --- .../frontend/templates/account/login.html | 78 +++++++++---------- .../frontend/templates/frontend/base.html | 11 +++ .../frontend/organizations/create.html | 12 +-- .../frontend/templates/frontend/profile.html | 64 +++++++-------- 4 files changed, 78 insertions(+), 87 deletions(-) diff --git a/src/servala/frontend/templates/account/login.html b/src/servala/frontend/templates/account/login.html index 3100278..6494b6a 100644 --- a/src/servala/frontend/templates/account/login.html +++ b/src/servala/frontend/templates/account/login.html @@ -6,48 +6,40 @@ {% translate "Sign In" %} {% endblock page_title %} {% endblock html_title %} -{% block content %} -
-
-
-
- {% if SOCIALACCOUNT_ENABLED %} - {% get_providers as socialaccount_providers %} - {% if socialaccount_providers %} - {% for provider in socialaccount_providers %} - {% provider_login_url provider process=process scope=scope auth_params=auth_params as href %} -
- {% csrf_token %} - -
- {% endfor %} - {% endif %} - {% endif %} -
- - - {% translate "Log in with email and password instead" %} - -
- {% url 'account_login' as form_action %} - {% translate "Sign In" as form_submit_label %} - {% include "includes/form.html" %} -
-
-
-
+{% block card_content %} + {% if SOCIALACCOUNT_ENABLED %} + {% get_providers as socialaccount_providers %} + {% if socialaccount_providers %} + {% for provider in socialaccount_providers %} + {% provider_login_url provider process=process scope=scope auth_params=auth_params as href %} +
+ {% csrf_token %} + +
+ {% endfor %} + {% endif %} + {% endif %} +
+ + + {% translate "Log in with email and password instead" %} + +
+ {% url 'account_login' as form_action %} + {% translate "Sign In" as form_submit_label %} + {% include "includes/form.html" %}
-
+ {% endblock content %} diff --git a/src/servala/frontend/templates/frontend/base.html b/src/servala/frontend/templates/frontend/base.html index ab724f8..80dd44e 100644 --- a/src/servala/frontend/templates/frontend/base.html +++ b/src/servala/frontend/templates/frontend/base.html @@ -32,6 +32,17 @@ {% include "includes/message.html" %} {% endfor %} {% block content %} +
+
+ {% block card_header %}{% endblock %} +
+
+ {% block card_content %} + {% endblock card_content %} +
+
+
+
{% endblock content %}