From ad844c439368f4d25f6f3a7f3d315473b41584c0 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 14 Aug 2021 01:05:06 +1000 Subject: [PATCH] Simplify rendering of checkboxes in forms - Display "inline" so they take up much less vertical space --- InvenTree/templates/js/translated/forms.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index b4f1203220..37a4f1f1d6 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -490,8 +490,6 @@ function constructFormBody(fields, options) { // Attach clear callbacks (if required) addClearCallbacks(fields, options); - attachToggle(modal); - $(modal + ' .select2-container').addClass('select-full-width'); $(modal + ' .select2-container').css('width', '100%'); @@ -1528,13 +1526,14 @@ function constructField(name, parameters, options) { html += ``; // input-group } - // Div for error messages - html += `
`; - if (parameters.help_text) { html += constructHelpText(name, parameters, options); } + // Div for error messages + html += `
`; + + html += ``; // controls html += ``; // form-group @@ -1699,6 +1698,10 @@ function constructInputOptions(name, classes, type, parameters) { opts.push(`placeholder='${parameters.placeholder}'`); } + if (parameters.type == 'boolean') { + opts.push(`style='float: right;'`); + } + if (parameters.multiline) { return ``; } else { @@ -1872,7 +1875,13 @@ function constructCandyInput(name, parameters, options) { */ function constructHelpText(name, parameters, options) { - var html = `
${parameters.help_text}
`; + var style = ''; + + if (parameters.type == 'boolean') { + style = `style='display: inline;' `; + } + + var html = `
${parameters.help_text}
`; return html; } \ No newline at end of file