Added delete entry function
This commit is contained in:
@@ -173,6 +173,25 @@ function text_filter(string) {
|
||||
return '';
|
||||
}
|
||||
|
||||
function delete_entry(partID) {
|
||||
if (!confirm('Delete the selected entry?'))
|
||||
return;
|
||||
$.ajax({
|
||||
url: 'https://www.elab.kth.se/parts/delete/' + partID,
|
||||
type: 'GET',
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function() {
|
||||
overlay_out();
|
||||
perform_query();
|
||||
},
|
||||
fail: function() {
|
||||
console.log('An error occurred while deleting the entry');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function show_part_info(partID) {
|
||||
$.getJSON('https://www.elab.kth.se/parts/getpartinfo/' + partID, function(data) {
|
||||
$('#block-info').text(text_filter(data.block));
|
||||
@@ -188,6 +207,9 @@ function show_part_info(partID) {
|
||||
$('#edit-button').click(function() {
|
||||
init_edit(partID);
|
||||
});
|
||||
$('#edit-button').click(function() {
|
||||
delete_entry(partID);
|
||||
});
|
||||
overlay_in();
|
||||
}).fail(function() {
|
||||
console.log( "Fetching part info failed" );
|
||||
|
||||
@@ -273,6 +273,19 @@ div label input {
|
||||
box-shadow: 2pt 1pt 8pt black;
|
||||
}
|
||||
|
||||
.round-button-left {
|
||||
position: absolute;
|
||||
bottom: 15pt;
|
||||
left: 15pt;
|
||||
width: 40pt;
|
||||
height: 32pt;
|
||||
border-radius: 20pt;
|
||||
background-color: #5E9292;
|
||||
font-size: 20pt;
|
||||
padding-top: 8pt;
|
||||
box-shadow: 2pt 1pt 8pt black;
|
||||
}
|
||||
|
||||
.round-button a{
|
||||
color: #D7E2E2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user