Added delete entry function

This commit is contained in:
Davide Bongiovanni
2017-06-10 01:35:34 +02:00
parent 5bf02c4892
commit 43c88980f3
4 changed files with 42 additions and 0 deletions
+22
View File
@@ -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" );
+13
View File
@@ -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;
}