diff --git a/Makefile b/Makefile index 8371fba9..09475d90 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,10 @@ install: ## Install the dependencies develop: ## Install the test and dev dependencies python3 -m pip install -e .[test,dev] +.PHONY: pretty-templates +pretty-templates: ## Prettify template files + djlint umap/templates --reformat + .PHONY: version version: ## Display the current version @hatch version diff --git a/pyproject.toml b/pyproject.toml index 318b4ee1..c2807567 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ dependencies = [ dev = [ "hatch==1.7.0", "black==21.10b0", + "djlint==1.31.0", "mkdocs==1.2.3", ] test = [ @@ -75,3 +76,8 @@ path = "umap/__init__.py" [tool.flake8] # Black crazyness. max-line-length = 88 + +[tool.djlint] +profile="django" +indent=2 +format_css=true diff --git a/umap/templates/404.html b/umap/templates/404.html index de61d244..615f31e1 100644 --- a/umap/templates/404.html +++ b/umap/templates/404.html @@ -1,12 +1,14 @@ {% extends "base.html" %} - {% load i18n static %} - {% block content %} -
- -

44

-

Not Found

-
-
-{% endblock %} \ No newline at end of file +
+ +

+ 4 + + 4 +

+

Not Found

+
+
+{% endblock %} diff --git a/umap/templates/500.html b/umap/templates/500.html index 91b60c1c..a1c762c8 100644 --- a/umap/templates/500.html +++ b/umap/templates/500.html @@ -1,6 +1,6 @@ - + Ooops - - - -
- -

Oops, Server error…

-
- - + + +
+ +

Oops, Server error…

+
+ diff --git a/umap/templates/auth/user_detail.html b/umap/templates/auth/user_detail.html index 363b1529..ea8c6253 100644 --- a/umap/templates/auth/user_detail.html +++ b/umap/templates/auth/user_detail.html @@ -1,20 +1,16 @@ {% extends "umap/content.html" %} - {% load i18n %} - {% block maincontent %} -
-

{% blocktrans %}Browse {{ current_user }}'s maps{% endblocktrans %}

-
-
-
- {% if maps %} - {% include "umap/map_list.html" %} - {% else %} -
- {% blocktrans %}{{ current_user }} has no maps.{% endblocktrans %} +
+

{% blocktrans %}Browse {{ current_user }}'s maps{% endblocktrans %}

+
+
+
+ {% if maps %} + {% include "umap/map_list.html" %} + {% else %} +
{% blocktrans %}{{ current_user }} has no maps.{% endblocktrans %}
+ {% endif %}
- {% endif %} -
-
+
{% endblock maincontent %} diff --git a/umap/templates/auth/user_stars.html b/umap/templates/auth/user_stars.html index 47c3e569..f2428446 100644 --- a/umap/templates/auth/user_stars.html +++ b/umap/templates/auth/user_stars.html @@ -1,20 +1,16 @@ {% extends "umap/content.html" %} - {% load i18n %} - {% block maincontent %} -
-

{% blocktrans %}Browse {{ current_user }}'s starred maps{% endblocktrans %}

-
-
-
- {% if maps %} - {% include "umap/map_list.html" %} - {% else %} -
- {% blocktrans %}{{ current_user }} has no starred maps yet.{% endblocktrans %} +
+

{% blocktrans %}Browse {{ current_user }}'s starred maps{% endblocktrans %}

+
+
+
+ {% if maps %} + {% include "umap/map_list.html" %} + {% else %} +
{% blocktrans %}{{ current_user }} has no starred maps yet.{% endblocktrans %}
+ {% endif %}
- {% endif %} -
-
+
{% endblock maincontent %} diff --git a/umap/templates/base.html b/umap/templates/base.html index 1ea6fd24..f0f08648 100644 --- a/umap/templates/base.html +++ b/umap/templates/base.html @@ -1,26 +1,25 @@ {% load compress umap_tags i18n %} - - - {% block head_title %}{{ SITE_NAME }}{% endblock %} + + + + {% block head_title %}{{ SITE_NAME }}{% endblock %} + {% block extra_head %} {% endblock extra_head %} - - - - - + + + {% block header %} {% endblock header %} - {% block content %} {% endblock content %} {% block bottom_js %} {% endblock bottom_js %} - {% block footer %} - {% include "umap/footer.html" %} + {% include "umap/footer.html" %} {% endblock footer %} - + diff --git a/umap/templates/registration/login.html b/umap/templates/registration/login.html index 265af5d6..8339cb53 100644 --- a/umap/templates/registration/login.html +++ b/umap/templates/registration/login.html @@ -1,37 +1,37 @@ {% load i18n %} - {% if ENABLE_ACCOUNT_LOGIN %} -
{% trans "Please log in with your account" %}
- -
+
{% trans "Please log in with your account" %}
+
{% if form.non_field_errors %} -
    - {% for error in form.non_field_errors %} -
  • {{ error }}
  • - {% endfor %} -
+
    + {% for error in form.non_field_errors %}
  • {{ error }}
  • {% endfor %} +
{% endif %} -
- {% csrf_token %} - {{ form.username.errors }} - - {{ form.password.errors }} - - + {% csrf_token %} + {{ form.username.errors }} + + {{ form.password.errors }} + +
-
+
{% endif %} - {% if backends.backends|length %} -
{% trans "Please choose a provider" %}
-
+
{% trans "Please choose a provider" %}
+
-
+
{% endif %} diff --git a/umap/templates/umap/about.html b/umap/templates/umap/about.html index 2abe82a4..27e2c225 100644 --- a/umap/templates/umap/about.html +++ b/umap/templates/umap/about.html @@ -1,5 +1,4 @@ {% extends "umap/content.html" %} - {% block maincontent %} {% include "umap/about_summary.html" %} {% endblock maincontent %} diff --git a/umap/templates/umap/about_summary.html b/umap/templates/umap/about_summary.html index 7901cb32..6a1756c2 100644 --- a/umap/templates/umap/about_summary.html +++ b/umap/templates/umap/about_summary.html @@ -3,7 +3,9 @@
-

{% blocktrans with osm_url="http://osm.org" %}uMap lets you create maps with OpenStreetMap layers in a minute and embed them in your site.{% endblocktrans %}

+

+ {% blocktrans with osm_url="http://osm.org" %}uMap lets you create maps with OpenStreetMap layers in a minute and embed them in your site.{% endblocktrans %} +

@@ -28,16 +30,16 @@
- {% spaceless %} -
- {% if not UMAP_READONLY %} - {% trans "Create a map" %} - {% endif %} - {% if demo_map %} - {% trans "Play with the demo" %} - {% endif %} -
- {% endspaceless %} + {% spaceless %} +
+ {% if not UMAP_READONLY %} + {% trans "Create a map" %} + {% endif %} + {% if demo_map %} + {% trans "Play with the demo" %} + {% endif %} +
+ {% endspaceless %}
diff --git a/umap/templates/umap/content.html b/umap/templates/umap/content.html index 29f9bf01..c772d8ff 100644 --- a/umap/templates/umap/content.html +++ b/umap/templates/umap/content.html @@ -1,23 +1,18 @@ {% extends "base.html" %} - {% load umap_tags compress i18n %} - {% block body_class %}content{% endblock %} - {% block extra_head %} - {% compress css %} - {% umap_css %} - {% endcompress css %} - {% umap_js %} + {% compress css %} + {% umap_css %} + {% endcompress css %} + {% umap_js %} {% endblock %} - {% block header %}
{% include 'umap/navigation.html' with title=SITE_NAME %}
- {% include 'umap/messages.html' with title=SITE_NAME %} + {% include 'umap/messages.html' with title=SITE_NAME %} {% endblock %} - {% block content %} {% if UMAP_READONLY %}
@@ -38,57 +33,55 @@ {% block maincontent %} {% endblock maincontent %} {% endblock content %} - {% block bottom_js %} {{ block.super }} {% endblock bottom_js %} - {% block footer %} {{ block.super }} {% include "umap/content_footer.html" %} diff --git a/umap/templates/umap/content_footer.html b/umap/templates/umap/content_footer.html index 9e8efa2d..66570584 100644 --- a/umap/templates/umap/content_footer.html +++ b/umap/templates/umap/content_footer.html @@ -1,19 +1,18 @@ {% load i18n %} -
- uMap - an OpenStreetMap project - (version {{ UMAP_VERSION }}) - {% get_language_info_list for LANGUAGES as languages %} -
- {% csrf_token %} - + {% for language in languages %} - {% endfor %} - -
+ {% endfor %} + +
diff --git a/umap/templates/umap/css.html b/umap/templates/umap/css.html index b4d5dfd1..e6bd3627 100644 --- a/umap/templates/umap/css.html +++ b/umap/templates/umap/css.html @@ -1,13 +1,23 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/umap/templates/umap/home.html b/umap/templates/umap/home.html index 45bef52d..cfd9fce0 100644 --- a/umap/templates/umap/home.html +++ b/umap/templates/umap/home.html @@ -1,23 +1,16 @@ {% extends "umap/content.html" %} - {% load umap_tags i18n %} - {% block maincontent %} -{% include "umap/search_bar.html" %} -{% include "umap/about_summary.html" %} -{% if showcase_map %} -
-

{% blocktrans %}Map of the uMaps{% endblocktrans %}

-
- {% map_fragment showcase_map zoomControl=1 %} + {% include "umap/search_bar.html" %} + {% include "umap/about_summary.html" %} + {% if showcase_map %} +
+

{% blocktrans %}Map of the uMaps{% endblocktrans %}

+
{% map_fragment showcase_map zoomControl=1 %}
+ {% endif %} +
+

{% blocktrans %}Get inspired, browse maps{% endblocktrans %}

+
{% include "umap/map_list.html" %}
-{% endif %} -
-

{% blocktrans %}Get inspired, browse maps{% endblocktrans %}

-
- {% include "umap/map_list.html" %} -
-
- {% endblock maincontent %} diff --git a/umap/templates/umap/js.html b/umap/templates/umap/js.html index e8c1e8e6..566ec658 100644 --- a/umap/templates/umap/js.html +++ b/umap/templates/umap/js.html @@ -1,46 +1,44 @@ {% load compress %} {% compress js %} - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + {% endcompress %} -{% if locale %} - -{% endif %} +{% if locale %}{% endif %} {% compress js %} - - - - - - - - - - - - - - + + + + + + + + + + + + + + {% endcompress %} diff --git a/umap/templates/umap/login_popup_end.html b/umap/templates/umap/login_popup_end.html index 9ea96dfc..42600c54 100644 --- a/umap/templates/umap/login_popup_end.html +++ b/umap/templates/umap/login_popup_end.html @@ -1,19 +1,18 @@ {% load i18n %}

{% trans "You are logged in. Continuing..." %}

- +
+ diff --git a/umap/templates/umap/map_init.html b/umap/templates/umap/map_init.html index 50af1a17..f83f3568 100644 --- a/umap/templates/umap/map_init.html +++ b/umap/templates/umap/map_init.html @@ -1,5 +1,3 @@ {% load umap_tags %} -
- +
+ diff --git a/umap/templates/umap/map_list.html b/umap/templates/umap/map_list.html index 280246de..b0c74325 100644 --- a/umap/templates/umap/map_list.html +++ b/umap/templates/umap/map_list.html @@ -1,12 +1,19 @@ {% load umap_tags umap_tags i18n %} - {% for map_inst in maps %} -
-
+
+
{% map_fragment map_inst prefix=prefix page=request.GET.p %} -
{{ map_inst.name }}{% if map_inst.owner %} {% trans "by" %} {{ map_inst.owner }}{% endif %}
-
+
+ {{ map_inst.name }} + {% if map_inst.owner %} + {% trans "by" %} {{ map_inst.owner }} + {% endif %} +
+
{% endfor %} {% if maps.has_next %} - + {% endif %} diff --git a/umap/templates/umap/map_messages.html b/umap/templates/umap/map_messages.html index 646cfd0a..4ad806a0 100644 --- a/umap/templates/umap/map_messages.html +++ b/umap/templates/umap/map_messages.html @@ -1,10 +1,10 @@ diff --git a/umap/templates/umap/messages.html b/umap/templates/umap/messages.html index f2777e5c..c2d19217 100644 --- a/umap/templates/umap/messages.html +++ b/umap/templates/umap/messages.html @@ -1,11 +1,11 @@
-
- {% if messages %} -
    - {% for message in messages %} - {{ message }} - {% endfor %} -
- {% endif %} -
+
+ {% if messages %} +
    + {% for message in messages %} +
  • {{ message }}
  • + {% endfor %} +
+ {% endif %} +
diff --git a/umap/templates/umap/navigation.html b/umap/templates/umap/navigation.html index 8a427f5e..98974f92 100644 --- a/umap/templates/umap/navigation.html +++ b/umap/templates/umap/navigation.html @@ -1,28 +1,42 @@ {% load i18n %}