2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-04 20:51:00 +00:00

Replace PartImageUpload form

This commit is contained in:
Oliver
2021-06-30 00:18:25 +10:00
parent 293b5d4c07
commit 26eafe242c
4 changed files with 33 additions and 38 deletions

View File

@ -133,6 +133,14 @@
});
});
function reloadImage(data) {
if (data.image) {
$('#company-image').attr('src', data.image);
} else {
location.reload();
}
}
enableDragAndDrop(
"#company-thumb",
"{% url 'api-company-detail' company.id %}",
@ -140,12 +148,7 @@
label: 'image',
method: 'PATCH',
success: function(data, status, xhr) {
if (data.image) {
$('#company-image').attr('src', data.image);
} else {
location.reload();
}
reloadImage(data);
}
}
);
@ -167,11 +170,7 @@
},
title: '{% trans "Upload Image" %}',
onSuccess: function(data) {
if (data.image) {
$('#company-image').attr('src', data.image);
} else {
location.reload();
}
reloadImage(data);
}
}
);