Allow dashboard updates for models that have only files or images

This commit is contained in:
Kevin MacMartin 2018-05-10 23:22:09 -04:00
parent 1082c0f39b
commit f15fb617ff

View file

@ -628,21 +628,25 @@ function editItemInit() {
getFormData();
// submit the update
$.ajax({
type: "POST",
url: "/dashboard/update",
data: formData
}).always(function(response) {
if (/^id:[0-9][0-9]*$/.test(response)) {
uploadImage(response.replace(/^id:/, ""), 0);
} else {
loadingModal("hide");
if (Object.keys(formData.columns).length) {
$.ajax({
type: "POST",
url: "/dashboard/update",
data: formData
}).always(function(response) {
if (/^id:[0-9][0-9]*$/.test(response)) {
uploadImage(response.replace(/^id:/, ""), 0);
} else {
loadingModal("hide");
showAlert("Failed to " + operation + " record", function() {
submitting = false;
});
}
});
showAlert("Failed to " + operation + " record", function() {
submitting = false;
});
}
});
} else {
uploadImage(formData.id, 0);
}
}
});
}