From 2f016910952d8cd97e75b301c35d5c3d710d9138 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 13 Jan 2022 16:37:42 +1100 Subject: [PATCH] "patch" for legacy checkboxes in HTML forms - Update to match the style of more "modern" API-driven forms - These legacy forms will be removed in future revision anyway --- InvenTree/templates/js/translated/modals.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/InvenTree/templates/js/translated/modals.js b/InvenTree/templates/js/translated/modals.js index e8697ac656..ad5e1c2742 100644 --- a/InvenTree/templates/js/translated/modals.js +++ b/InvenTree/templates/js/translated/modals.js @@ -372,6 +372,14 @@ function attachSelect(modal) { } +function attachBootstrapCheckbox(modal) { + /* Attach 'switch' functionality to any checkboxes on the form */ + + $(modal + ' .checkboxinput').addClass('form-check-input'); + $(modal + ' .checkboxinput').wrap(`
`); +} + + function loadingMessageContent() { /* Render a 'loading' message to display in a form * when waiting for a response from the server @@ -686,7 +694,9 @@ function injectModalForm(modal, form_html) { * Updates the HTML of the form content, and then applies some other updates */ $(modal).find('.modal-form-content').html(form_html); + attachSelect(modal); + attachBootstrapCheckbox(modal); }