Optimized button click tooltip hide handling (fixes #2206)

This commit is contained in:
Bernd Bestel 2023-05-03 08:32:49 +02:00
parent 5ab31f726a
commit 8bdb74a8e0
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
10 changed files with 21 additions and 60 deletions

View File

@ -90,6 +90,7 @@
- Added a new `config.php` setting `ENERGY_UNIT` to customize the label to display energy values (was fixed `kcal` before and defaults to that, so no changed behavior when not configured)
- Fixed that users were unable to delete their own API keys (when not having the `All permissions` permission)
- Fixed that button tooltips on some places didn't disappear after clicking the corresponding button
- New translations: (thanks all the translators)
- Romanian (demo available at <https://ro.demo.grocy.info>)

View File

@ -1233,9 +1233,7 @@ $('[data-toggle="tooltip"][data-html="true"]').on("shown.bs.tooltip", function()
$(document).on("click", "#clear-filter-button", function(e)
{
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
});
$(document).on("shown.bs.modal", function(e)

View File

@ -54,9 +54,7 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();

View File

@ -84,9 +84,7 @@ $(document).on('click', '.track-chore-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();

View File

@ -754,9 +754,7 @@ $(document).on("keydown", "#servings", function(e)
$(document).on('click', '.recipe-order-missing-button', function(e)
{
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
var objectName = $(e.currentTarget).attr('data-recipe-name');
var objectId = $(e.currentTarget).attr('data-recipe-id');
@ -820,9 +818,7 @@ $(document).on('click', '.product-consume-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();
@ -868,9 +864,7 @@ $(document).on('click', '.product-consume-button', function(e)
$(document).on('click', '.recipe-consume-button', function(e)
{
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
var objectName = $(e.currentTarget).attr('data-recipe-name');
var objectId = $(e.currentTarget).attr('data-recipe-id');
@ -925,9 +919,7 @@ $(document).on('click', '.recipe-consume-button', function(e)
$(document).on("click", ".display-recipe-button", function(e)
{
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
var objectId = $(e.currentTarget).attr('data-recipe-id');
var servings = $(e.currentTarget).attr('data-mealplan-servings');
@ -962,9 +954,7 @@ $(document).on("click", ".display-recipe-button", function(e)
$(document).on("click", ".display-product-button", function(e)
{
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr('data-product-id'));
$("#mealplan-productcard-modal").modal("show");
@ -974,9 +964,7 @@ $(document).on("click", ".mealplan-entry-done-button", function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
var mealPlanEntryId = $(e.currentTarget).attr("data-mealplan-entry-id");
Grocy.Api.Put("objects/meal_plan/" + mealPlanEntryId, { "done": 1 },
@ -995,9 +983,7 @@ $(document).on("click", ".mealplan-entry-undone-button", function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
var mealPlanEntryId = $(e.currentTarget).attr("data-mealplan-entry-id");
Grocy.Api.Put("objects/meal_plan/" + mealPlanEntryId, { "done": 0 },

View File

@ -440,9 +440,7 @@ $(document).on('click', '.ingredient-done-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
$(e.currentTarget).parent().toggleClass("text-strike-through");
});

View File

@ -121,9 +121,7 @@ $(document).on('click', '.shoppinglist-delete-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
Grocy.FrontendHelpers.BeginUiBusy();
@ -253,9 +251,7 @@ $(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', fu
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
var href = $(e.currentTarget).attr('href');
@ -335,9 +331,7 @@ $(document).on('click', '.order-listitem-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();

View File

@ -61,9 +61,7 @@ $(document).on('click', '.stock-consume-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();
@ -110,9 +108,7 @@ $(document).on('click', '.product-open-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();

View File

@ -130,9 +130,7 @@ $(document).on('click', '.product-consume-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();
@ -185,9 +183,7 @@ $(document).on('click', '.product-open-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();

View File

@ -54,9 +54,7 @@ $(document).on('click', '.do-task-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();
@ -99,9 +97,7 @@ $(document).on('click', '.undo-task-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
$(".tooltip").tooltip("hide");
Grocy.FrontendHelpers.BeginUiBusy();