2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-05 05:00:58 +00:00

Adds a user-configurable setting to configure how dates are displayed (on the front end only!)

This commit is contained in:
Oliver
2022-02-28 15:57:34 +11:00
parent 010ce48ce0
commit b19719516b
4 changed files with 56 additions and 3 deletions

View File

@ -40,12 +40,15 @@ function editSetting(pk, options={}) {
url = `/api/settings/user/${pk}/`;
}
var reload_required = false;
// First, read the settings object from the server
inventreeGet(url, {}, {
success: function(response) {
if (response.choices && response.choices.length > 0) {
response.type = 'choice';
reload_required = true;
}
// Construct the field
@ -89,7 +92,9 @@ function editSetting(pk, options={}) {
var setting = response.key;
if (response.type == 'boolean') {
if (reload_required) {
location.reload();
} else if (response.type == 'boolean') {
var enabled = response.value.toString().toLowerCase() == 'true';
$(`#setting-value-${setting}`).prop('checked', enabled);
} else {