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

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

View File

@@ -30,8 +30,8 @@
</div> </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" <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"> id="related-links">
<a class="btn btn-primary responsive-button mr-1" <a class="btn btn-primary responsive-button mr-1 show-as-dialog-link"
href="{{ $U('/userobject/' . $userentity->name . '/new') }}"> href="{{ $U('/userobject/' . $userentity->name . '/new?embedded') }}">
{{ $__t('Add') }} {{ $__t('Add') }}
</a> </a>
<a class="btn btn-outline-secondary d-print-none" <a class="btn btn-outline-secondary d-print-none"
@@ -87,8 +87,8 @@
@foreach($userobjects as $userobject) @foreach($userobjects as $userobject)
<tr> <tr>
<td class="fit-content border-right d-print-none"> <td class="fit-content border-right d-print-none">
<a class="btn btn-info btn-sm" <a class="btn btn-info btn-sm show-as-dialog-link"
href="{{ $U('/userobject/' . $userentity->name . '/') }}{{ $userobject->id }}" href="{{ $U('/userobject/' . $userentity->name . '/') }}{{ $userobject->id }}?embedded"
data-toggle="tooltip" data-toggle="tooltip"
title="{{ $__t('Edit this item') }}"> title="{{ $__t('Edit this item') }}">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>