From 849d3dd0ca5cb41fdac68bd6fc358473959b567a Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Mon, 31 Aug 2020 19:02:35 +0200 Subject: [PATCH] Fixed (broken by myself) link-return handling --- public/js/grocy.js | 17 ++++++++++++++++- views/usersettings.blade.php | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/public/js/grocy.js b/public/js/grocy.js index bd99c9e5..6618681d 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -670,7 +670,7 @@ $(Grocy.UserPermissions).each(function (index, item) $('.permission-'+item.permission_name).addClass('disabled').addClass('not-allowed'); } }); -$('a.link-return').each(function () { +$('a.link-return').not(".btn").each(function () { var base = $(this).data('href'); if(base.contains('?')) { @@ -681,3 +681,18 @@ $('a.link-return').each(function () { } }) + +$(document).on("click", "a.btn.link-return", function(e) +{ + e.preventDefault(); + + var link = GetUriParam("returnto"); + if (!link || !link.length > 0) + { + location.href = $(e.currentTarget).attr("href"); + } + else + { + location.href = U(link); + } +}); diff --git a/views/usersettings.blade.php b/views/usersettings.blade.php index 2dd59a06..e0ea1415 100644 --- a/views/usersettings.blade.php +++ b/views/usersettings.blade.php @@ -24,7 +24,7 @@ - {{ $__t('OK') }} + {{ $__t('OK') }} @stop