From 775bd49fc11f71ce42d343c7624f9cd168e88d8f Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 9 Apr 2020 11:24:04 -0400 Subject: [PATCH] LP#1857150: eg-fm-record-editor: support field-level help popovers Add a new helpText field option to supply text for help popovers that display next to the field label. Example usage: Sponsored-by: Evergreen Community Development Initiative Signed-off-by: Galen Charlton Signed-off-by: Ruth Frasur Signed-off-by: Bill Erickson Signed-off-by: Jason Etheridge --- 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 8ca13dcdd7..af9f5f0197 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 f6ff4418e8..4b6ee5ef4e 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({ @@ -540,6 +543,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