From b5016bab061a3dd99c54a96a69478a5d0bb37465 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Thu, 11 Jan 2018 23:54:00 -0500 Subject: [PATCH] Also use the path attribute for returning to the edit-list page --- resources/assets/js/dashboard.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/dashboard.js b/resources/assets/js/dashboard.js index 6cddccf..ec73b34 100644 --- a/resources/assets/js/dashboard.js +++ b/resources/assets/js/dashboard.js @@ -260,6 +260,7 @@ function editItemInit() { $spinner = $("#loading-modal"), fadeTime = 250, model = $editItem.data("model"), + path = $editItem.data("path"), id = $editItem.data("id"), operation = id === "new" ? "create" : "update"; @@ -340,7 +341,7 @@ function editItemInit() { // functionality to run on success const returnSuccess = function() { hideLoadingModal(); - window.location.href = "/dashboard/" + model; + window.location.href = "/dashboard/" + path; }; // add the image from the image upload box for image-upload class elements @@ -433,7 +434,7 @@ function editItemInit() { $backButton.on("click", function() { if (!submitting) { askConfirmation("Cancel and return to the " + model + " list?", function() { - window.location.href = "/dashboard/" + model; + window.location.href = "/dashboard/" + path; }); } });