-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make django-leaflet compatible with CSP (#371)
* Set style css in script * leaflet-container class to external css * Set i18n variables into external js * Further remove inline scripts * Move custom css into leaflet.extras.css * Don't modify leaflet.css * Optionally add nonce to inline style and script in widget * Maybe fix the whole thing? * Revert mistaken deletions * Add nonce to leaflet_map tag * Quote the nonce * Fix remaining inlines --------- Co-authored-by: Rodolfo Valentín Becerra García <[email protected]> Co-authored-by: Rodolfo Becerra <[email protected]>
- Loading branch information
1 parent
fce3e06
commit 115edc4
Showing
15 changed files
with
162 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.leaflet-container-default { | ||
min-height: 300px; | ||
} | ||
|
||
.leaflet-container { | ||
height: 100%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
{% extends "leaflet/widget.html" %} | ||
{% load i18n %} | ||
{% load static %} | ||
|
||
{% block vars %} | ||
{{ block.super }} | ||
|
||
{% include "leaflet/_leaflet_draw_i18n.js" %} | ||
L.Control.ResetView.TITLE = "{% trans "Reset view" %}"; | ||
L.Control.ResetView.ICON = "url({% static "leaflet/images/reset-view.png" %})"; | ||
{% endblock vars %} | ||
{% load leaflet_tags %} | ||
|
||
{% block map %} | ||
<div id="{{ id_css }}-div-map"> | ||
{{ block.super }} | ||
</div> | ||
|
||
{% leaflet_draw_i18n %} | ||
{% endblock map %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% load static %} | ||
{{ Control_ResetView_TITLE|json_script:"Control-ResetView-TITLE" }} | ||
{% if with_forms %} | ||
{{ draw_toolbar_actions_title|json_script:"draw-toolbar-actions-title" }} | ||
{{ draw_toolbar_actions_text|json_script:"draw-toolbar-actions-text" }} | ||
{{ draw_toolbar_undo_title|json_script:"draw-toolbar-undo-title" }} | ||
{{ draw_toolbar_undo_text|json_script:"draw-toolbar-undo-text" }} | ||
{{ draw_toolbar_buttons_polyline|json_script:"draw-toolbar-buttons-polyline" }} | ||
{{ draw_toolbar_buttons_polygon|json_script:"draw-toolbar-buttons-polygon" }} | ||
{{ draw_toolbar_buttons_rectangle|json_script:"draw-toolbar-buttons-rectangle" }} | ||
{{ draw_toolbar_buttons_circle|json_script:"draw-toolbar-buttons-circle" }} | ||
{{ draw_toolbar_buttons_marker|json_script:"draw-toolbar-buttons-marker" }} | ||
{{ draw_handlers_circle_tooltip_start|json_script:"draw-handlers-circle-tooltip-start" }} | ||
{{ draw_handlers_marker_tooltip_start|json_script:"draw-handlers-marker-tooltip-start" }} | ||
{{ draw_handlers_polygon_tooltip_start|json_script:"draw-handlers-polygon-tooltip-start" }} | ||
{{ draw_handlers_polygon_tooltip_cont|json_script:"draw-handlers-polygon-tooltip-cont" }} | ||
{{ draw_handlers_polygon_tooltip_end|json_script:"draw-handlers-polygon-tooltip-end" }} | ||
{{ draw_handlers_polyline_error|json_script:"draw-handlers-polyline-error" }} | ||
{{ draw_handlers_polyline_tooltip_start|json_script:"draw-handlers-polyline-tooltip-start" }} | ||
{{ draw_handlers_polyline_tooltip_cont|json_script:"draw-handlers-polyline-tooltip-cont" }} | ||
{{ draw_handlers_polyline_tooltip_end|json_script:"draw-handlers-polyline-tooltip-end" }} | ||
{{ draw_handlers_rectangle_tooltip_start|json_script:"draw-handlers-rectangle-tooltip-start" }} | ||
{{ draw_handlers_simpleshape_tooltip_end|json_script:"draw-handlers-simpleshape-tooltip-end" }} | ||
|
||
{{ edit_toolbar_actions_save_title|json_script:"edit-toolbar-actions-save-title" }} | ||
{{ edit_toolbar_actions_save_text|json_script:"edit-toolbar-actions-save-text" }} | ||
{{ edit_toolbar_actions_cancel_title|json_script:"edit-toolbar-actions-cancel-title" }} | ||
{{ edit_toolbar_actions_cancel_text|json_script:"edit-toolbar-actions-cancel-text" }} | ||
{{ edit_toolbar_buttons_edit|json_script:"edit-toolbar-buttons-edit" }} | ||
{{ edit_toolbar_buttons_editDisabled|json_script:"edit-toolbar-buttons-editDisabled" }} | ||
{{ edit_toolbar_buttons_remove|json_script:"edit-toolbar-buttons-remove" }} | ||
{{ edit_toolbar_buttons_removeDisabled|json_script:"edit-toolbar-buttons-removeDisabled" }} | ||
{{ edit_handlers_edit_tooltip_text|json_script:"edit-handlers-edit-tooltip-text" }} | ||
{{ edit_handlers_edit_tooltip_subtext|json_script:"edit-handlers-edit-tooltip-subtext" }} | ||
{{ edit_handlers_remove_tooltip_text|json_script:"edit-handlers-remove-tooltip-text" }} | ||
{% endif %} | ||
<script src="{% static 'leaflet/draw/leaflet.draw.i18n.js' %}"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters