diff --git a/Makefile b/Makefile index 8371fba9..3e2af6c2 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,14 @@ 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: lint-templates +lint-templates: ## Lint template files + djlint umap/templates --lint + .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..1fd8b057 100644 --- a/umap/templates/404.html +++ b/umap/templates/404.html @@ -1,12 +1,15 @@ {% extends "base.html" %} - {% load i18n static %} - {% block content %} -
- -

44

-

Not Found

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

+ 4 + 0 + 4 +

+

Not Found

+
+
+{% endblock content %} diff --git a/umap/templates/500.html b/umap/templates/500.html index 91b60c1c..5f94dfd5 100644 --- a/umap/templates/500.html +++ b/umap/templates/500.html @@ -1,8 +1,11 @@ - - + + 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..4d93f5bd 100644 --- a/umap/templates/base.html +++ b/umap/templates/base.html @@ -1,26 +1,30 @@ {% load compress umap_tags i18n %} - - - {% block head_title %}{{ SITE_NAME }}{% endblock %} + + + + {% block head_title %} + {{ SITE_NAME }} + {% endblock head_title %} + + + {% 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..c9edc372 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..870047eb 100644 --- a/umap/templates/umap/about_summary.html +++ b/umap/templates/umap/about_summary.html @@ -2,11 +2,21 @@
- -

{% 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 %} +

- +
  • {% trans "Choose the layers of your map" %}
  • {% trans "Add POIs: markers, lines, polygons..." %}
  • @@ -18,7 +28,11 @@
- +

{% blocktrans with repo_url="https://github.com/umap-project/umap" %}And it's open source!{% endblocktrans %}

@@ -28,16 +42,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..7ae6c00c 100644 --- a/umap/templates/umap/content.html +++ b/umap/templates/umap/content.html @@ -1,23 +1,20 @@ {% extends "base.html" %} - {% load umap_tags compress i18n %} - -{% block body_class %}content{% endblock %} - +{% block body_class %} + content +{% endblock body_class %} {% block extra_head %} - {% compress css %} - {% umap_css %} - {% endcompress css %} - {% umap_js %} -{% endblock %} - + {% compress css %} + {% umap_css %} + {% endcompress css %} + {% umap_js %} +{% endblock extra_head %} {% block header %}
- {% include 'umap/navigation.html' with title=SITE_NAME %} + {% include "umap/navigation.html" with title=SITE_NAME %}
- {% include 'umap/messages.html' with title=SITE_NAME %} -{% endblock %} - + {% include "umap/messages.html" with title=SITE_NAME %} +{% endblock header %} {% block content %} {% if UMAP_READONLY %}
@@ -38,57 +35,58 @@ {% 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..51d1d3d1 100644 --- a/umap/templates/umap/content_footer.html +++ b/umap/templates/umap/content_footer.html @@ -1,19 +1,18 @@ -{% load i18n %} - +{% 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..1d93152a 100644 --- a/umap/templates/umap/login_popup_end.html +++ b/umap/templates/umap/login_popup_end.html @@ -1,20 +1,16 @@ {% 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..66d036b4 100644 --- a/umap/templates/umap/map_init.html +++ b/umap/templates/umap/map_init.html @@ -1,5 +1,7 @@ {% 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..da4655a8 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..d6c753a7 100644 --- a/umap/templates/umap/navigation.html +++ b/umap/templates/umap/navigation.html @@ -1,31 +1,45 @@ {% load i18n %} diff --git a/umap/templates/umap/password_change.html b/umap/templates/umap/password_change.html index d398258f..ad7389ec 100644 --- a/umap/templates/umap/password_change.html +++ b/umap/templates/umap/password_change.html @@ -1,20 +1,25 @@ {% extends "umap/content.html" %} - {% load i18n %} - {% block content %}

{% trans "Password change" %}

-

{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}

- -
+

+ {% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %} +

+ {% csrf_token %} {{ form.old_password.errors }} - + {{ form.new_password1.errors }} - + {{ form.new_password2.errors }} - - - + +
{% endblock content %} diff --git a/umap/templates/umap/password_change_done.html b/umap/templates/umap/password_change_done.html index 9fb67450..5203b737 100644 --- a/umap/templates/umap/password_change_done.html +++ b/umap/templates/umap/password_change_done.html @@ -1,9 +1,9 @@ {% extends "umap/content.html" %} - {% load i18n %} - {% block content %}

{% trans "Password change successful" %}

{% trans "Your password was changed." %}

-

Home

+

+ Home +

{% endblock content %} diff --git a/umap/templates/umap/search.html b/umap/templates/umap/search.html index 98af8429..3f3e3ae4 100644 --- a/umap/templates/umap/search.html +++ b/umap/templates/umap/search.html @@ -1,25 +1,23 @@ {% extends "umap/content.html" %} - {% load i18n %} - {% block maincontent %} -{% include "umap/search_bar.html" %} -{% if q %} -
-
- {% if maps %} -

- {% blocktranslate count counter=count %} - {{ count }} map found: - {% plural %} - {{ count }} maps found: - {% endblocktranslate %} -

- {% include "umap/map_list.html" with prefix='search_map' %} - {% else %} -

{% trans "No map found." %}

- {% endif %} + {% include "umap/search_bar.html" %} + {% if q %} +
+
+ {% if maps %} +

+ {% blocktranslate count counter=count %} + {{ count }} map found: + {% plural %} + {{ count }} maps found: + {% endblocktranslate %} +

+ {% include "umap/map_list.html" with prefix="search_map" %} + {% else %} +

{% trans "No map found." %}

+ {% endif %} +
-
-{% endif %} + {% endif %} {% endblock maincontent %} diff --git a/umap/templates/umap/search_bar.html b/umap/templates/umap/search_bar.html index 67b84c28..b854e9ca 100644 --- a/umap/templates/umap/search_bar.html +++ b/umap/templates/umap/search_bar.html @@ -1,13 +1,16 @@ {% load i18n %}
-
-
+
+
- +
- +
- -
+ +
diff --git a/umap/templates/umap/success.html b/umap/templates/umap/success.html index b5754e20..9766475a 100644 --- a/umap/templates/umap/success.html +++ b/umap/templates/umap/success.html @@ -1 +1 @@ -ok \ No newline at end of file +ok