--- /dev/null
+
+<ng-template #titleStringTmpl let-pfx="pfx" let-sfx="sfx">
+
+ <ng-container *ngIf="pfx">
+ <ng-container *ngIf="sfx">
+ <!-- trim prefix value when it competes with a suffix and add a seperator -->
+ <ng-container>{{pfx | slice:0:12}} - </ng-container>
+ </ng-container>
+ <ng-container *ngIf="!sfx">{{pfx}}</ng-container>
+ </ng-container>
+
+ <ng-container *ngIf="sfx">{{sfx}}</ng-container>
+
+ <!-- if no values are defined, use a generic default -->
+ <ng-container *ngIf="!pfx && !sfx">Evergreen</ng-container>
+
+</ng-template>
+<eg-string #titleString [template]="titleStringTmpl"></eg-string>
+
--- /dev/null
+import {Component, Input, AfterViewInit, ViewChild} from '@angular/core';
+import {Title} from '@angular/platform-browser';
+import {StringComponent} from '@eg/share/string/string.component';
+
+/*
+ <eg-title i18n-prefix i18n-suffix
+ prefix="Patron #{{patronId}}
+ suffix="Staff Client">
+ </eg-title>
+
+ Tab title shows (in en-US): "Patron #123 - Staff Client"
+*/
+
+@Component({
+ selector: 'eg-title',
+ templateUrl: 'title.component.html'
+})
+
+export class TitleComponent implements AfterViewInit {
+
+ initDone: boolean;
+
+ pfx: string;
+ @Input() set prefix(p: string) {
+ this.pfx = p;
+ this.setTitle();
+ }
+
+ sfx: string;
+ @Input() set suffix(s: string) {
+ this.sfx = s;
+ this.setTitle();
+ }
+
+ @ViewChild('titleString') titleString: StringComponent;
+
+ constructor(private title: Title) {}
+
+ ngAfterViewInit() {
+ this.initDone = true;
+ this.setTitle();
+ }
+
+ setTitle() {
+
+ // Avoid setting the title while the page is still loading
+ if (!this.initDone) { return; }
+
+ setTimeout(() => {
+ this.titleString.current({pfx: this.pfx, sfx: this.sfx})
+ .then(txt => this.title.setTitle(txt));
+ });
+ }
+}
+
import {ToastComponent} from '@eg/share/toast/toast.component';
import {StringComponent} from '@eg/share/string/string.component';
import {StringService} from '@eg/share/string/string.service';
+import {TitleComponent} from '@eg/share/title/title.component';
import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
import {DateSelectComponent} from '@eg/share/date-select/date-select.component';
import {RecordBucketDialogComponent} from '@eg/staff/share/buckets/record-bucket-dialog.component';
AccessKeyInfoComponent,
ToastComponent,
StringComponent,
+ TitleComponent,
OpChangeComponent,
FmRecordEditorComponent,
DateSelectComponent,
AccessKeyInfoComponent,
ToastComponent,
StringComponent,
+ TitleComponent,
OpChangeComponent,
FmRecordEditorComponent,
DateSelectComponent,
<eg-staff-banner bannerText="Sandbox" i18n-bannerText>
</eg-staff-banner>
+<eg-title
+ i18n-prefix i18n-suffix
+ prefix=":) {{dynamicTitleText}}"
+ suffix="Sandbox">
+</eg-title>
+
+<div class="row flex pt-2">
+ <div i18n> Modify Page Title: </div>
+ <div class="col-lg-2">
+ <input type="text" [(ngModel)]="dynamicTitleText" class="form-control"/>
+ </div>
+</div>
+
<!-- FM Editor Experiments ----------------------------- -->
<div class="row mb-3">
<ng-template #descriptionTemplate
<ng-template #printTemplate let-context>Hello, {{context.world}}!</ng-template>
<br/><br/>
-HERasdfE
<div class="row">
<div class="col-lg-3">
<eg-translate #translate [idlObject]="oneBtype" fieldName="name"></eg-translate>
name = 'Jane';
+ dynamicTitleText: string;
+
complimentEvergreen: (rows: IdlObject[]) => void;
notOneSelectedRow: (rows: IdlObject[]) => boolean;
this.complimentEvergreen = (rows: IdlObject[]) => alert('Evergreen is great!');
this.notOneSelectedRow = (rows: IdlObject[]) => (rows.length !== 1);
-
}
btGridRowClassCallback(row: any): string {