From 4b0b76ecc53a664f3f5ae894eb76c1df5082ae1c Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Sat, 9 Jul 2022 02:28:52 +0200 Subject: [PATCH] Make "confirm" buttons a user-configurable option. (#3313) * Make "confirm" buttons a user-configurable option. Add a new setting to enable the confirm button Fixes #3069 * Add seperator --- InvenTree/common/models.py | 7 +++++++ InvenTree/templates/InvenTree/settings/global.html | 2 ++ InvenTree/templates/js/translated/forms.js | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index f38597abe6..fb0e19e4c4 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -850,6 +850,13 @@ class InvenTreeSetting(BaseInvenTreeSetting): 'default': False, }, + 'INVENTREE_REQUIRE_CONFIRM': { + 'name': _('Require confirm'), + 'description': _('Require explicit user confirmation for certain action.'), + 'validator': bool, + 'default': True, + }, + 'BARCODE_ENABLE': { 'name': _('Barcode Support'), 'description': _('Enable barcode scanner support'), diff --git a/InvenTree/templates/InvenTree/settings/global.html b/InvenTree/templates/InvenTree/settings/global.html index 4d36d59369..09833dc460 100644 --- a/InvenTree/templates/InvenTree/settings/global.html +++ b/InvenTree/templates/InvenTree/settings/global.html @@ -18,7 +18,9 @@ {% include "InvenTree/settings/setting.html" with key="INVENTREE_RESTRICT_ABOUT" icon="fa-info-circle" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_BASE_URL" icon="fa-globe" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_COMPANY_NAME" icon="fa-building" %} + {% include "InvenTree/settings/setting.html" with key="INVENTREE_DOWNLOAD_FROM_URL" icon="fa-cloud-download-alt" %} + {% include "InvenTree/settings/setting.html" with key="INVENTREE_REQUIRE_CONFIRM" icon="fa-check" %} diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index 02247bef7a..5c0daa8fd0 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -6,6 +6,7 @@ inventreeFormDataUpload, inventreeGet, inventreePut, + global_settings, modalEnable, modalShowSubmitButton, renderBuild, @@ -575,7 +576,7 @@ function constructFormBody(fields, options) { $(modal).find('#modal-footer-buttons').html(''); // Insert "confirm" button (if required) - if (options.confirm) { + if (options.confirm && global_settings.INVENTREE_REQUIRE_CONFIRM) { insertConfirmButton(options); }