diff --git a/changelog/82_UNRELEASED_xxxx-xx-xx.md b/changelog/82_UNRELEASED_xxxx-xx-xx.md
index 0c3b4538..2c28420a 100644
--- a/changelog/82_UNRELEASED_xxxx-xx-xx.md
+++ b/changelog/82_UNRELEASED_xxxx-xx-xx.md
@@ -48,7 +48,7 @@
### Userfields
-- xxx
+- Fixed that Userfields of type "Select list (a single item can be selected)" changed by keyboard only were not saved
### General
diff --git a/public/js/grocy.js b/public/js/grocy.js
index 221700e3..3865df38 100644
--- a/public/js/grocy.js
+++ b/public/js/grocy.js
@@ -1,10 +1,10 @@
Grocy.Api = {};
-Grocy.Api.Get = function(apiFunction, success, error)
+Grocy.Api.Get = function (apiFunction, success, error)
{
var xhr = new XMLHttpRequest();
var url = U('/api/' + apiFunction);
- xhr.onreadystatechange = function()
+ xhr.onreadystatechange = function ()
{
if (xhr.readyState === XMLHttpRequest.DONE)
{
@@ -36,12 +36,12 @@ Grocy.Api.Get = function(apiFunction, success, error)
xhr.send();
};
-Grocy.Api.Post = function(apiFunction, jsonData, success, error)
+Grocy.Api.Post = function (apiFunction, jsonData, success, error)
{
var xhr = new XMLHttpRequest();
var url = U('/api/' + apiFunction);
- xhr.onreadystatechange = function()
+ xhr.onreadystatechange = function ()
{
if (xhr.readyState === XMLHttpRequest.DONE)
{
@@ -74,12 +74,12 @@ Grocy.Api.Post = function(apiFunction, jsonData, success, error)
xhr.send(JSON.stringify(jsonData));
};
-Grocy.Api.Put = function(apiFunction, jsonData, success, error)
+Grocy.Api.Put = function (apiFunction, jsonData, success, error)
{
var xhr = new XMLHttpRequest();
var url = U('/api/' + apiFunction);
- xhr.onreadystatechange = function()
+ xhr.onreadystatechange = function ()
{
if (xhr.readyState === XMLHttpRequest.DONE)
{
@@ -112,12 +112,12 @@ Grocy.Api.Put = function(apiFunction, jsonData, success, error)
xhr.send(JSON.stringify(jsonData));
};
-Grocy.Api.Delete = function(apiFunction, jsonData, success, error)
+Grocy.Api.Delete = function (apiFunction, jsonData, success, error)
{
var xhr = new XMLHttpRequest();
var url = U('/api/' + apiFunction);
- xhr.onreadystatechange = function()
+ xhr.onreadystatechange = function ()
{
if (xhr.readyState === XMLHttpRequest.DONE)
{
@@ -150,12 +150,12 @@ Grocy.Api.Delete = function(apiFunction, jsonData, success, error)
xhr.send(JSON.stringify(jsonData));
};
-Grocy.Api.UploadFile = function(file, group, fileName, success, error)
+Grocy.Api.UploadFile = function (file, group, fileName, success, error)
{
var xhr = new XMLHttpRequest();
var url = U('/api/files/' + group + '/' + btoa(fileName));
- xhr.onreadystatechange = function()
+ xhr.onreadystatechange = function ()
{
if (xhr.readyState === XMLHttpRequest.DONE)
{
@@ -188,12 +188,12 @@ Grocy.Api.UploadFile = function(file, group, fileName, success, error)
xhr.send(file);
};
-Grocy.Api.DeleteFile = function(fileName, group, success, error)
+Grocy.Api.DeleteFile = function (fileName, group, success, error)
{
var xhr = new XMLHttpRequest();
var url = U('/api/files/' + group + '/' + btoa(fileName));
- xhr.onreadystatechange = function()
+ xhr.onreadystatechange = function ()
{
if (xhr.readyState === XMLHttpRequest.DONE)
{
@@ -226,14 +226,14 @@ Grocy.Api.DeleteFile = function(fileName, group, success, error)
xhr.send();
};
-U = function(relativePath)
+U = function (relativePath)
{
return Grocy.BaseUrl.replace(/\/$/, '') + relativePath;
}
Grocy.Translator = new window.translator.default(Grocy.LocalizationStrings);
Grocy.TranslatorQu = new window.translator.default(Grocy.LocalizationStringsQu);
-__t = function(text, ...placeholderValues)
+__t = function (text, ...placeholderValues)
{
if (!text)
{
@@ -258,7 +258,7 @@ __t = function(text, ...placeholderValues)
return Grocy.Translator.__(text, ...placeholderValues);
}
}
-__n = function(number, singularForm, pluralForm, isQu = false)
+__n = function (number, singularForm, pluralForm, isQu = false)
{
if (!singularForm)
{
@@ -291,9 +291,9 @@ __n = function(number, singularForm, pluralForm, isQu = false)
}
}
-RefreshContextualTimeago = function(rootSelector = "#page-content")
+RefreshContextualTimeago = function (rootSelector = "#page-content")
{
- $(rootSelector + " time.timeago").each(function()
+ $(rootSelector + " time.timeago").each(function ()
{
var element = $(this);
@@ -357,7 +357,7 @@ toastr.options = {
};
Grocy.FrontendHelpers = {};
-Grocy.FrontendHelpers.ValidateForm = function(formId, reportValidity = false)
+Grocy.FrontendHelpers.ValidateForm = function (formId, reportValidity = false)
{
var form = document.getElementById(formId);
if (form === null || form === undefined)
@@ -375,7 +375,7 @@ Grocy.FrontendHelpers.ValidateForm = function(formId, reportValidity = false)
return form.checkValidity();
}
-Grocy.FrontendHelpers.BeginUiBusy = function(formId = null)
+Grocy.FrontendHelpers.BeginUiBusy = function (formId = null)
{
$("body").addClass("cursor-busy");
@@ -385,7 +385,7 @@ Grocy.FrontendHelpers.BeginUiBusy = function(formId = null)
}
}
-Grocy.FrontendHelpers.EndUiBusy = function(formId = null)
+Grocy.FrontendHelpers.EndUiBusy = function (formId = null)
{
$("body").removeClass("cursor-busy");
@@ -395,10 +395,10 @@ Grocy.FrontendHelpers.EndUiBusy = function(formId = null)
}
}
-Grocy.FrontendHelpers.ShowGenericError = function(message, exception)
+Grocy.FrontendHelpers.ShowGenericError = function (message, exception)
{
toastr.error(__t(message) + '
' + __t('Click to show technical details'), '', {
- onclick: function()
+ onclick: function ()
{
var errorDetails = JSON.stringify(exception, null, 4);
if (typeof exception === "object" && exception !== null && exception.hasOwnProperty("error_message"))
@@ -418,7 +418,7 @@ Grocy.FrontendHelpers.ShowGenericError = function(message, exception)
console.error(exception);
}
-Grocy.FrontendHelpers.SaveUserSetting = function(settingsKey, value, force = false)
+Grocy.FrontendHelpers.SaveUserSetting = function (settingsKey, value, force = false)
{
if (Grocy.UserSettings[settingsKey] == value && !force)
{
@@ -430,30 +430,30 @@ Grocy.FrontendHelpers.SaveUserSetting = function(settingsKey, value, force = fal
jsonData = {};
jsonData.value = value;
Grocy.Api.Put('user/settings/' + settingsKey, jsonData,
- function(result)
+ function (result)
{
// Nothing to do...
},
- function(xhr)
+ function (xhr)
{
console.error(xhr);
}
);
}
-Grocy.FrontendHelpers.DeleteUserSetting = function(settingsKey, reloadPageOnSuccess = false)
+Grocy.FrontendHelpers.DeleteUserSetting = function (settingsKey, reloadPageOnSuccess = false)
{
delete Grocy.UserSettings[settingsKey];
Grocy.Api.Delete('user/settings/' + settingsKey, {},
- function(result)
+ function (result)
{
if (reloadPageOnSuccess)
{
location.reload();
}
},
- function(xhr)
+ function (xhr)
{
if (xhr.statusText)
{
@@ -463,7 +463,7 @@ Grocy.FrontendHelpers.DeleteUserSetting = function(settingsKey, reloadPageOnSucc
);
}
-Grocy.FrontendHelpers.RunWebhook = function(webhook, data, repetitions = 1)
+Grocy.FrontendHelpers.RunWebhook = function (webhook, data, repetitions = 1)
{
Object.assign(data, webhook.extra_data);
var hasAlreadyFailed = false;
@@ -472,7 +472,7 @@ Grocy.FrontendHelpers.RunWebhook = function(webhook, data, repetitions = 1)
{
if (webhook.json)
{
- $.ajax(webhook.hook, { "data": JSON.stringify(data), "contentType": "application/json", "type": "POST" }).fail(function(req, status, errorThrown)
+ $.ajax(webhook.hook, { "data": JSON.stringify(data), "contentType": "application/json", "type": "POST" }).fail(function (req, status, errorThrown)
{
if (!hasAlreadyFailed)
{
@@ -483,7 +483,7 @@ Grocy.FrontendHelpers.RunWebhook = function(webhook, data, repetitions = 1)
}
else
{
- $.post(webhook.hook, data).fail(function(req, status, errorThrown)
+ $.post(webhook.hook, data).fail(function (req, status, errorThrown)
{
if (!hasAlreadyFailed)
{
@@ -495,17 +495,13 @@ Grocy.FrontendHelpers.RunWebhook = function(webhook, data, repetitions = 1)
}
}
-$(document).on("keyup paste change", "input, textarea", function()
-{
- $(this).addClass("is-dirty").closest("form").addClass("is-dirty");
-});
-$(document).on("click", "select", function()
+$(document).on("keyup paste change click", "input, select, textarea", function ()
{
$(this).addClass("is-dirty").closest("form").addClass("is-dirty");
});
// Auto saving user setting controls
-$(document).on("change", ".user-setting-control", function()
+$(document).on("change", ".user-setting-control", function ()
{
var element = $(this);
var settingKey = element.attr("data-setting-key");
@@ -534,7 +530,7 @@ $(document).on("change", ".user-setting-control", function()
});
// Show file name Bootstrap custom file input
-$('input.custom-file-input').on('change', function()
+$('input.custom-file-input').on('change', function ()
{
$(this).next('.custom-file-label').html(GetFileNameFromPath($(this).val()));
});
@@ -545,9 +541,9 @@ if ($(".custom-file-label").length > 0)
$("