mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
More modal iframe dialog handling improvements
This commit is contained in:
@@ -120,6 +120,11 @@ input[type='number'] {
|
||||
appearance: textfield;
|
||||
}
|
||||
|
||||
input::-webkit-outer-spin-button,
|
||||
input::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
.sticky-form-footer {
|
||||
border-top: 1px solid #d6d6d6;
|
||||
background-color: white;
|
||||
@@ -275,11 +280,20 @@ a:not([href]) {
|
||||
z-index: 99998;
|
||||
}
|
||||
|
||||
/* There is a little too much padding around modals */
|
||||
.modal-body {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
@media (min-width: 576px) {
|
||||
.form .modal-dialog {
|
||||
max-width: 650px;
|
||||
}
|
||||
|
||||
.wider .modal-dialog {
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.table .modal-dialog {
|
||||
max-width: 90%;
|
||||
}
|
||||
|
@@ -703,6 +703,30 @@ if (Grocy.CalendarFirstDayOfWeek)
|
||||
});
|
||||
}
|
||||
|
||||
if (GetUriParam("embedded"))
|
||||
{
|
||||
$("body").append('<div class="fixed-top"> \
|
||||
<button class="btn btn-light float-right close-last-modal-button" \
|
||||
type="button" \> \
|
||||
<i class="fa-solid fa-xmark"></i> \
|
||||
</button> \
|
||||
</div>');
|
||||
}
|
||||
|
||||
$(document).on("click", ".close-last-modal-button", function()
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("CloseLastModal"), Grocy.BaseUrl);
|
||||
});
|
||||
|
||||
$("body").on("keydown", function(e)
|
||||
{
|
||||
if (e.key == "Escape")
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("CloseLastModal"), Grocy.BaseUrl);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(window).on("message", function(e)
|
||||
{
|
||||
var data = e.originalEvent.data;
|
||||
@@ -769,17 +793,7 @@ function IframeModal(link, dialogClass = "form")
|
||||
size: 'large',
|
||||
backdrop: true,
|
||||
closeButton: false,
|
||||
className: dialogClass,
|
||||
buttons: {
|
||||
cancel: {
|
||||
label: __t('Close'),
|
||||
className: 'btn-secondary responsive-button',
|
||||
callback: function()
|
||||
{
|
||||
$(".modal").last().modal("hide");
|
||||
}
|
||||
}
|
||||
}
|
||||
className: dialogClass
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -107,5 +107,5 @@ Grocy.Components.UserfieldsForm.Load();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#name').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
Grocy.FrontendHelpers.ValidateForm('battery-form');
|
||||
|
@@ -492,7 +492,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
Grocy.Components.ProductPicker.HideCustomError();
|
||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||
$('#display_amount').focus();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#display_amount').focus();
|
||||
}, 150);
|
||||
|
||||
if (productDetails.stock_amount == productDetails.stock_amount_opened || productDetails.product.enable_tare_weight_handling == 1)
|
||||
{
|
||||
|
@@ -311,7 +311,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
$('#display_amount').val(productDetails.stock_amount);
|
||||
RefreshLocaleNumberInput();
|
||||
$(".input-group-productamountpicker").trigger("change");
|
||||
$('#display_amount').focus();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#display_amount').focus();
|
||||
}, 150);
|
||||
$('#display_amount').trigger('keyup');
|
||||
RefreshPriceHint();
|
||||
},
|
||||
|
@@ -93,4 +93,4 @@ Grocy.FrontendHelpers.ValidateForm('location-form');
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#name').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
|
@@ -99,7 +99,7 @@ Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#barcode').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
RefreshLocaleNumberInput();
|
||||
Grocy.Components.UserfieldsForm.Load()
|
||||
|
||||
|
@@ -78,5 +78,5 @@ Grocy.Components.UserfieldsForm.Load();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#name').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
Grocy.FrontendHelpers.ValidateForm('product-group-form');
|
||||
|
@@ -343,7 +343,10 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
$("#stock_label_type").trigger("change");
|
||||
}
|
||||
|
||||
$("#display_amount").focus();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#display_amount').focus();
|
||||
}, 150);
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && Grocy.FrontendHelpers.ValidateForm("purchase-form"))
|
||||
|
@@ -124,14 +124,14 @@ if (!Grocy.Components.ProductPicker.InAnyFlow())
|
||||
setTimeout(function()
|
||||
{
|
||||
$("#display_amount").focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTimeout(function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -143,7 +143,7 @@ else
|
||||
setTimeout(function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -82,5 +82,5 @@ Grocy.Components.UserfieldsForm.Load();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#name').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
Grocy.FrontendHelpers.ValidateForm('shopping-list-form');
|
||||
|
@@ -210,7 +210,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
$("#display_amount").trigger("change");
|
||||
}
|
||||
|
||||
$('#display_amount').focus();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#display_amount').focus();
|
||||
}, 150);
|
||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||
Grocy.ShoppingListItemFormInitialLoadDone = true;
|
||||
},
|
||||
@@ -289,14 +292,14 @@ if (!Grocy.Components.ProductPicker.InAnyFlow())
|
||||
setTimeout(function()
|
||||
{
|
||||
$("#display_amount").focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTimeout(function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -308,7 +311,7 @@ else
|
||||
setTimeout(function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -92,5 +92,5 @@ Grocy.Components.UserfieldsForm.Load();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#name').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');
|
||||
|
@@ -149,5 +149,5 @@ Grocy.Components.UserfieldsForm.Load();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#amount').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
Grocy.FrontendHelpers.ValidateForm("stockentry-form");
|
||||
|
@@ -92,5 +92,5 @@ Grocy.Components.UserfieldsForm.Load();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#name').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
Grocy.FrontendHelpers.ValidateForm('task-category-form');
|
||||
|
@@ -112,6 +112,6 @@ Grocy.Components.UserfieldsForm.Load();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#name').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||
Grocy.FrontendHelpers.ValidateForm('task-form');
|
||||
|
@@ -280,7 +280,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
Grocy.Components.ProductPicker.HideCustomError();
|
||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||
$('#display_amount').focus();
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#display_amount').focus();
|
||||
}, 150);
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
|
@@ -103,7 +103,7 @@ $("#show_in_sidebar_menu").on("click", function()
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#name').focus();
|
||||
}, 250);
|
||||
}, 150);
|
||||
Grocy.FrontendHelpers.ValidateForm('userentity-form');
|
||||
|
||||
// Click twice to trigger on-click but not change the actual checked state
|
||||
|
Reference in New Issue
Block a user