chore: format templates

This commit is contained in:
Alexis Métaireau 2024-02-22 15:31:32 +01:00
parent 76ed2200cf
commit d5b1821117
8 changed files with 100 additions and 91 deletions

View file

@ -1,5 +1,4 @@
{% load static %}
<link rel="stylesheet"
href="{% static 'umap/vendors/leaflet/leaflet.css' %}" />
<link rel="stylesheet"

View file

@ -1,33 +1,44 @@
{% load static %}
<script type="module" src="{% static 'umap/vendors/leaflet/leaflet-src.esm.js' %}" defer></script>
<script type="module"
src="{% static 'umap/vendors/leaflet/leaflet-src.esm.js' %}"
defer></script>
<script type="module" src="{% static 'umap/js/modules/global.js' %}" defer></script>
<script src="{% static 'umap/vendors/editable/Path.Drag.js' %}" defer></script>
<script src="{% static 'umap/vendors/editable/Leaflet.Editable.js' %}" defer></script>
<script src="{% static 'umap/vendors/hash/leaflet-hash.js' %}" defer></script>
<script src="{% static 'umap/vendors/i18n/Leaflet.i18n.js' %}" defer></script>
<script src="{% static 'umap/vendors/editinosm/Leaflet.EditInOSM.js' %}" defer></script>
<script src="{% static 'umap/vendors/minimap/Control.MiniMap.min.js' %}" defer></script>
<script src="{% static 'umap/vendors/editinosm/Leaflet.EditInOSM.js' %}"
defer></script>
<script src="{% static 'umap/vendors/minimap/Control.MiniMap.min.js' %}"
defer></script>
<script src="{% static 'umap/vendors/csv2geojson/csv2geojson.js' %}" defer></script>
<script src="{% static 'umap/vendors/togeojson/togeojson.umd.js' %}" defer></script>
<script src="{% static 'umap/vendors/osmtogeojson/osmtogeojson.js' %}" defer></script>
<script src="{% static 'umap/vendors/loading/Control.Loading.js' %}" defer></script>
<script src="{% static 'umap/vendors/markercluster/leaflet.markercluster.js' %}" defer></script>
<script src="{% static 'umap/vendors/contextmenu/leaflet.contextmenu.min.js' %}" defer></script>
<script src="{% static 'umap/vendors/markercluster/leaflet.markercluster.js' %}"
defer></script>
<script src="{% static 'umap/vendors/contextmenu/leaflet.contextmenu.min.js' %}"
defer></script>
<script src="{% static 'umap/vendors/photon/leaflet.photon.js' %}" defer></script>
<script src="{% static 'umap/vendors/georsstogeojson/GeoRSSToGeoJSON.js' %}" defer></script>
<script src="{% static 'umap/vendors/georsstogeojson/GeoRSSToGeoJSON.js' %}"
defer></script>
<script src="{% static 'umap/vendors/heat/leaflet-heat.js' %}" defer></script>
<script src="{% static 'umap/vendors/fullscreen/Leaflet.fullscreen.min.js' %}" defer></script>
<script src="{% static 'umap/vendors/fullscreen/Leaflet.fullscreen.min.js' %}"
defer></script>
<script src="{% static 'umap/vendors/toolbar/leaflet.toolbar.js' %}" defer></script>
<script src="{% static 'umap/vendors/formbuilder/Leaflet.FormBuilder.js' %}" defer></script>
<script src="{% static 'umap/vendors/measurable/Leaflet.Measurable.js' %}" defer></script>
<script src="{% static 'umap/vendors/formbuilder/Leaflet.FormBuilder.js' %}"
defer></script>
<script src="{% static 'umap/vendors/measurable/Leaflet.Measurable.js' %}"
defer></script>
<script src="{% static 'umap/vendors/togpx/togpx.js' %}" defer></script>
<script src="{% static 'umap/vendors/iconlayers/iconLayers.js' %}" defer></script>
<script src="{% static 'umap/vendors/tokml/tokml.js' %}" defer></script>
<script src="{% static 'umap/vendors/locatecontrol/L.Control.Locate.min.js' %}" defer></script>
<script src="{% static 'umap/vendors/locatecontrol/L.Control.Locate.min.js' %}"
defer></script>
<script src="{% static 'umap/vendors/dompurify/purify.min.js' %}" defer></script>
<script src="{% static 'umap/vendors/colorbrewer/colorbrewer.js' %}" defer></script>
<script src="{% static 'umap/vendors/simple-statistics/simple-statistics.min.js' %}" defer></script>
<script src="{% static 'umap/vendors/simple-statistics/simple-statistics.min.js' %}"
defer></script>
{% if locale %}
{% with "umap/locale/"|add:locale|add:".js" as path %}
<script src="{% static path %}" defer></script>

View file

@ -8,15 +8,14 @@
{% endblock body_class %}
{% block extra_head %}
{% if preconnect_domains %}
{% for domain in preconnect_domains %}
<link rel="preconnect" href="{{ domain }}" />
{% endfor %}
{% for domain in preconnect_domains %}<link rel="preconnect" href="{{ domain }}" />{% endfor %}
{% endif %}
{% umap_css %}
{{ block.super }}
{% umap_js locale=locale %}
{% if object.share_status != object.PUBLIC %}<meta name="robots" content="noindex">{% endif %}
<link rel="alternate" type="application/json+oembed"
<link rel="alternate"
type="application/json+oembed"
href="{{ oembed_absolute_uri }}?url={{ quoted_absolute_uri }}&format=json"
title="{{ map.name }} oEmbed URL" />
{% endblock extra_head %}

View file

@ -21,7 +21,8 @@
</th>
<td>
{{ map_inst.preview_settings|json_script:unique_id }}
<button class="map-icon map-opener" data-map-id="{{ unique_id }}"
<button class="map-icon map-opener"
data-map-id="{{ unique_id }}"
title="{% translate "Open preview" %}">
<span class="icon-dashboard icon-view"></span>
<span class="sr-only">{% translate "Open preview" %}</span>
@ -42,35 +43,37 @@
<a href="{{ map_inst.owner.get_url }}">{{ map_inst.owner }}</a>
</td>
<td>
<a href="{{ map_inst.get_absolute_url }}?share" class="icon-link"
<a href="{{ map_inst.get_absolute_url }}?share"
class="icon-link"
title="{% translate "Share" %}">
<span class="icon-dashboard icon-share"></span>
<span class="sr-only">{% translate "Share" %}</span>
</a>
<a href="{{ map_inst.get_absolute_url }}?edit" class="icon-link"
<a href="{{ map_inst.get_absolute_url }}?edit"
class="icon-link"
title="{% translate "Edit" %}">
<span class="icon-dashboard icon-edit"></span>
<span class="sr-only">{% translate "Edit" %}</span>
</a>
<a href="{% url 'map_download' map_inst.pk %}" class="icon-link"
<a href="{% url 'map_download' map_inst.pk %}"
class="icon-link"
title="{% translate "Download" %}">
<span class="icon-dashboard icon-download"></span>
<span class="sr-only">{% translate "Download" %}</span>
</a>
<form action="{% url 'map_clone' map_inst.pk %}" method="post">
{% csrf_token %}
<button class="map-icon" type="submit"
title="{% translate "Clone" %}">
<button class="map-icon" type="submit" title="{% translate "Clone" %}">
<span class="icon-dashboard icon-duplicate"></span>
<span class="sr-only">{% translate "Clone" %}</span>
</button>
</form>
<form action="{% url 'map_delete' map_inst.pk %}"
method="post" class="map-delete">
method="post"
class="map-delete">
{% csrf_token %}
<input type="hidden" name="next" value="{% url 'user_dashboard' %}">
<button class="map-icon" type="submit"
title="{% translate "Delete" %}">
<button class="map-icon" type="submit" title="{% translate "Delete" %}">
<span class="icon-dashboard icon-delete"></span>
<span class="sr-only">{% translate "Delete" %}</span>
</button>
@ -93,13 +96,11 @@
<span></span>
{# djlint:on #}
{% endif %}
<span class="current">
{% blocktranslate with maps_number=maps.number num_pages=maps.paginator.num_pages trimmed %}
Page {{ maps_number }} of {{ num_pages }}
{% endblocktranslate %}
</span>
{% if maps.has_next %}
<a href="?p={{ maps.next_page_number }}{% if q %}&q={{ q }}{% endif %}">{% translate "next" %} </a>
<a href="?p={{ maps.paginator.num_pages }}{% if q %}&q={{ q }}{% endif %}">{% translate "last" %} »</a>

View file

@ -7,8 +7,7 @@
{% trans "Search my maps" as placeholder %}
<div class="row">
<h2 class="section tabs">
<a class="selected" href="{% url 'user_dashboard' %}"
>{% blocktranslate with count=maps.paginator.count %}My Maps ({{ count }}){% endblocktranslate %}
<a class="selected" href="{% url 'user_dashboard' %}">{% blocktranslate with count=maps.paginator.count %}My Maps ({{ count }}){% endblocktranslate %}
</a>
<a href="{% url 'user_profile' %}">{% trans "My profile" %}</a>
</h2>
@ -19,17 +18,18 @@
<form action="{{ request.get_full_path }}" method="get">
<span>
<label class="sr-only" for="q">{% translate "Maps title" %}</label>
<input id="q" name="q" type="search"
<input id="q"
name="q"
type="search"
placeholder="{% translate "Maps title" %}"
value="{{ request.GET.q|default:"" }}" />
</span>
<input type="submit" value="{% trans "Search my maps" %}" />
</form>
{% if maps.object_list|length > 1 %}
<a href="{% url 'user_download' %}?{% spaceless %}
{% for map_inst in maps %}map_id={{ map_inst.pk }}{% if not forloop.last %}&{% endif %}{% endfor %}
{% endspaceless %}" class="button button-download"
>{% blocktranslate with count=maps.object_list|length trimmed %}
<a href="{% url 'user_download' %}?{% spaceless %} {% for map_inst in maps %}map_id={{ map_inst.pk }}{% if not forloop.last %}&{% endif %}{% endfor %} {% endspaceless %}"
class="button button-download">
{% blocktranslate with count=maps.object_list|length trimmed %}
Download {{ count }} maps
{% endblocktranslate %}
</a>
@ -45,7 +45,6 @@
</div>
</div>
{% endblock maincontent %}
{% block bottom_js %}
{{ block.super }}
<script type="text/javascript">

View file

@ -818,10 +818,10 @@ def test_oembed_map(client, map, datalayer):
def test_oembed_link(client, map, datalayer):
response = client.get(map.get_absolute_url())
assert response.status_code == 200
assert (
'<link rel="alternate" type="application/json+oembed"'
in response.content.decode()
)
'<link rel="alternate"\n type="application/json+oembed"'
) in response.content.decode()
assert (
'href="http://testserver/map/oembed/'
f'?url=http%3A%2F%2Ftestserver%2Fen%2Fmap%2Ftest-map_{map.id}&format=json"'