Also use the path attribute for returning to the edit-list page

This commit is contained in:
Kevin MacMartin 2018-01-11 23:54:00 -05:00
parent 26bed078e2
commit b5016bab06

View file

@ -260,6 +260,7 @@ function editItemInit() {
$spinner = $("#loading-modal"), $spinner = $("#loading-modal"),
fadeTime = 250, fadeTime = 250,
model = $editItem.data("model"), model = $editItem.data("model"),
path = $editItem.data("path"),
id = $editItem.data("id"), id = $editItem.data("id"),
operation = id === "new" ? "create" : "update"; operation = id === "new" ? "create" : "update";
@ -340,7 +341,7 @@ function editItemInit() {
// functionality to run on success // functionality to run on success
const returnSuccess = function() { const returnSuccess = function() {
hideLoadingModal(); hideLoadingModal();
window.location.href = "/dashboard/" + model; window.location.href = "/dashboard/" + path;
}; };
// add the image from the image upload box for image-upload class elements // add the image from the image upload box for image-upload class elements
@ -433,7 +434,7 @@ function editItemInit() {
$backButton.on("click", function() { $backButton.on("click", function() {
if (!submitting) { if (!submitting) {
askConfirmation("Cancel and return to the " + model + " list?", function() { askConfirmation("Cancel and return to the " + model + " list?", function() {
window.location.href = "/dashboard/" + model; window.location.href = "/dashboard/" + path;
}); });
} }
}); });