From c68286e010a7620cf67c215954d90b990410b68e Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Wed, 8 May 2024 14:01:01 +0200 Subject: [PATCH] more flexible navbar code in base template --- .../css => css/materialize}/fixes.css | 0 .../css => css/materialize}/sidenav-fixed.css | 0 .../css => css/materialize}/sticky-footer.css | 0 app/templates/_base/navbar.html.j2 | 44 ------------------- .../_base/navbar_primary_content.html.j2 | 38 ++++++++++++++++ app/templates/_base/stylesheets.html.j2 | 6 +-- app/templates/base.html.j2 | 42 +++++++++++++++--- 7 files changed, 76 insertions(+), 54 deletions(-) rename app/static/{materialize/css => css/materialize}/fixes.css (100%) rename app/static/{materialize/css => css/materialize}/sidenav-fixed.css (100%) rename app/static/{materialize/css => css/materialize}/sticky-footer.css (100%) delete mode 100644 app/templates/_base/navbar.html.j2 create mode 100644 app/templates/_base/navbar_primary_content.html.j2 diff --git a/app/static/materialize/css/fixes.css b/app/static/css/materialize/fixes.css similarity index 100% rename from app/static/materialize/css/fixes.css rename to app/static/css/materialize/fixes.css diff --git a/app/static/materialize/css/sidenav-fixed.css b/app/static/css/materialize/sidenav-fixed.css similarity index 100% rename from app/static/materialize/css/sidenav-fixed.css rename to app/static/css/materialize/sidenav-fixed.css diff --git a/app/static/materialize/css/sticky-footer.css b/app/static/css/materialize/sticky-footer.css similarity index 100% rename from app/static/materialize/css/sticky-footer.css rename to app/static/css/materialize/sticky-footer.css diff --git a/app/templates/_base/navbar.html.j2 b/app/templates/_base/navbar.html.j2 deleted file mode 100644 index 50763f4e..00000000 --- a/app/templates/_base/navbar.html.j2 +++ /dev/null @@ -1,44 +0,0 @@ - diff --git a/app/templates/_base/navbar_primary_content.html.j2 b/app/templates/_base/navbar_primary_content.html.j2 new file mode 100644 index 00000000..0df9b5dc --- /dev/null +++ b/app/templates/_base/navbar_primary_content.html.j2 @@ -0,0 +1,38 @@ +{% if current_user.is_authenticated %} + + +menu +{% endif %} + + + + + + + + + + diff --git a/app/templates/_base/stylesheets.html.j2 b/app/templates/_base/stylesheets.html.j2 index d8adca98..1e0b3659 100644 --- a/app/templates/_base/stylesheets.html.j2 +++ b/app/templates/_base/stylesheets.html.j2 @@ -1,10 +1,10 @@ {% if current_user.is_authenticated -%} - + {% endif -%} - - + + {% assets diff --git a/app/templates/base.html.j2 b/app/templates/base.html.j2 index 6890f9af..6b20a0a6 100644 --- a/app/templates/base.html.j2 +++ b/app/templates/base.html.j2 @@ -2,6 +2,14 @@ {% set title = 'nopaque' %} {% endif %} +{% if navbar_fixed is not defined %} +{% set navbar_fixed = true %} +{% endif %} + +{% if navbar_extended is not defined %} +{% set navbar_extended = false %} +{% endif %} + {% block doc %} @@ -27,9 +35,27 @@ {% block body %}
{% block header %} - {% block navbar %} - {% include "_base/navbar.html.j2" %} - {% endblock navbar %} + {% if navbar_fixed %} + + {% endif %} {% block sidenav %} {% if current_user.is_authenticated %} {% include "_base/sidenav.html.j2" %} @@ -41,6 +67,7 @@
{% block main %} {% block page_content %}{% endblock page_content %} + {% endblock main %} - {% endblock main %}
@@ -62,9 +88,11 @@ {% endblock footer %}
- {% block scripts %} - {% include "_base/scripts.html.j2" %} - {% endblock scripts %} +
+ {% block scripts %} + {% include "_base/scripts.html.j2" %} + {% endblock scripts %} +
{% endblock body %} {% endblock html %}