From: Galen Charlton Date: Mon, 20 Feb 2023 22:13:45 +0000 (-0500) Subject: LP#2007877: various fixes to Server Admin Print Templates page X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f0ea824684afc6ac02ca65aace91992c79504982;p=evergreen%2Fpines.git LP#2007877: various fixes to Server Admin Print Templates page This patch fixes a regression introduced by the switch to NgbNav as well as a number of other issues. To test ------- [1] Open the Server Administration -> Print Templates page and select a print template. Observe that the template editor is not displayed and that there are errors in the browser console. [2] Apply the patch and repeat step 1. This time, the template is displayed along with its previewed. [3] Switch to the Sample Data tab, then select another template. Observe that the template is reloaded and the active tab switched to the template editor. [4] Select a template such as "Checkin" that does not have stock sample data. Observe that the Preview and Compiled Content panes on the template editor tab are empty and that the Sample Data tab has an empty control Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html index 81a8879988..e2bd27f0d9 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html @@ -50,83 +50,85 @@ - - -
\ No newline at end of file + + +
  • + Sample Data + + + +
  • + + +
    + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts index dd3be36fd8..4575852923 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts @@ -37,9 +37,9 @@ export class PrintTemplateComponent implements OnInit { templateCache: {[id: number]: IdlObject} = {}; initialOrg: number; selectedOrgs: number[]; + selectedTab = 'template'; @ViewChild('templateSelector', { static: true }) templateSelector: ComboboxComponent; - @ViewChild('tabs', { static: false }) tabs: NgbNav; @ViewChild('editDialog', { static: true }) editDialog: FmRecordEditorComponent; @ViewChild('confirmDelete', { static: true }) confirmDelete: ConfirmDialogComponent; @ViewChild('printContextCbox', {static: false}) printContextCbox: ComboboxComponent; @@ -170,7 +170,7 @@ export class PrintTemplateComponent implements OnInit { this.org.list()[0]; } - onTabChange(evt: NgbNavChangeEvent) { + onNavChange(evt: NgbNavChangeEvent) { if (evt.nextId === 'template') { this.refreshPreview(); } @@ -243,7 +243,7 @@ export class PrintTemplateComponent implements OnInit { } // If the selected template changes through means other than the - // template selecdtor, setting updateSelector=true will force the + // template selector, setting updateSelector=true will force the // template to appear in the selector and get selected, regardless // of whether it would have been fetched with current filters. selectTemplate(id: number, updateSelector?: boolean) { @@ -254,6 +254,14 @@ export class PrintTemplateComponent implements OnInit { return; } + // reset things + this.selectedTab = 'template'; + this.compiledContent = ''; + if (this.container()) { + this.container().innerHTML = ''; + } + this.sampleJson = ''; + this.pcrud.retrieve('cpt', id).subscribe(t => { this.template = this.templateCache[id] = t;