mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
UI test/review
This commit is contained in:
@@ -707,3 +707,27 @@ $('.dropdown-item').has('.form-check input[type=checkbox]').on('click', function
|
||||
$(e.target).find('input[type=checkbox]').click();
|
||||
}
|
||||
})
|
||||
|
||||
$('.table').on('column-sizing.dt', function(e, settings)
|
||||
{
|
||||
var dtScrollWidth = $('.dataTables_scroll').width();
|
||||
var tableWidth = $('.table').width();
|
||||
|
||||
if (dtScrollWidth < tableWidth)
|
||||
{
|
||||
$('.dataTables_scrollBody').addClass("grab-cursor");
|
||||
} else
|
||||
{
|
||||
$('.dataTables_scrollBody').removeClass("grab-cursor");
|
||||
}
|
||||
});
|
||||
|
||||
$(window).on("message", function(e)
|
||||
{
|
||||
var data = e.originalEvent.data;
|
||||
|
||||
if (data.Message === "Reload")
|
||||
{
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
|
@@ -25,7 +25,7 @@ $("#clear-filter-button").on("click", function()
|
||||
{
|
||||
$("#search").val("");
|
||||
$("#status-filter").val("all");
|
||||
batteriesOverviewTable.column(4).search("").draw();
|
||||
batteriesOverviewTable.column(5).search("").draw();
|
||||
batteriesOverviewTable.search("").draw();
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ $("#status-filter").on("change", function()
|
||||
// Transfer CSS classes of selected element to dropdown element (for background)
|
||||
$(this).attr("class", $("#" + $(this).attr("id") + " option[value='" + value + "']").attr("class") + " form-control");
|
||||
|
||||
batteriesOverviewTable.column(4).search(value).draw();
|
||||
batteriesOverviewTable.column(5).search(value).draw();
|
||||
});
|
||||
|
||||
$(".status-filter-message").on("click", function()
|
||||
|
@@ -88,7 +88,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
|
||||
$('#productcard-product-edit-button').attr("href", U("/product/" + productDetails.product.id.toString() + '?' + 'returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative)));
|
||||
$('#productcard-product-journal-button').attr("href", U("/stockjournal?embedded&product=" + productDetails.product.id.toString()));
|
||||
$('#productcard-product-stock-button').attr("href", U("/stockentries?product=" + productDetails.product.id.toString()));
|
||||
$('#productcard-product-stock-button').attr("href", U("/stockentries?embedded&product=" + productDetails.product.id.toString()));
|
||||
$('#productcard-product-stock-button').removeClass("disabled");
|
||||
$('#productcard-product-edit-button').removeClass("disabled");
|
||||
$('#productcard-product-journal-button').removeClass("disabled");
|
||||
|
@@ -388,6 +388,12 @@ $('#amount').on('focus', function(e)
|
||||
$(this).select();
|
||||
});
|
||||
|
||||
$('#price').on('focus', function(e)
|
||||
{
|
||||
$(this).select();
|
||||
});
|
||||
|
||||
|
||||
$('#consume-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||
|
@@ -415,12 +415,6 @@ Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||
$("#allow_partial_units_in_stock").click();
|
||||
$("#allow_partial_units_in_stock").click();
|
||||
|
||||
$(document).on('click', '#save-product-button-continue', function()
|
||||
{
|
||||
Grocy.ProductEditFormRedirectUri = "reload";
|
||||
$('#save-product-button').click();
|
||||
});
|
||||
|
||||
$(document).on('click', '.qu-conversion-delete-button', function(e)
|
||||
{
|
||||
var objectId = $(e.currentTarget).attr('data-qu-conversion-id');
|
||||
|
@@ -355,6 +355,11 @@ $('#amount').on('focus', function(e)
|
||||
}
|
||||
});
|
||||
|
||||
$('#price').on('focus', function(e)
|
||||
{
|
||||
$(this).select();
|
||||
});
|
||||
|
||||
$('#purchase-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
|
@@ -423,41 +423,9 @@ $(document).on("click", "#clear-description-button", function(e)
|
||||
$("#save-description-button").click();
|
||||
});
|
||||
|
||||
$(".switch-view-mode-button").on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
$("#shoppinglist-main").toggleClass("fullscreen");
|
||||
$(".dataTables_scrollHeadInner").width(""); // Remove absolute width on element set by DataTables
|
||||
$(".dataTables_scrollHeadInner table").width(""); // Remove absolute width on element set by DataTables
|
||||
$("body").toggleClass("fullscreen-card");
|
||||
$("#shopping-list-normal-view-button").toggleClass("d-none");
|
||||
$("#mainNav").toggleClass("d-none");
|
||||
|
||||
if ($("body").hasClass("fullscreen-card"))
|
||||
{
|
||||
window.location.hash = "#compact";
|
||||
}
|
||||
else
|
||||
{
|
||||
window.history.replaceState(null, null, " ");
|
||||
}
|
||||
});
|
||||
|
||||
$("#description").trigger("summernote.change");
|
||||
$("#save-description-button").addClass("disabled");
|
||||
|
||||
if (window.location.hash === "#compact")
|
||||
{
|
||||
$("#shopping-list-compact-view-button").click();
|
||||
}
|
||||
|
||||
// Auto switch to compact view on mobile when enabled
|
||||
if ($(window).width() < 768 & window.location.hash !== "#compact" && !BoolVal(Grocy.UserSettings.shopping_list_disable_auto_compact_view_on_mobile))
|
||||
{
|
||||
$("#shopping-list-compact-view-button").click();
|
||||
}
|
||||
|
||||
$(window).on("message", function(e)
|
||||
{
|
||||
var data = e.originalEvent.data;
|
||||
|
@@ -7,8 +7,3 @@ if (BoolVal(Grocy.UserSettings.shopping_list_show_calendar))
|
||||
{
|
||||
$("#shopping-list-show-calendar").prop("checked", true);
|
||||
}
|
||||
|
||||
if (BoolVal(Grocy.UserSettings.shopping_list_disable_auto_compact_view_on_mobile))
|
||||
{
|
||||
$("#shopping-list-disable-auto-compact-view-on-mobile").prop("checked", true);
|
||||
}
|
||||
|
@@ -11,20 +11,6 @@
|
||||
],
|
||||
});
|
||||
|
||||
$('#stock-overview-table').on('column-sizing.dt', function(e, settings)
|
||||
{
|
||||
var dtScrollWidth = $('.dataTables_scroll').width();
|
||||
var stockTableWidth = $('#stock-overview-table').width();
|
||||
|
||||
if (dtScrollWidth < stockTableWidth)
|
||||
{
|
||||
$('.dataTables_scrollBody').addClass("grab-cursor");
|
||||
} else
|
||||
{
|
||||
$('.dataTables_scrollBody').removeClass("grab-cursor");
|
||||
}
|
||||
});
|
||||
|
||||
$('#stock-overview-table tbody').removeClass("d-none");
|
||||
stockOverviewTable.columns.adjust().draw();
|
||||
$('.dataTables_scrollBody').addClass("dragscroll");
|
||||
|
@@ -17,7 +17,14 @@
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
{
|
||||
window.location.href = U('/tasks');
|
||||
if (GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href = U('/tasks');
|
||||
}
|
||||
});
|
||||
},
|
||||
function(xhr)
|
||||
@@ -34,7 +41,14 @@
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
{
|
||||
window.location.href = U('/tasks');
|
||||
if (GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href = U('/tasks');
|
||||
}
|
||||
});
|
||||
},
|
||||
function(xhr)
|
||||
|
Reference in New Issue
Block a user