Locations can now be deleted. I have created you, now I can destroy you!
This commit is contained in:
@@ -3,11 +3,12 @@ function new_location_entry() {
|
||||
}
|
||||
|
||||
function init_Location_edit(locationID, name, containerID) {
|
||||
var newButton = '<div class="round-button-left"><a href="#" onclick="saveLocation(' + locationID + ')"><i class="fa fa-check" aria-hidden="true"></i></a></div>';
|
||||
$('#save-button').attr("onclick", "saveLocation(" + locationID + ")");
|
||||
$('#delete-button').attr("onclick", "deleteLocation(" + locationID + ")");
|
||||
$('#location-name-input').val(name);
|
||||
if(containerID > 0){
|
||||
$("#container-input").val(containerID);
|
||||
update_map();
|
||||
}
|
||||
overlay_in();
|
||||
}
|
||||
@@ -52,6 +53,30 @@ function saveLocation(locationID) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function deleteLocation(locationID) {
|
||||
if (locationID < 0)
|
||||
alert('Congratulations! You found the secret UI bug easter egg! This button should not be here, yet I left it specifically because I wanted an easter egg and not because of any other reasons! Good for you!')
|
||||
return;
|
||||
if (!confirm('Delete the selected location? If there are parts there, this will leave a mess in the database and Marek will be very sad.'))
|
||||
return;
|
||||
$.ajax({
|
||||
url: rootURL + 'deleteLocation/' + locationID,
|
||||
type: 'GET',
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function() {
|
||||
alert("location removed.");
|
||||
overlay_out();
|
||||
location.reload();
|
||||
},
|
||||
fail: function() {
|
||||
console.log('An error occurred while deleting the entry');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function end_edit(){
|
||||
//intentionally left blank
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user