Fixed (broken by myself) link-return handling

This commit is contained in:
Bernd Bestel 2020-08-31 19:02:35 +02:00
parent ddfe608ec6
commit 849d3dd0ca
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 17 additions and 2 deletions

View File

@ -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);
}
});

View File

@ -24,7 +24,7 @@
</select>
</div>
<a href="{{ $U('/') }}" class="btn btn-success">{{ $__t('OK') }}</a>
<a href="{{ $U('/') }}" class="btn btn-success link-return">{{ $__t('OK') }}</a>
</div>
</div>
@stop