From ed2f21f583358c7d6af1d4360ce14ae9d4c48c10 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 28 Jun 2021 21:38:42 +1000 Subject: [PATCH] Display field prefix element in form --- InvenTree/company/templates/company/index.html | 4 ++++ InvenTree/templates/js/forms.js | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html index fef338078a..796796528f 100644 --- a/InvenTree/company/templates/company/index.html +++ b/InvenTree/company/templates/company/index.html @@ -45,6 +45,10 @@ method: 'POST', title: '{% trans "Edit Part Details" %}', fields: { + title: { + prefix: `` + }, + reference: {}, part: { filters: { } diff --git a/InvenTree/templates/js/forms.js b/InvenTree/templates/js/forms.js index 9343751926..318dfab1b4 100644 --- a/InvenTree/templates/js/forms.js +++ b/InvenTree/templates/js/forms.js @@ -275,6 +275,9 @@ function constructFormBody(fields, options) { // Edit callback fields[field].onEdit = field_options.onEdit; + + // Field prefix + fields[field].prefix = field_options.prefix; } } @@ -835,14 +838,21 @@ function constructField(name, parameters, options) { html += `
`; + if (parameters.prefix) { + html += `
${parameters.prefix}`; + } + html += constructInput(name, parameters, options); + if (parameters.prefix) { + html += `
`; // input-group + } + if (parameters.help_text) { html += constructHelpText(name, parameters, options); } html += `
`; // controls - html += ``; // form-group return html;