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