From b188f9d5b203bd92b8f0df317283acb517a8ea12 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Sun, 25 Jan 2026 11:46:02 -0300 Subject: [PATCH] split base template in multiple files --- templates/base.html | 400 +----------------- templates/base_login.html | 2 +- .../template_parts/base_content_header.html | 31 ++ templates/template_parts/base_footer.html | 15 + .../template_parts/base_generic_modal.html | 25 ++ templates/template_parts/base_head.html | 28 ++ .../base_messages.html} | 0 templates/template_parts/base_navbar.html | 26 ++ .../base_pending_changes_warning.html | 27 ++ templates/template_parts/base_scripts.html | 124 ++++++ templates/template_parts/base_sidebar.html | 107 +++++ 11 files changed, 402 insertions(+), 383 deletions(-) create mode 100644 templates/template_parts/base_content_header.html create mode 100644 templates/template_parts/base_footer.html create mode 100644 templates/template_parts/base_generic_modal.html create mode 100644 templates/template_parts/base_head.html rename templates/{template_messages.html => template_parts/base_messages.html} (100%) create mode 100644 templates/template_parts/base_navbar.html create mode 100644 templates/template_parts/base_pending_changes_warning.html create mode 100644 templates/template_parts/base_scripts.html create mode 100644 templates/template_parts/base_sidebar.html diff --git a/templates/base.html b/templates/base.html index 709bc2b..f32a3ef 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,39 +1,14 @@ {% load i18n %} -{% get_current_language as CURRENT_LANGUAGE %} - - - - - {% if page_title %}{{page_title}} | {% endif %}wireguard-webadmin - - - - - - - - - - - - - - - - - - - - - - - - - {% block page_custom_head %}{% endblock%} - {% load custom_tags %} {% tag_webadmin_version as webadmin_version %} +{% get_current_language as CURRENT_LANGUAGE %} + + + + {% include 'template_parts/base_head.html' %} + {% block page_custom_head %}{% endblock %} +
@@ -42,31 +17,7 @@
- - - + {% include 'template_parts/base_navbar.html' %}
- -
-
- {% if page_title %} -
-
-

{{ page_title }}

-
-
- -
-
- {% endif %} -
-
- - - - - - + {% include 'template_parts/base_content_header.html' %} + {% include 'template_parts/base_generic_modal.html' %} - - - -
- {% if pending_changes_warning %} - - {% endif %} + {% include 'template_parts/base_pending_changes_warning.html' %} {% block content %}{% endblock %} +
-
- {% if webadmin_version.update_available %}{% trans 'Update Available' %}{% else %}wireguard-webadmin {% endif %} -
- {% trans 'Version' %} {{ webadmin_version.current_version }} -
-
- - - + {% include 'template_parts/base_footer.html' %} +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{% include "template_messages.html" %} - - - - - - - -{% block custom_page_scripts %} - -{% endblock %} +{% include 'template_parts/base_scripts.html' %} +{% include 'template_parts/base_messages.html' %} +{% block custom_page_scripts %}{% endblock %} \ No newline at end of file diff --git a/templates/base_login.html b/templates/base_login.html index 5420ae6..7d537b8 100644 --- a/templates/base_login.html +++ b/templates/base_login.html @@ -26,6 +26,6 @@ -{% include "template_messages.html" %} +{% include 'template_parts/base_messages.html' %} \ No newline at end of file diff --git a/templates/template_parts/base_content_header.html b/templates/template_parts/base_content_header.html new file mode 100644 index 0000000..7f0b467 --- /dev/null +++ b/templates/template_parts/base_content_header.html @@ -0,0 +1,31 @@ +{% load i18n %} + +
+
+ {% if page_title %} +
+
+

{{ page_title }}

+
+
+ +
+
+ {% endif %} +
+
+ \ No newline at end of file diff --git a/templates/template_parts/base_footer.html b/templates/template_parts/base_footer.html new file mode 100644 index 0000000..10b8513 --- /dev/null +++ b/templates/template_parts/base_footer.html @@ -0,0 +1,15 @@ +{% load i18n %} + + + + + \ No newline at end of file diff --git a/templates/template_parts/base_generic_modal.html b/templates/template_parts/base_generic_modal.html new file mode 100644 index 0000000..1fe3646 --- /dev/null +++ b/templates/template_parts/base_generic_modal.html @@ -0,0 +1,25 @@ +{% load i18n %} + + + + \ No newline at end of file diff --git a/templates/template_parts/base_head.html b/templates/template_parts/base_head.html new file mode 100644 index 0000000..47cc03c --- /dev/null +++ b/templates/template_parts/base_head.html @@ -0,0 +1,28 @@ +{% load i18n %} + + +{% if page_title %}{{ page_title }} | {% endif %}wireguard-webadmin + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/template_messages.html b/templates/template_parts/base_messages.html similarity index 100% rename from templates/template_messages.html rename to templates/template_parts/base_messages.html diff --git a/templates/template_parts/base_navbar.html b/templates/template_parts/base_navbar.html new file mode 100644 index 0000000..aa301f9 --- /dev/null +++ b/templates/template_parts/base_navbar.html @@ -0,0 +1,26 @@ +{% load i18n %} + + + \ No newline at end of file diff --git a/templates/template_parts/base_pending_changes_warning.html b/templates/template_parts/base_pending_changes_warning.html new file mode 100644 index 0000000..1f4ee1f --- /dev/null +++ b/templates/template_parts/base_pending_changes_warning.html @@ -0,0 +1,27 @@ +{% load i18n %} +{% if pending_changes_warning %} + +{% endif %} \ No newline at end of file diff --git a/templates/template_parts/base_scripts.html b/templates/template_parts/base_scripts.html new file mode 100644 index 0000000..d2d74cd --- /dev/null +++ b/templates/template_parts/base_scripts.html @@ -0,0 +1,124 @@ +{% load i18n %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/template_parts/base_sidebar.html b/templates/template_parts/base_sidebar.html new file mode 100644 index 0000000..c2e1018 --- /dev/null +++ b/templates/template_parts/base_sidebar.html @@ -0,0 +1,107 @@ +{% load i18n %} + + + \ No newline at end of file