mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Squashed commit
Make it possible to actively not-check a mandatory checkbox Userfield (closes #2601) Pluralize the "opened" localization string (closes #2280) Added a trendline to the price history chart (closes #2237) Various minor style/code refinements
This commit is contained in:
@@ -182,11 +182,19 @@ Grocy.Components.UserfieldsForm.Load = function()
|
||||
|
||||
if (userfield.type == "datetime" && userfield.default_value == "now")
|
||||
{
|
||||
input.val(moment().format("YYYY-MM-DD HH:mm:ss"))
|
||||
input.val(moment().format("YYYY-MM-DD HH:mm:ss"));
|
||||
}
|
||||
else if (userfield.type == "date" && userfield.default_value == "now")
|
||||
{
|
||||
input.val(moment().format("YYYY-MM-DD"))
|
||||
input.val(moment().format("YYYY-MM-DD"));
|
||||
}
|
||||
else if (userfield.type == "checkbox" && userfield.input_required == 1)
|
||||
{
|
||||
input.prop("indeterminate", true);
|
||||
input.on("change", function()
|
||||
{
|
||||
input.removeAttr("required");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -212,6 +220,12 @@ Grocy.Components.UserfieldsForm.Load = function()
|
||||
{
|
||||
var input = $(".userfield-input[data-userfield-name='" + key + "']");
|
||||
|
||||
if (input.attr("type") == "checkbox")
|
||||
{
|
||||
// The required attribute for checkboxes is only relevant when creating objects
|
||||
input.removeAttr("required");
|
||||
}
|
||||
|
||||
if (input.attr("type") == "checkbox" && value == 1)
|
||||
{
|
||||
input.prop("checked", true);
|
||||
|
Reference in New Issue
Block a user