Fixed product picker workflows URLs were wrong when running grocy in a subdirectory (fixes #219)

This commit is contained in:
Bernd Bestel 2019-04-27 15:17:55 +02:00
parent 6442665f6c
commit b6b8c76d3a
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 4 additions and 3 deletions

View File

@ -161,7 +161,7 @@ $('#product_id_text_input').on('blur', function(e)
className: 'btn-success add-new-product-dialog-button responsive-button ' + addProductWorkflowsAdditionalCssClasses,
callback: function()
{
window.location.href = U('/product/new?prefillname=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname));
window.location.href = U('/product/new?prefillname=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative));
}
},
addbarcode: {
@ -169,7 +169,7 @@ $('#product_id_text_input').on('blur', function(e)
className: 'btn-info add-new-barcode-dialog-button responsive-button',
callback: function()
{
window.location.href = U(window.location.pathname + '?addbarcodetoselection=' + encodeURIComponent(input));
window.location.href = U(Grocy.CurrentUrlRelative + '?addbarcodetoselection=' + encodeURIComponent(input));
}
},
addnewproductwithbarcode: {
@ -177,7 +177,7 @@ $('#product_id_text_input').on('blur', function(e)
className: 'btn-warning add-new-product-with-barcode-dialog-button responsive-button ' + addProductWorkflowsAdditionalCssClasses,
callback: function()
{
window.location.href = U('/product/new?prefillbarcode=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname));
window.location.href = U('/product/new?prefillbarcode=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative));
}
}
}

View File

@ -48,6 +48,7 @@
Grocy.Components = { };
Grocy.Mode = '{{ GROCY_MODE }}';
Grocy.BaseUrl = '{{ $U('/') }}';
Grocy.CurrentUrlRelative = window.location.pathname.replace(Grocy.BaseUrl, "");
Grocy.LocalizationStrings = {!! json_encode($localizationStrings) !!};
Grocy.ActiveNav = '@yield('activeNav', '')';
Grocy.Culture = '{{ GROCY_CULTURE }}';