master
assar 8 years ago
parent 5eb3cb6e46
commit 750da21749

@ -98,6 +98,7 @@ def alter(partID):
datasheet_file = request.files['datasheet-file'] datasheet_file = request.files['datasheet-file']
datasheet_filename = secure_filename(datasheet_file.filename) datasheet_filename = secure_filename(datasheet_file.filename)
datasheet_file.save('/srv/datasheets/' + datasheet_filename) datasheet_file.save('/srv/datasheets/' + datasheet_filename)
if l[0]['datasheet'] != None:
os.remove('/srv/datasheets/' + l[0]['datasheet']) os.remove('/srv/datasheets/' + l[0]['datasheet'])
else: else:
datasheet_filename = l[0]['datasheet'] datasheet_filename = l[0]['datasheet']

@ -203,7 +203,7 @@ function show_part_info(partID) {
$('#quantity-info').text(text_filter(data.quantity)); $('#quantity-info').text(text_filter(data.quantity));
$('#notes-info').text(text_filter(data.notes)); $('#notes-info').text(text_filter(data.notes));
if (data.datasheet != null) if (data.datasheet != null)
$('#datasheet-info').append($('<a href="https://www.elab.kth.se/parts/getfile/' + data.datasheet.substring(0, data.datasheet.length - 4) + '"><i class="fa fa-file-text" aria-hidden="true"></i></a>')); $('#datasheet-info').html($('<a href="https://www.elab.kth.se/parts/getfile/' + data.datasheet.substring(0, data.datasheet.length - 4) + '"><i class="fa fa-file-text" aria-hidden="true"></i></a>'));
else else
$('#datasheet-info').text(' '); $('#datasheet-info').text(' ');
$('#edit-button').click(function() { $('#edit-button').click(function() {

Loading…
Cancel
Save