LP#1857150: eg-fm-record-editor: support field-level help popovers
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 9 Apr 2020 15:24:04 +0000 (11:24 -0400)
committerJason Etheridge <jason@EquinoxInitiative.org>
Thu, 10 Sep 2020 20:36:02 +0000 (16:36 -0400)
Add a new helpText field option to supply text for help popovers
that display next to the field label.

Example usage:

<eg-string #hostHelpStr text="EDI FTP or SCP server, including protocol. For example, ftp://ftp.example.org." i18n-text></eg-string>

<eg-fm-record-editor #editDialog
  idlClass="acqedi"
  [fieldOptions]="{
                    host: {helpText: hostHelpStr},
                  }"
</eg-fm-record-editor>

Sponsored-by: Evergreen Community Development Initiative
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html
Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.module.ts

index 8ca13dc..af9f5f0 100644 (file)
@@ -30,6 +30,7 @@
       <div class="form-group row" *ngFor="let field of fields">
         <div class="col-lg-3">
           <label for="{{idPrefix}}-{{field.name}}">{{field.label}}</label>
+          <eg-help-popover [placement]="'right'" *ngIf="field.helpText" helpText="{{field.helpTextValue}}"></eg-help-popover>
         </div>
         <div class="col-lg-9">
 
index f6ff441..4b6ee5e 100644 (file)
@@ -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();
     }
 
index 6e9c5c3..1a95504 100644 (file)
@@ -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