Add enhanced confirmation for station deletion
parent
f9af2c0231
commit
46d5533066
|
@ -14,11 +14,12 @@ $(document).ready(function() {
|
|||
var station_info = $('#station-info').data();
|
||||
|
||||
// Confirm station deletion
|
||||
var message = 'Do you really want to delete this Ground Station?';
|
||||
var actions = $('#station-delete');
|
||||
if (actions.length) {
|
||||
actions[0].addEventListener('click', function(e) {
|
||||
if (! confirm(message)) {
|
||||
if ($('#delete-confirm-id').val() != station_info.id ) {
|
||||
$('#delete-confirm-id').val('');
|
||||
$('#delete-confirm-id').attr('placeholder', 'Wrong ID!');
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
<input type="checkbox" name="testing" {% if form.testing.value %}checked="True"{% endif %} {% if not station.id %}disabled{% endif %}>
|
||||
Testing?
|
||||
<span class="glyphicon glyphicon-question-sign" aria-hidden="true" data-toggle="tooltip"
|
||||
title="Make sure you Station is performing well for a period of time before you lift the Testing flag"></span>
|
||||
title="Make sure you station is performing well for a period of time before you remove the Testing flag"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -30,9 +30,8 @@
|
|||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
|
||||
Edit
|
||||
</a>
|
||||
<a class="btn btn-danger" id="station-delete" href="{% url 'base:station_delete' id=station.id %}">
|
||||
<a class="btn btn-danger delete-modal-reveal" data-toggle="modal" data-target="#delete-modal">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
|
||||
Delete
|
||||
</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
|
@ -278,6 +277,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Map Modal -->
|
||||
<div id="modal-lightbox" class="modal-lightbox">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
|
@ -286,6 +286,30 @@
|
|||
<img src="{{ station.get_image }}" class="station-full-image" alt="{{ station.name }}">
|
||||
</div>
|
||||
|
||||
<!-- Delete Modal -->
|
||||
<div class="modal" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-modal">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">Do you really want to delete the ground station?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>WARNING: You are about to delete your ground station.</p>
|
||||
<p>Please enter the ID of your station below to confirm the action.</p>
|
||||
<input value="" id="delete-confirm-id" type="text" class="form-control" name="delete-confirm-id" placeholder="Enter your station ID to proceed with deletion">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<a class="btn btn-danger" id="station-delete" href="{% url 'base:station_delete' id=station.id %}">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
|
||||
Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 'includes/satellite.html' %}
|
||||
{% include 'includes/legend.html' %}
|
||||
{% endblock content %}
|
||||
|
|
Loading…
Reference in New Issue