From 91f51a5d0c0f2cd4e0357315041c9c6b14072c5c Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 9 Apr 2020 11:24:04 -0400 Subject: [PATCH] fm-editor: add helpText field option This accepts a reference to an eg-string to display as a popover for the specified fielod. Signed-off-by: Galen Charlton --- Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html | 1 + Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts | 8 ++++++++ Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.module.ts | 2 ++ 3 files changed, 11 insertions(+) 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 e07da2eeda..431dc287cc 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 @@ -30,6 +30,7 @@
+
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 9e0706ab58..b9bdae7a2f 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 @@ -76,6 +76,9 @@ export interface FmFieldOptions { // Render the field using this custom template instead of chosing // from the default set of form inputs. customTemplate?: CustomFieldTemplate; + + // help text to display via a popover + helpText?: StringComponent; } @Component({ @@ -539,6 +542,11 @@ export class FmRecordEditorComponent field.context = fieldOptions.customTemplate.context; } + if (fieldOptions.helpText) { + field.helpText = fieldOptions.helpText; + field.helpText.current().then(help => field.helpTextValue = help); + } + return promise || Promise.resolve(); } diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.module.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.module.ts index 6e9c5c3ec8..1a955040c8 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.module.ts +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.module.ts @@ -1,5 +1,6 @@ import {NgModule} from '@angular/core'; import {EgCommonModule} from '@eg/common.module'; +import {StaffCommonModule} from '@eg/staff/common.module'; import {CommonWidgetsModule} from '@eg/share/common-widgets.module'; import {StringModule} from '@eg/share/string/string.module'; import {TranslateModule} from '@eg/share/translate/translate.module'; @@ -14,6 +15,7 @@ import {FmRecordEditorActionComponent} from './fm-editor-action.component'; ], imports: [ EgCommonModule, + StaffCommonModule, StringModule, TranslateModule, CommonWidgetsModule -- 2.11.0