From b62c354b9ac9d6e6f321b8fa3e59a687f8fb8886 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 e1ba382b63..5b046136cc 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 58c400fcf1..71255ed2f8 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 @@ -75,6 +75,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({ @@ -518,6 +521,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