|
|
|
@ -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" );
|
|
|
|
|