</div>
</div>
<ngb-tabset #recordTabs [activeId]="recordTab" (tabChange)="onTabChange($event)">
- <ngb-tab title="Copy Table" i18n-title id="copy_table">
+ <ngb-tab title="Copy Table" i18n-title id="catalog">
<ng-template ngbTabContent>
<eg-catalog-copies [recordId]="recordId"></eg-catalog-copies>
</ng-template>
</ngb-tab>
<ngb-tab title="View Holds" i18n-title id="holds">
</ngb-tab>
- <ngb-tab title="Monograph Parts" i18n-title id="parts">
+ <ngb-tab title="Monograph Parts" i18n-title id="monoparts">
<ng-template ngbTabContent>
<eg-catalog-record-parts [recordId]="recordId">
</eg-catalog-record-parts>
</ng-template>
</ngb-tab>
+ <ngb-tab title="Holdings View" i18n-title id="holdings">
+ </ngb-tab>
+ <ngb-tab title="Conjoined Items" i18n-title id="conjoined">
+ </ngb-tab>
</ngb-tabset>
</div>
</div>
import {BibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component';
import {StoreService} from '@eg/core/store.service';
+const ANGJS_TABS: any = {
+ marc_edit: true,
+ holds: true,
+ holdings: true,
+ conjoined: true
+};
+
@Component({
selector: 'eg-catalog-record',
templateUrl: 'record.component.html'
this.defaultTab =
this.store.getLocalItem('eg.cat.default_record_tab')
- || 'copy_table';
+ || 'catalog';
// TODO: Implement default tab handling for tabs that require
// and AngJS redirect.
// This is done so no intermediate redirect is required, which
// messes with browser back/forward navigation.
this.route.paramMap.subscribe((params: ParamMap) => {
- this.recordTab = params.get('tab') || this.defaultTab;
+ this.recordTab = params.get('tab');
this.recordId = +params.get('id');
this.searchContext = this.staffCat.searchContext;
+
+ if (!this.recordTab) {
+ this.recordTab = this.defaultTab || 'catalog';
+ // On initial load, if the default tab is set to one of
+ // the AngularJS tabs, redirect the user there.
+ if (this.recordTab in ANGJS_TABS) {
+ return this.routeToTab();
+ }
+ }
+
this.loadRecord();
});
}
// prevent tab changing until after route navigation
evt.preventDefault();
- // Some tabs live in the AngJS app.
- const angjsBase = '/eg/staff/cat/catalog/record';
- switch(this.recordTab) {
- case 'marc_edit':
- window.location.href =
- `${angjsBase}/${this.recordId}/marc_edit`;
- return;
- case 'holds':
- window.location.href =
- `${angjsBase}/${this.recordId}/holds`;
- return;
+ this.routeToTab();
+ }
+
+ routeToTab() {
+
+ // Route to the AngularJS catalog tab
+ if (this.recordTab in ANGJS_TABS) {
+ const angjsBase = '/eg/staff/cat/catalog/record';
+
+ window.location.href =
+ `${angjsBase}/${this.recordId}/${this.recordTab}`;
+ return;
}
- const url = `/staff/catalog/record/${this.recordId}/${this.recordTab}`;
+ const url =
+ `/staff/catalog/record/${this.recordId}/${this.recordTab}`;
// Retain search parameters
this.router.navigate([url], {queryParamsHandling: 'merge'});