Optimized returnto-links handling (fixes #1785)

This commit is contained in:
Bernd Bestel 2022-02-13 20:07:29 +01:00
parent d38a5efb3d
commit 2457c2c2fd
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
3 changed files with 6 additions and 6 deletions

View File

@ -883,11 +883,11 @@ $('a.link-return').not(".btn").each(function()
var base = $(this).data('href'); var base = $(this).data('href');
if (base.contains('?')) if (base.contains('?'))
{ {
$(this).attr('href', base + '&returnto' + encodeURIComponent(location.pathname)); $(this).attr('href', base + '&returnto' + encodeURIComponent(Grocy.CurrentUrlRelative));
} }
else else
{ {
$(this).attr('href', base + '?returnto=' + encodeURIComponent(location.pathname)); $(this).attr('href', base + '?returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative));
} }
}) })

View File

@ -195,9 +195,9 @@
href="{{ $U('/stockjournal/summary?embedded&product=') }}{{ $stockEntry->product_id }}"> href="{{ $U('/stockjournal/summary?embedded&product=') }}{{ $stockEntry->product_id }}">
{{ $__t('Stock journal summary') }} {{ $__t('Stock journal summary') }}
</a> </a>
<a class="dropdown-item" <a class="dropdown-item link-return"
type="button" type="button"
href="{{ $U('/product/') }}{{ $stockEntry->product_id . '?returnto=/stockentries' }}"> data-href="{{ $U('/product/') }}{{ $stockEntry->product_id }}">
{{ $__t('Edit product') }} {{ $__t('Edit product') }}
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>

View File

@ -291,9 +291,9 @@
href="{{ $U('/stockjournal/summary?embedded&product_id=') }}{{ $currentStockEntry->product_id }}"> href="{{ $U('/stockjournal/summary?embedded&product_id=') }}{{ $currentStockEntry->product_id }}">
<span class="dropdown-item-text">{{ $__t('Stock journal summary') }}</span> <span class="dropdown-item-text">{{ $__t('Stock journal summary') }}</span>
</a> </a>
<a class="dropdown-item permission-MASTER_DATA_EDIT" <a class="dropdown-item permission-MASTER_DATA_EDIT link-return"
type="button" type="button"
href="{{ $U('/product/') }}{{ $currentStockEntry->product_id . '?returnto=%2Fstockoverview' }}"> data-href="{{ $U('/product/') }}{{ $currentStockEntry->product_id }}">
<span class="dropdown-item-text">{{ $__t('Edit product') }}</span> <span class="dropdown-item-text">{{ $__t('Edit product') }}</span>
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>