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:
@ -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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user