test/apps/management/templates/widgets/custom_ol_map.html
2025-06-17 09:43:56 +07:00

59 lines
1.5 KiB
HTML

{% load l10n %}
<style>
.map-container {
width: 100%;
max-width: 100%;
}
#map {
width: 100%;
height: 400px;
border: 1px solid #ccc;
border-radius: 4px;
margin-bottom: 10px;
}
.map-buttons {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
.map-buttons button {
padding: 8px 16px;
font-size: 14px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #f9f9f9;
cursor: pointer;
transition: background-color 0.2s ease;
}
.map-buttons button:hover {
background-color: #f0f0f0;
}
.map-buttons button.disabled {
opacity: 0.5;
cursor: not-allowed;
}
</style>
<div class="map-container">
<div id="map" style="width: 100%; height: 400px;">
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-outline-danger" id="btn-clear">Очистить полигон</button>
</div>
<textarea id="{{ widget.name }}" name="{{ widget.name }}"
style="display:none">{{ widget.value|default:'' }}</textarea>
</div>
<script type="text/javascript">
window.mapInit({
mapId: 'map',
textareaId: '{{ widget.name }}',
zoom: {{ widget.zoom|unlocalize }},
lon: {% if longitude %}{{ longitude }}{% else %}{{ widget.lon|unlocalize }}{% endif %},
lat: {% if latitude %}{{ latitude }}{% else %}{{ widget.lat|unlocalize }}{% endif %}
});
</script>