From 1ee9d7dd522c4a464aa188043c5c350472c04d4a Mon Sep 17 00:00:00 2001 From: David Larlet Date: Tue, 6 Feb 2024 12:45:40 -0500 Subject: [PATCH 1/2] feat: allow to inject a header.html template Useful to add scripts integration like Sentry --- umap/templates/base.html | 1 + umap/templates/registration/login.html | 1 + umap/templates/umap/content.html | 1 + umap/templates/umap/header.html | 0 umap/templates/umap/map_detail.html | 1 + 5 files changed, 4 insertions(+) create mode 100644 umap/templates/umap/header.html diff --git a/umap/templates/base.html b/umap/templates/base.html index 50e83fac..35be9099 100644 --- a/umap/templates/base.html +++ b/umap/templates/base.html @@ -12,6 +12,7 @@ content="{% trans "uMap lets you create maps with OpenStreetMap layers in a minute and embed them in your site." %}"> {% block extra_head %} + {% include "umap/header.html" %} {% endblock extra_head %} diff --git a/umap/templates/registration/login.html b/umap/templates/registration/login.html index d88bffe6..a5b850b8 100644 --- a/umap/templates/registration/login.html +++ b/umap/templates/registration/login.html @@ -2,6 +2,7 @@ {% load umap_tags i18n %} {% block extra_head %} {% umap_css %} + {{ block.super }} {% endblock extra_head %} {% block body_class %} login diff --git a/umap/templates/umap/content.html b/umap/templates/umap/content.html index ecabe18c..bf414571 100644 --- a/umap/templates/umap/content.html +++ b/umap/templates/umap/content.html @@ -5,6 +5,7 @@ {% endblock body_class %} {% block extra_head %} {% umap_css %} + {{ block.super }} {% umap_js %} {% endblock extra_head %} {% block header %} diff --git a/umap/templates/umap/header.html b/umap/templates/umap/header.html new file mode 100644 index 00000000..e69de29b diff --git a/umap/templates/umap/map_detail.html b/umap/templates/umap/map_detail.html index 7685e584..22f272c5 100644 --- a/umap/templates/umap/map_detail.html +++ b/umap/templates/umap/map_detail.html @@ -13,6 +13,7 @@ {% endfor %} {% endif %} {% umap_css %} + {{ block.super }} {% umap_js locale=locale %} {% if object.share_status != object.PUBLIC %}{% endif %} Date: Tue, 6 Feb 2024 12:56:09 -0500 Subject: [PATCH 2/2] docs: customizing header/footer templates --- docs/config/customize.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/config/customize.md b/docs/config/customize.md index 9c2eb202..c36af4e1 100644 --- a/docs/config/customize.md +++ b/docs/config/customize.md @@ -99,4 +99,16 @@ There are three settings you can play with to control that: # Which field to use in the URL, may also be for example "pk" to use the # primary key and not expose the username (which may be private or may change too # often for URL persistance) - USER_URL_FIELD = "username" \ No newline at end of file + USER_URL_FIELD = "username" + + +## Custom header and/or footer scripts + +You can populate the content of you own `umap/header.html` and `umap/footer.html` +templates with `