mirror of https://github.com/django/django.git
Refs #25706 - Removed inline JavaScript from OpenLayers template.
This allows setting a Content-Security-Policy HTTP header.
This commit is contained in:
parent
3ff7f6cf07
commit
322a1a037d
|
@ -107,6 +107,13 @@ ol.inherits(GeometryTypeControl, ol.control.Control);
|
||||||
if (initial_value && !this.options.is_collection) {
|
if (initial_value && !this.options.is_collection) {
|
||||||
this.disableDrawing();
|
this.disableDrawing();
|
||||||
}
|
}
|
||||||
|
const clearNode = document.getElementById(this.map.getTarget()).nextElementSibling;
|
||||||
|
if (clearNode.classList.contains('clear_features')) {
|
||||||
|
clearNode.querySelector('a').addEventListener('click', (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
self.clearFeatures();
|
||||||
|
});
|
||||||
|
}
|
||||||
this.ready = true;
|
this.ready = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<div id="{{ id }}_div_map">
|
<div id="{{ id }}_div_map">
|
||||||
<div id="{{ id }}_map"></div>
|
<div id="{{ id }}_map"></div>
|
||||||
{% if not disabled %}<span class="clear_features"><a href="javascript:{{ module }}.clearFeatures()">{% translate "Delete all Features" %}</a></span>{% endif %}
|
{% if not disabled %}<span class="clear_features"><a href="">{% translate "Delete all Features" %}</a></span>{% endif %}
|
||||||
{% if display_raw %}<p>{% translate "Debugging window (serialized value)" %}</p>{% endif %}
|
{% if display_raw %}<p>{% translate "Debugging window (serialized value)" %}</p>{% endif %}
|
||||||
<textarea id="{{ id }}" class="vSerializedField required" cols="150" rows="10" name="{{ name }}">{{ serialized }}</textarea>
|
<textarea id="{{ id }}" class="vSerializedField required" cols="150" rows="10" name="{{ name }}">{{ serialized }}</textarea>
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in New Issue