From 4c57bf8b9d031ea982016d83103c829728cb1f9c Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 22 Sep 2019 09:03:59 +0200 Subject: [PATCH] Always navigate back to the previous page after saving a product (closes #364) --- changelog/52_UNRELEASED_2019-xx-xx.md | 1 + public/viewjs/components/productcard.js | 2 +- views/stockoverview.blade.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog/52_UNRELEASED_2019-xx-xx.md b/changelog/52_UNRELEASED_2019-xx-xx.md index 66281ef2..7d05032b 100644 --- a/changelog/52_UNRELEASED_2019-xx-xx.md +++ b/changelog/52_UNRELEASED_2019-xx-xx.md @@ -37,6 +37,7 @@ - `FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING` to disable product opened tracking - Fixed/refined some things regarding purchase/consume/inventory of products with enabled tare weight handling (nothing was broken, but the success popups may not displayed the correct amount that was posted) - Fixed that "Spoil rate" and "Average shelf life" on the product card was wrong in most cases +- When going to the product edit page, after saving the product, it will now return to the page you were coming from ### Shopping list improvements - Shopping lists now have a notes field (HTML/WYSIWYG editor, just to save some notes per shopping list) diff --git a/public/viewjs/components/productcard.js b/public/viewjs/components/productcard.js index df50bc39..fa994310 100644 --- a/public/viewjs/components/productcard.js +++ b/public/viewjs/components/productcard.js @@ -66,7 +66,7 @@ Grocy.Components.ProductCard.Refresh = function(productId) $('#productcard-product-stock-opened-amount').text(""); } - $('#productcard-product-edit-button').attr("href", U("/product/" + productDetails.product.id.toString())); + $('#productcard-product-edit-button').attr("href", U("/product/" + productDetails.product.id.toString() + '?' + 'returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative))); $('#productcard-product-edit-button').removeClass("disabled"); if (productDetails.last_price !== null) diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index fe4cb13e..1ef2b19f 100644 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -151,7 +151,7 @@ {{ $__t('Stock journal for this product') }} - + {{ $__t('Edit product') }}