mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Simplify rendering of checkboxes in forms
- Display "inline" so they take up much less vertical space
This commit is contained in:
parent
ba1ba67f87
commit
ad844c4393
@ -490,8 +490,6 @@ function constructFormBody(fields, options) {
|
|||||||
// Attach clear callbacks (if required)
|
// Attach clear callbacks (if required)
|
||||||
addClearCallbacks(fields, options);
|
addClearCallbacks(fields, options);
|
||||||
|
|
||||||
attachToggle(modal);
|
|
||||||
|
|
||||||
$(modal + ' .select2-container').addClass('select-full-width');
|
$(modal + ' .select2-container').addClass('select-full-width');
|
||||||
$(modal + ' .select2-container').css('width', '100%');
|
$(modal + ' .select2-container').css('width', '100%');
|
||||||
|
|
||||||
@ -1528,13 +1526,14 @@ function constructField(name, parameters, options) {
|
|||||||
html += `</div>`; // input-group
|
html += `</div>`; // input-group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Div for error messages
|
|
||||||
html += `<div id='errors-${name}'></div>`;
|
|
||||||
|
|
||||||
if (parameters.help_text) {
|
if (parameters.help_text) {
|
||||||
html += constructHelpText(name, parameters, options);
|
html += constructHelpText(name, parameters, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Div for error messages
|
||||||
|
html += `<div id='errors-${name}'></div>`;
|
||||||
|
|
||||||
|
|
||||||
html += `</div>`; // controls
|
html += `</div>`; // controls
|
||||||
html += `</div>`; // form-group
|
html += `</div>`; // form-group
|
||||||
|
|
||||||
@ -1699,6 +1698,10 @@ function constructInputOptions(name, classes, type, parameters) {
|
|||||||
opts.push(`placeholder='${parameters.placeholder}'`);
|
opts.push(`placeholder='${parameters.placeholder}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parameters.type == 'boolean') {
|
||||||
|
opts.push(`style='float: right;'`);
|
||||||
|
}
|
||||||
|
|
||||||
if (parameters.multiline) {
|
if (parameters.multiline) {
|
||||||
return `<textarea ${opts.join(' ')}></textarea>`;
|
return `<textarea ${opts.join(' ')}></textarea>`;
|
||||||
} else {
|
} else {
|
||||||
@ -1872,7 +1875,13 @@ function constructCandyInput(name, parameters, options) {
|
|||||||
*/
|
*/
|
||||||
function constructHelpText(name, parameters, options) {
|
function constructHelpText(name, parameters, options) {
|
||||||
|
|
||||||
var html = `<div id='hint_id_${name}' class='help-block'><i>${parameters.help_text}</i></div>`;
|
var style = '';
|
||||||
|
|
||||||
|
if (parameters.type == 'boolean') {
|
||||||
|
style = `style='display: inline;' `;
|
||||||
|
}
|
||||||
|
|
||||||
|
var html = `<div id='hint_id_${name}' ${style}class='help-block'><i>${parameters.help_text}</i></div>`;
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user