From: Jason Etheridge Date: Fri, 16 Dec 2022 12:28:38 +0000 (-0500) Subject: support appending custom templates to fields in fmEditor X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fe7e4003878dd7653148c9468fc70cb1268c7ae4;p=working%2FEvergreen.git support appending custom templates to fields in fmEditor --- diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html index 08d2f74953..43010a4dbb 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html @@ -27,7 +27,8 @@ -
+ +
@@ -199,6 +200,12 @@
+ + + + +
diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts index 504539a5b5..9b2a992683 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts @@ -84,6 +84,9 @@ export interface FmFieldOptions { // from the default set of form inputs. customTemplate?: CustomFieldTemplate; + // Follow the normal field rendering with this custom template + appendTemplate?: CustomFieldTemplate; + // help text to display via a popover helpText?: StringComponent; @@ -519,6 +522,11 @@ export class FmRecordEditorComponent }; } + if (fieldOptions.appendTemplate) { + field.append_template = fieldOptions.appendTemplate.template; + field.append_context = fieldOptions.appendTemplate.context; + } + if (fieldOptions.customTemplate) { field.template = fieldOptions.customTemplate.template; field.context = fieldOptions.customTemplate.context; @@ -591,6 +599,13 @@ export class FmRecordEditorComponent }, fieldDef.context || {} ); } + appendTemplateFieldContext(fieldDef: any): CustomFieldContext { + return Object.assign( + { record : this.record, + field: fieldDef // from this.fields + }, fieldDef.append_context || {} + ); + } save() { const recToSave = this.idl.clone(this.record);