Load userobject forms in dialogs

This commit is contained in:
Bernd Bestel
2020-11-17 21:18:05 +01:00
parent 639ffe13f5
commit 2b4d8a7cc5
2 changed files with 20 additions and 6 deletions

View File

@@ -15,7 +15,14 @@
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/userobjects/' + Grocy.EditObjectParentName);
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/userobjects/' + Grocy.EditObjectParentName);
}
});
},
function(xhr)
@@ -32,7 +39,14 @@
{
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/userobjects/' + Grocy.EditObjectParentName);
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/userobjects/' + Grocy.EditObjectParentName);
}
});
},
function(xhr)

View File

@@ -30,8 +30,8 @@
</div>
<div class="related-links collapse d-md-flex order-2 width-xs-sm-100 m-1 mt-md-0 mb-md-0 float-right"
id="related-links">
<a class="btn btn-primary responsive-button mr-1"
href="{{ $U('/userobject/' . $userentity->name . '/new') }}">
<a class="btn btn-primary responsive-button mr-1 show-as-dialog-link"
href="{{ $U('/userobject/' . $userentity->name . '/new?embedded') }}">
{{ $__t('Add') }}
</a>
<a class="btn btn-outline-secondary d-print-none"
@@ -87,8 +87,8 @@
@foreach($userobjects as $userobject)
<tr>
<td class="fit-content border-right d-print-none">
<a class="btn btn-info btn-sm"
href="{{ $U('/userobject/' . $userentity->name . '/') }}{{ $userobject->id }}"
<a class="btn btn-info btn-sm show-as-dialog-link"
href="{{ $U('/userobject/' . $userentity->name . '/') }}{{ $userobject->id }}?embedded"
data-toggle="tooltip"
title="{{ $__t('Edit this item') }}">
<i class="fas fa-edit"></i>